Skip to content

Commit 45f1b5b

Browse files
committed
Switch to pnpm
VS Code recently switched to pnpm so various scripts needed to be updated, and we might as well follow suite with code-server's own dependencies.
1 parent e697a41 commit 45f1b5b

28 files changed

Lines changed: 8104 additions & 11918 deletions

‎.github/workflows/build.yaml‎

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@ jobs:
5858
runs-on: ubuntu-22.04
5959
steps:
6060
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
61+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
6162
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
6263
with:
6364
node-version-file: .node-version
64-
cache: npm
65+
cache: pnpm
6566
cache-dependency-path: |
6667
package-lock.json
6768
test/package-lock.json
68-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
69-
- run: npx prettier --check .
69+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
70+
- run: pnpm exec prettier --check .
7071

7172
doctoc:
7273
name: Doctoc markdown files
@@ -75,15 +76,16 @@ jobs:
7576
if: needs.changes.outputs.docs == 'true'
7677
steps:
7778
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
79+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
7880
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
7981
with:
8082
node-version-file: .node-version
81-
cache: npm
83+
cache: pnpm
8284
cache-dependency-path: |
8385
package-lock.json
8486
test/package-lock.json
85-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
86-
- run: npm run doctoc
87+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
88+
- run: pnpm run doctoc
8789

8890
lint-helm:
8991
name: Lint Helm chart
@@ -109,15 +111,16 @@ jobs:
109111
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.ci == 'true' || needs.changes.outputs.npm == 'true'
110112
steps:
111113
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
114+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
112115
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
113116
with:
114117
node-version-file: .node-version
115-
cache: npm
118+
cache: pnpm
116119
cache-dependency-path: |
117120
package-lock.json
118121
test/package-lock.json
119-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
120-
- run: npm run lint:ts
122+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
123+
- run: pnpm run lint:ts
121124

122125
lint-actions:
123126
name: Lint GitHub Actions
@@ -140,15 +143,16 @@ jobs:
140143
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.npm == 'true'
141144
steps:
142145
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
146+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
143147
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
144148
with:
145149
node-version-file: .node-version
146-
cache: npm
150+
cache: pnpm
147151
cache-dependency-path: |
148152
package-lock.json
149153
test/package-lock.json
150-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
151-
- run: npm run test:unit
154+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
155+
- run: pnpm run test:unit
152156

153157
build:
154158
name: linux-x64
@@ -173,10 +177,11 @@ jobs:
173177
with:
174178
submodules: true
175179
- run: quilt push -a
180+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
176181
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
177182
with:
178183
node-version-file: .node-version
179-
cache: npm
184+
cache: pnpm
180185
cache-dependency-path: |
181186
package-lock.json
182187
test/package-lock.json
@@ -200,22 +205,22 @@ jobs:
200205
if: steps.cache-vscode.outputs.cache-hit != 'true'
201206
run: |
202207
cd lib/vscode/build
203-
npm ci
208+
pnpm install --frozen-lockfile
204209
cd ..
205210
source ./build/azure-pipelines/linux/setup-env.sh
206211
# Run preinstall script before root dependencies are installed
207212
# so that v8 headers are patched correctly for native modules.
208-
node build/npm/preinstall.ts
209-
npm ci
213+
pnpm run preinstall
214+
pnpm install --frozen-lockfile
210215
cd ../..
211-
npm run build:vscode
216+
pnpm run build:vscode
212217
213218
# Build the code-server wrapper.
214-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
215-
- run: npm run build
219+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
220+
- run: pnpm run build
216221

217222
# Push up an artifact containing the linux-x64 release.
218-
- run: KEEP_MODULES=1 npm run release
223+
- run: KEEP_MODULES=1 pnpm run release
219224
- run: tar -czf package.tar.gz release
220225
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
221226
with:
@@ -232,14 +237,15 @@ jobs:
232237

233238
steps:
234239
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
240+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
235241
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
236242
with:
237243
node-version-file: .node-version
238-
cache: npm
244+
cache: pnpm
239245
cache-dependency-path: |
240246
package-lock.json
241247
test/package-lock.json
242-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
248+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
243249
- name: Install Playwright OS dependencies
244250
run: |
245251
./test/node_modules/.bin/playwright install-deps
@@ -250,7 +256,7 @@ jobs:
250256
name: linux-x64-package
251257
- run: tar -xzf package.tar.gz
252258

253-
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e
259+
- run: CODE_SERVER_TEST_ENTRY=./release pnpm run test:e2e
254260
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
255261
if: always()
256262
with:
@@ -282,14 +288,15 @@ jobs:
282288
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
283289
284290
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
291+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
285292
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
286293
with:
287294
node-version-file: .node-version
288-
cache: npm
295+
cache: pnpm
289296
cache-dependency-path: |
290297
package-lock.json
291298
test/package-lock.json
292-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
299+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
293300
- name: Install Playwright OS dependencies
294301
run: |
295302
./test/node_modules/.bin/playwright install-deps
@@ -301,7 +308,7 @@ jobs:
301308
- run: tar -xzf package.tar.gz
302309

303310
- run: ~/.cache/caddy/caddy start --config ./ci/Caddyfile
304-
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e:proxy
311+
- run: CODE_SERVER_TEST_ENTRY=./release pnpm run test:e2e:proxy
305312
- run: ~/.cache/caddy/caddy stop --config ./ci/Caddyfile
306313
if: always()
307314
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7

‎.github/workflows/publish.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
- run: tar -xzf release-npm-package/package.tar.gz
9898
- run: |
9999
pushd release
100-
npm publish --tag latest --access public
100+
pnpm publish --tag latest --access public
101101
102102
aur:
103103
runs-on: ubuntu-latest
@@ -233,7 +233,7 @@ jobs:
233233
fileName: "*.rpm"
234234
out-file-path: "release-packages"
235235

236-
- run: npm run publish:docker
236+
- run: pnpm run publish:docker
237237

238238
repo:
239239
runs-on: ubuntu-latest

‎.github/workflows/release.yaml‎

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ jobs:
134134
VSCODE_ARCH: ${{ matrix.vscode_arch }}
135135
npm_config_arch: ${{ matrix.npm_arch }}
136136
# Ensure native modules are built from source to avoid prebuilds and use
137-
# the correct version of glibc.
137+
# the correct version of glibc. Although we use pnpm, this npm flag
138+
# appears to still work for argon2, and VS Code has its own configuration
139+
# for building from source.
138140
npm_config_build_from_source: true
139141
# Gulp target name.
140142
# TODO: Pull from VSCODE_ARCH instead.
@@ -161,38 +163,39 @@ jobs:
161163
# A merged update/ PR starts a release through pull_request_target.
162164
allow-unsafe-pr-checkout: true
163165
- run: quilt push -a
166+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
164167
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
165168
with:
166169
node-version-file: .node-version
167-
cache: npm
170+
cache: pnpm
168171
cache-dependency-path: |
169172
package-lock.json
170173
test/package-lock.json
171174
172175
- name: Build
173176
run: |
174177
cd lib/vscode/build
175-
npm ci
178+
pnpm install --frozen-lockfile
176179
cd ..
177180
source ./build/azure-pipelines/linux/setup-env.sh
178181
# Run preinstall script before root dependencies are installed
179182
# so that v8 headers are patched correctly for native modules.
180-
node build/npm/preinstall.ts
183+
pnpm run preinstall
181184
cd ../..
182-
npm ci
183-
npm run build
184-
npm run build:vscode
185+
pnpm install --frozen-lockfile
186+
pnpm run build
187+
pnpm run build:vscode
185188
186189
# Platform-agnostic NPM package.
187-
- run: npm run release
190+
- run: pnpm run release
188191
if: ${{ matrix.vscode_arch == 'x64' }}
189192
# Into release-packages with the platform packages, so the artifact is one flat directory.
190193
- run: mkdir -p release-packages && tar -czf release-packages/package.tar.gz release
191194
if: ${{ matrix.vscode_arch == 'x64' }}
192195

193196
# Platform-specific release.
194-
- run: KEEP_MODULES=1 npm run release
195-
- run: npm run package
197+
- run: KEEP_MODULES=1 pnpm run release
198+
- run: pnpm run package
196199

197200
# The approve job and publish.yaml check every file against these.
198201
- uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
@@ -224,6 +227,8 @@ jobs:
224227
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225228
VERSION: ${{ needs.prepare.outputs.version }}
226229
# Ensure native modules are built from source to avoid prebuilds.
230+
# Although we use pnpm, this npm flag appears to still work for argon2,
231+
# and VS Code has its own configuration for building from source.
227232
npm_config_build_from_source: true
228233

229234
steps:
@@ -247,21 +252,22 @@ jobs:
247252
# A merged update/ PR starts a release through pull_request_target.
248253
allow-unsafe-pr-checkout: true
249254
- run: quilt push -a
255+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
250256
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
251257
with:
252258
node-version-file: .node-version
253-
cache: npm
259+
cache: pnpm
254260
cache-dependency-path: |
255261
package-lock.json
256262
test/package-lock.json
257263
258-
- run: npm ci
259-
- run: npm run build
260-
- run: npm run build:vscode
261-
- run: KEEP_MODULES=1 npm run release
262-
- run: npm run test:native
264+
- run: pnpm install --frozen-lockfile
265+
- run: pnpm run build
266+
- run: pnpm run build:vscode
267+
- run: KEEP_MODULES=1 pnpm run release
268+
- run: pnpm run test:native
263269

264-
- run: npm run package
270+
- run: pnpm run package
265271

266272
# The approve job and publish.yaml check every file against these.
267273
- uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
@@ -291,6 +297,8 @@ jobs:
291297
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
292298
VERSION: ${{ needs.prepare.outputs.version }}
293299
# Ensure native modules are built from source to avoid prebuilds.
300+
# Although we use pnpm, this npm flag appears to still work for argon2,
301+
# and VS Code has its own configuration for building from source.
294302
npm_config_build_from_source: true
295303
OS: windows
296304

@@ -320,20 +328,21 @@ jobs:
320328
git apply --whitespace=nowarn "patches/$patch"
321329
done < patches/series
322330
331+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
323332
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
324333
with:
325334
node-version-file: .node-version
326-
cache: npm
335+
cache: pnpm
327336
cache-dependency-path: |
328337
package-lock.json
329338
test/package-lock.json
330339
331-
# npm hands every script it runs to cmd, which cannot run the shell
340+
# pnpm hands every script it runs to cmd, which cannot run the shell
332341
# scripts this repository is built out of. Point it at the same bash
333342
# the steps here use rather than at a path, which moves between
334343
# images.
335-
- name: Let npm run shell scripts
336-
run: echo "npm_config_script_shell=$(cygpath -w "$(command -v bash)")" >> $GITHUB_ENV
344+
- name: Let pnpm run shell scripts
345+
run: echo "pnpm_config_script_shell=$(cygpath -w "$(command -v bash)")" >> $GITHUB_ENV
337346

338347
# The build merges json by handing jq a process substitution, which
339348
# bash presents as a file under /dev/fd. The jq on this image is a
@@ -381,10 +390,10 @@ jobs:
381390
run: C:\msys64\usr\bin\pacman -Sy --noconfirm --needed rsync
382391

383392
# Only rsync crosses over. Putting msys2's /usr/bin in front instead
384-
# breaks the release step: npm on the path is a shell script whose
393+
# breaks the release step: pnpm on the path is a shell script whose
385394
# shebang reads /usr/bin/env bash, so with msys2 first it is msys2's
386395
# bash that runs it, and crossing into a second msys runtime does not
387-
# carry the environment. npm then sees no script-shell and falls back
396+
# carry the environment. pnpm then sees no script-shell and falls back
388397
# to cmd, which cannot run ./ci/build/build-release.sh, and
389398
# KEEP_MODULES is dropped on the way. A forwarder avoids the whole
390399
# class: rsync is a native exe that loads its runtime from beside
@@ -397,10 +406,10 @@ jobs:
397406
SHIM
398407
chmod +x "$RUNNER_TEMP/shim/rsync"
399408
400-
- run: npm ci
401-
- run: npm run build
402-
- run: npm run build:vscode
403-
- run: KEEP_MODULES=1 npm run release
409+
- run: pnpm install --frozen-lockfile
410+
- run: pnpm run build
411+
- run: pnpm run build:vscode
412+
- run: KEEP_MODULES=1 pnpm run release
404413

405414
# Of the two tars on this image it is git bash's GNU one that can
406415
# rename the tree's top directory as it archives; the windows bsdtar
@@ -412,7 +421,7 @@ jobs:
412421
*GNU*) ;;
413422
*) echo "expected GNU tar for --transform, got $(tar --version | head -1)" >&2; exit 1 ;;
414423
esac
415-
npm run package
424+
pnpm run package
416425
417426
# The approve job and publish.yaml check every file against these.
418427
- uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2

‎.github/workflows/security.yaml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ jobs:
2929
with:
3030
fetch-depth: 0
3131

32-
- name: Install Node.js
33-
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
32+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6
33+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
3434
with:
3535
node-version-file: .node-version
3636

37-
- name: Audit npm for vulnerabilities
38-
run: npm audit
37+
- run: pnpm audit
3938
if: success()
4039

4140
trivy-scan-repo:

‎.prettierignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ test/scripts
66
test/e2e/extensions/test-extension
77
.pc
88
package-lock.json
9+
pnpm-lock.yaml

0 commit comments

Comments
 (0)