Skip to content

Commit 6eff819

Browse files
authored
feat(npx): switch from npm to npx to isolate dependencies (#17)
1 parent a89f233 commit 6eff819

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ RUN apk upgrade --no-cache \
2323
curl=8.14.1-r2 \
2424
git=2.49.1-r0 \
2525
go-md2man=2.0.7-r4 \
26+
jq=1.8.0-r0 \
2627
markdown=1.0.1-r3 \
2728
npm=11.3.0-r1 \
2829
pandoc-cli=3.6.4-r0 \
@@ -38,8 +39,11 @@ RUN pipx ensurepath --global \
3839
&& xargs -a /tmp/requirements.txt -n 1 pipx install --global \
3940
&& rm -f /tmp/requirements.txt
4041

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

4448
RUN adduser \
4549
--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)