Skip to content

Commit 66fd26f

Browse files
Migrate from npm CLI to pnpm (#1211)
* Migrate npm/javy package from npm CLI to pnpm Improve supply-chain security for the javy npm package by switching its install/build/publish flow to pnpm. pnpm refuses to execute install scripts from transitive dependencies by default, uses a content-addressed store that detects tampered tarballs, and enforces strict dependency isolation. Pins pnpm 10.28.0 via the packageManager field so local dev and CI run the same version. Replaces package-lock.json with pnpm-lock.yaml. CI workflows install pnpm via pnpm/action-setup, pointed at npm/javy's package.json for the version. Tracks #1210. * Migrate wpt harness from npm CLI to pnpm Apply the same supply-chain hardening to the Web Platform Tests harness so contributors and CI don't need the npm CLI to run WPT. Updates the Makefile test-wpt-ci target and the WPT step in ci.yml to use pnpm, switches the inner test script to pnpm run, and pins pnpm 10.28.0 via the packageManager field. Tracks #1210.
1 parent 960d6cf commit 66fd26f

12 files changed

Lines changed: 1396 additions & 4820 deletions

File tree

.github/workflows/ci-npm-javy.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ jobs:
2828
tar xvf /tmp/wasmtime.tar.xz --strip-components=1 -C /tmp/wasmtime
2929
echo "/tmp/wasmtime" >> $GITHUB_PATH
3030
31-
- run: npm install
31+
- uses: pnpm/action-setup@v4
32+
with:
33+
package_json_file: npm/javy/package.json
34+
35+
- run: pnpm install
3236
working-directory: npm/javy
3337

34-
- run: npm test
38+
- run: pnpm test
3539
working-directory: npm/javy

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ jobs:
6868
- name: Test
6969
run: make test-native-targets-ci
7070

71+
- uses: pnpm/action-setup@v4
72+
with:
73+
package_json_file: wpt/package.json
74+
7175
- name: WPT
7276
run: |
73-
npm install --prefix wpt
74-
npm test --prefix wpt
77+
pnpm -C wpt install
78+
pnpm -C wpt test

.github/workflows/publish-npm.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,28 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v6
1414

15+
- uses: pnpm/action-setup@v4
16+
with:
17+
package_json_file: npm/javy/package.json
18+
1519
- uses: actions/setup-node@v6
1620
with:
1721
registry-url: "https://registry.npmjs.org"
1822

1923
- name: Install package dependencies
20-
run: npm install
24+
run: pnpm install
2125
working-directory: npm/javy
2226

2327
- name: Build NPM package
24-
run: npm run build
28+
run: pnpm run build
2529
working-directory: npm/javy
2630

2731
- name: Publish NPM package if new version
2832
run: |
29-
if [[ $(cat package.json | jq -r .version) == $(npm view javy version) ]]; then
33+
if [[ $(cat package.json | jq -r .version) == $(pnpm view javy version) ]]; then
3034
echo "Skipping publish because the version is already published"
3135
else
32-
npm publish
36+
pnpm publish --no-git-checks
3337
fi
3438
working-directory: npm/javy
3539
env:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ native-targets: lint-native-targets test-native-targets
9393

9494
# For usage in CI, in which we assume pre-existing assets.
9595
test-wpt-ci:
96-
npm install --prefix wpt
97-
npm test --prefix wpt
96+
pnpm -C wpt install
97+
pnpm -C wpt test
9898

9999
test-wpt: cli test-wpt-ci
100100

npm/javy/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ writeFileSync(STDIO.Stderr, textEncoder.encode(stderrContent));
3535

3636
## Tests
3737

38-
To run the tests, run `npm test`. It requires you to have a release build of `javy` and have `wasmtime` installed.
38+
To run the tests, run `pnpm test`. It requires you to have a release build of `javy` and have `wasmtime` installed.
3939

4040
## Publishing
4141

42-
Run `npm run build` before running `npm publish`.
42+
Run `pnpm run build` before running `pnpm publish`.

0 commit comments

Comments
 (0)