Skip to content

Commit ca14218

Browse files
committed
feat(npx): switch from npm to npx to isolate dependencies
1 parent 2b4b3bd commit ca14218

5 files changed

Lines changed: 30 additions & 4 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ updates:
2424
default-days: 7
2525
commit-message:
2626
prefix: build(deps)
27+
- package-ecosystem: "npm"
28+
directory: "/xml"
29+
schedule:
30+
interval: "daily"
31+
cooldown:
32+
default-days: 7
33+
commit-message:
34+
prefix: build(deps)
2735
- package-ecosystem: "github-actions"
2836
directory: "/"
2937
schedule:

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ To know more command-line options of `xmllint`:
6666
docker run --rm --net=none leplusorg/xml xmllint --help
6767
```
6868

69+
## NPM Packages
70+
71+
Use the `npx` command to run command-line tools coming from npm
72+
packages. This ensures isolation between the different packages
73+
(including potentially conflicting dependencies).
74+
6975
## Software Bill of Materials (SBOM)
7076

7177
To get the SBOM for the latest image (in SPDX JSON format), use the

xml/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ RUN pipx ensurepath --global \
4848
&& xargs -a /tmp/requirements.txt -n 1 pipx install --global \
4949
&& rm -f /tmp/requirements.txt
5050

51-
RUN npm install -g \
52-
prettier@3.6.2 \
53-
v8r@5.1.0
51+
COPY package.json /tmp/package.json
52+
53+
RUN jq -r '.dependencies | to_entries[] | "\(.key)@\(.value)"' /tmp/package.json \
54+
| xargs -n 1 npm install -g \
55+
&& rm -f /tmp/package.json
5456

5557
RUN mkdir -p /opt/saxon
5658

xml/docker-compose.test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ services:
2424
pandoc --version # pandoc
2525
pip --version # py3-pip
2626
pipx --version # pipx
27-
prettier --version # prettier
27+
npx prettier --version # prettier
2828
python --version # python3
2929
remarshal --version # remarshal
30+
npx v8r --version # v8r
3031
xmlindent -v # xmlindent
3132
xmllint --version # libxml2-utils
3233
xmlsec1 --version # xmlsec

xml/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "docker-xml",
3+
"version": "1.0.0",
4+
"description": "XML processing tools",
5+
"dependencies": {
6+
"prettier": "3.6.2",
7+
"v8r": "5.1.0"
8+
}
9+
}

0 commit comments

Comments
 (0)