Skip to content

Commit 17d66e8

Browse files
committed
feat(npx): switch from npm to npx to isolate dependencies
1 parent a89f233 commit 17d66e8

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
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: "/md"
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
@@ -50,6 +50,12 @@ In PowerShell:
5050
docker run --rm -t --net=none -v "${PWD}:/tmp" leplusorg/md pandoc -o output.html intput.md
5151
```
5252

53+
## NPM Packages
54+
55+
Use the `npx` command to run command-line tools coming from npm
56+
packages. This ensures isolation between the different packages
57+
(including potentially conflicting dependencies).
58+
5359
## Software Bill of Materials (SBOM)
5460

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

md/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ RUN pipx ensurepath --global \
3838
&& xargs -a /tmp/requirements.txt -n 1 pipx install --global \
3939
&& rm -f /tmp/requirements.txt
4040

41-
RUN npm install -g \
42-
41+
COPY package.json /tmp/package.json
42+
43+
RUN jq -r '.dependencies | to_entries[] | "\(.key)@\(.value)"' /tmp/package.json \
44+
| xargs -n 1 npm install -g \
45+
&& rm -f /tmp/package.json
4346

4447
RUN adduser \
4548
--home "${USER_HOME}" \

md/docker-compose.test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
markdown --version # markdown
2020
mdformat --version # mdformat
2121
pandoc --version # pandoc
22+
npx prettier --version # prettier
2223
pip --version # py3-pip
2324
python --version # python3
2425
'

md/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "docker-md",
3+
"version": "0.0.0",
4+
"dependencies": {
5+
"prettier": "3.6.2"
6+
}
7+
}

0 commit comments

Comments
 (0)