Skip to content

Commit 914dea2

Browse files
committed
feat(npx): switch from npm to npx to isolate dependencies
1 parent f82d154 commit 914dea2

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ updates:
1515
default-days: 7
1616
commit-message:
1717
prefix: build(deps)
18+
- package-ecosystem: "npm"
19+
directory: "/yaml"
20+
schedule:
21+
interval: "daily"
22+
cooldown:
23+
default-days: 7
24+
commit-message:
25+
prefix: build(deps)
1826
- package-ecosystem: "github-actions"
1927
directory: "/"
2028
schedule:

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ popular formats like:
6767
- Java .properties files (e.g. yq)
6868
- Microsoft Windows INI files (e.g. yq)
6969

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

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

yaml/Dockerfile

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

37-
RUN npm install -g \
38-
prettier@3.6.2 \
39-
v8r@5.1.0
37+
COPY package.json /tmp/package.json
38+
39+
RUN jq -r '.dependencies | to_entries[] | "\(.key)@\(.value)"' /tmp/package.json \
40+
| xargs -n 1 npm install -g \
41+
&& rm -f /tmp/package.json
4042

4143
RUN adduser \
4244
--home "${USER_HOME}" \

yaml/docker-compose.test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ services:
2121
jq --version # jq
2222
pip --version # py3-pip
2323
pipx --version # pipx
24-
prettier --version # prettier
24+
npx prettier --version # prettier
2525
python --version # python3
2626
remarshal --version # remarshal
27-
v8r --version # v8r
27+
npx v8r --version # v8r
2828
yaml-paths --version # yamlpath
2929
yamllint --version # yamllint
3030
yq --version # yq-go

yaml/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dependencies": {
3+
"prettier": "3.6.2",
4+
"v8r": "5.1.0"
5+
}
6+
}

0 commit comments

Comments
 (0)