Replace jq with a node script to extract dependencies list to simplify

docker build.
This commit is contained in:
Christopher Broderick
2025-11-05 14:09:16 +00:00
parent eba2073840
commit 67f60fae79
2 changed files with 16 additions and 1 deletions

View File

@@ -10,6 +10,10 @@ PIP = pip3
TOX = tox
REQUIRED_BINS := node
$(foreach bin,$(REQUIRED_BINS),\
$(if $(shell command -v $(bin) 2> /dev/null),,$(error Please install: `$(bin)`)))
#: help - Display callable targets.
.PHONY: help
help:
@@ -132,7 +136,8 @@ STATIC_DIR := src/helpdesk/static/helpdesk/vendor
# Use jq to read the top-level 'dependencies' keys from package.json
# The tr command converts newlines to spaces for Make.
VENDORS := $(shell jq -r '.dependencies | keys[]' package.json 2>/dev/null | tr '\n' ' ')
VENDORS := $(shell node get_deps.js | tr '\n[],' ' ')
.PHONY: static-vendor setup-vendor-dirs
static-vendor: setup-vendor-dirs $(addprefix $(STATIC_DIR)/,$(VENDORS))

10
get_deps.js Normal file
View File

@@ -0,0 +1,10 @@
const fs = require('fs');
fs.readFile('package.json', 'utf8',
(err, data) => {
if (err) {
return;
}
const jsonObject = JSON.parse(data);
console.log(Object.keys(jsonObject.dependencies));
});