Skip to content

Commit 50ad641

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 9014bf9 commit 50ad641

20 files changed

Lines changed: 4507 additions & 6933 deletions

‎.github/workflows/build.yaml‎

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ jobs:
6161
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
6262
with:
6363
node-version-file: .node-version
64-
cache: npm
64+
cache: pnpm
6565
cache-dependency-path: |
6666
package-lock.json
6767
test/package-lock.json
68-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
69-
- run: npx prettier --check .
68+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
69+
- run: pnpm run prettier --check .
7070

7171
doctoc:
7272
name: Doctoc markdown files
@@ -78,12 +78,12 @@ jobs:
7878
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
7979
with:
8080
node-version-file: .node-version
81-
cache: npm
81+
cache: pnpm
8282
cache-dependency-path: |
8383
package-lock.json
8484
test/package-lock.json
85-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
86-
- run: npm run doctoc
85+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
86+
- run: pnpm run doctoc
8787

8888
lint-helm:
8989
name: Lint Helm chart
@@ -112,12 +112,12 @@ jobs:
112112
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
113113
with:
114114
node-version-file: .node-version
115-
cache: npm
115+
cache: pnpm
116116
cache-dependency-path: |
117117
package-lock.json
118118
test/package-lock.json
119-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
120-
- run: npm run lint:ts
119+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
120+
- run: pnpm run lint:ts
121121

122122
lint-actions:
123123
name: Lint GitHub Actions
@@ -143,12 +143,12 @@ jobs:
143143
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
144144
with:
145145
node-version-file: .node-version
146-
cache: npm
146+
cache: pnpm
147147
cache-dependency-path: |
148148
package-lock.json
149149
test/package-lock.json
150-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
151-
- run: npm run test:unit
150+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
151+
- run: pnpm run test:unit
152152
- uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
153153
if: success()
154154
with:
@@ -181,7 +181,7 @@ jobs:
181181
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
182182
with:
183183
node-version-file: .node-version
184-
cache: npm
184+
cache: pnpm
185185
cache-dependency-path: |
186186
package-lock.json
187187
test/package-lock.json
@@ -205,22 +205,22 @@ jobs:
205205
if: steps.cache-vscode.outputs.cache-hit != 'true'
206206
run: |
207207
cd lib/vscode/build
208-
npm ci
208+
pnpm install --frozen-lockfile
209209
cd ..
210210
source ./build/azure-pipelines/linux/setup-env.sh
211211
# Run preinstall script before root dependencies are installed
212212
# so that v8 headers are patched correctly for native modules.
213-
node build/npm/preinstall.ts
214-
npm ci
213+
pnpm run preinstall
214+
pnpm install --frozen-lockfile
215215
cd ../..
216-
npm run build:vscode
216+
pnpm run build:vscode
217217
218218
# Build the code-server wrapper.
219-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
220-
- run: npm run build
219+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
220+
- run: pnpm run build
221221

222222
# Push up an artifact containing the linux-x64 release.
223-
- run: KEEP_MODULES=1 npm run release
223+
- run: KEEP_MODULES=1 pnpm run release
224224
- run: tar -czf package.tar.gz release
225225
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
226226
with:
@@ -240,11 +240,11 @@ jobs:
240240
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
241241
with:
242242
node-version-file: .node-version
243-
cache: npm
243+
cache: pnpm
244244
cache-dependency-path: |
245245
package-lock.json
246246
test/package-lock.json
247-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
247+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
248248
- name: Install Playwright OS dependencies
249249
run: |
250250
./test/node_modules/.bin/playwright install-deps
@@ -255,7 +255,7 @@ jobs:
255255
name: linux-x64-package
256256
- run: tar -xzf package.tar.gz
257257

258-
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e
258+
- run: CODE_SERVER_TEST_ENTRY=./release pnpm run test:e2e
259259
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
260260
if: always()
261261
with:
@@ -290,11 +290,11 @@ jobs:
290290
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
291291
with:
292292
node-version-file: .node-version
293-
cache: npm
293+
cache: pnpm
294294
cache-dependency-path: |
295295
package-lock.json
296296
test/package-lock.json
297-
- run: SKIP_SUBMODULE_DEPS=1 npm ci
297+
- run: SKIP_SUBMODULE_DEPS=1 pnpm install --frozen-lockfile
298298
- name: Install Playwright OS dependencies
299299
run: |
300300
./test/node_modules/.bin/playwright install-deps
@@ -306,7 +306,7 @@ jobs:
306306
- run: tar -xzf package.tar.gz
307307

308308
- run: ~/.cache/caddy/caddy start --config ./ci/Caddyfile
309-
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e:proxy
309+
- run: CODE_SERVER_TEST_ENTRY=./release pnpm run test:e2e:proxy
310310
- run: ~/.cache/caddy/caddy stop --config ./ci/Caddyfile
311311
if: always()
312312
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7

‎.github/workflows/release.yaml‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,24 @@ jobs:
8585
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
8686
with:
8787
node-version-file: .node-version
88-
cache: npm
88+
cache: pnpm
8989
cache-dependency-path: |
9090
package-lock.json
9191
test/package-lock.json
9292
9393
- name: Build
9494
run: |
9595
cd lib/vscode/build
96-
npm ci
96+
pnpm install --frozen-lockfile
9797
cd ..
9898
source ./build/azure-pipelines/linux/setup-env.sh
9999
# Run preinstall script before root dependencies are installed
100100
# so that v8 headers are patched correctly for native modules.
101101
node build/npm/preinstall.ts
102102
cd ../..
103-
npm ci
104-
npm run build
105-
npm run build:vscode
103+
pnpm install --frozen-lockfile
104+
pnpm run build
105+
pnpm run build:vscode
106106
107107
# Platform-agnostic NPM package.
108108
- run: npm run release
@@ -180,18 +180,18 @@ jobs:
180180
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
181181
with:
182182
node-version-file: .node-version
183-
cache: npm
183+
cache: pnpm
184184
cache-dependency-path: |
185185
package-lock.json
186186
test/package-lock.json
187187
188-
- run: npm ci
189-
- run: npm run build
190-
- run: npm run build:vscode
191-
- run: KEEP_MODULES=1 npm run release
192-
- run: npm run test:native
188+
- run: pnpm install --frozen-lockfile
189+
- run: pnpm run build
190+
- run: pnpm run build:vscode
191+
- run: KEEP_MODULES=1 pnpm run release
192+
- run: pnpm run test:native
193193

194-
- run: npm run package
194+
- run: pnpm run package
195195
- uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
196196
with:
197197
draft: true
@@ -252,7 +252,7 @@ jobs:
252252
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
253253
with:
254254
node-version-file: .node-version
255-
cache: npm
255+
cache: pnpm
256256
cache-dependency-path: |
257257
package-lock.json
258258
test/package-lock.json
@@ -326,10 +326,10 @@ jobs:
326326
SHIM
327327
chmod +x "$RUNNER_TEMP/shim/rsync"
328328
329-
- run: npm ci
330-
- run: npm run build
331-
- run: npm run build:vscode
332-
- run: KEEP_MODULES=1 npm run release
329+
- run: pnpm install --frozen-lockfile
330+
- run: pnpm run build
331+
- run: pnpm run build:vscode
332+
- run: KEEP_MODULES=1 pnpm run release
333333

334334
# Of the two tars on this image it is git bash's GNU one that can
335335
# rename the tree's top directory as it archives; the windows bsdtar

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ Code v1.146.0
2727
### Changed
2828

2929
- Update to Code 1.146.0
30+
- For anyone building code-server, note that we switched to pnpm to match
31+
upstream VS Code. npm is no longer supported for building from source, though
32+
it can still be used to install code-server from the npm repositories (pnpm
33+
and yarn can also be used).
3034

3135
### Added
3236

‎ci/build/build-release.sh‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ EOF
9999
rsync "${rsync_opts[@]}" node_modules/ "$RELEASE_PATH/node_modules"
100100
# Remove dev dependencies.
101101
pushd "$RELEASE_PATH"
102-
npm prune --production
102+
pnpm prune --production
103103
popd
104104
fi
105105

@@ -171,19 +171,25 @@ create_shrinkwraps() {
171171
# We first generate the shrinkwrap file for code-server itself - which is the
172172
# current directory.
173173
cp package-lock.json package-lock.json.temp
174-
npm shrinkwrap
174+
# TODO@npm: how??
175+
# npm shrinkwrap
176+
touch npm-shrinkwrap.json
175177
mv package-lock.json.temp package-lock.json
176178

177179
# Then the shrinkwrap files for the bundled VS Code.
178180
pushd "$VSCODE_SRC_PATH/remote/"
179181
cp package-lock.json package-lock.json.temp
180-
npm shrinkwrap
182+
# npm shrinkwrap
183+
# TODO@npm: how??
184+
touch npm-shrinkwrap.json
181185
mv package-lock.json.temp package-lock.json
182186
popd
183187

184188
pushd "$VSCODE_SRC_PATH/extensions/"
185189
cp package-lock.json package-lock.json.temp
186-
npm shrinkwrap
190+
# npm shrinkwrap
191+
# TODO@npm: how??
192+
touch npm-shrinkwrap.json
187193
mv package-lock.json.temp package-lock.json
188194
popd
189195
}

‎ci/build/build-vscode.sh‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ main() {
5454

5555
if [[ ! ${VERSION-} ]]; then
5656
echo "VERSION not set. Please set before running this script:"
57-
echo "VERSION='0.0.0' npm run build:vscode"
57+
echo "VERSION='0.0.0' pnpm run build:vscode"
5858
exit 1
5959
fi
6060

@@ -119,10 +119,10 @@ EOF
119119
) > product.json
120120

121121

122-
VSCODE_QUALITY=stable npm run gulp compile-copilot-extension-full-build
122+
VSCODE_QUALITY=stable pnpm run gulp compile-copilot-extension-full-build
123123

124-
npm run gulp core-ci
125-
npm run gulp "vscode-reh-web-$VSCODE_TARGET${MINIFY:+-min}-ci"
124+
pnpm run gulp core-ci
125+
pnpm run gulp "vscode-reh-web-$VSCODE_TARGET${MINIFY:+-min}-ci"
126126

127127
# Reset so if you develop after building you will not be stuck with the wrong
128128
# commit (the dev client will use `oss-dev` but the dev server will still use

‎ci/dev/doctoc.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ main() {
1818
echo "Files need generation or are formatted incorrectly:"
1919
git -c color.ui=always status | grep --color=no '\[31m'
2020
echo "Please run the following locally:"
21-
echo " npm run doctoc"
21+
echo " pnpm run doctoc"
2222
exit 1
2323
fi
2424
}

‎ci/dev/postinstall.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ install-deps() {
99
else
1010
args+=(install)
1111
fi
12-
# If there is no package.json then npm will look upward and end up installing
12+
# If there is no package.json then pnpm will look upward and end up installing
1313
# from the root resulting in an infinite loop (this can happen if you have not
1414
# checked out the submodule yet for example).
1515
if [[ ! -f "$1/package.json" ]]; then
@@ -18,7 +18,7 @@ install-deps() {
1818
fi
1919
pushd "$1"
2020
echo "Installing dependencies for $PWD"
21-
npm "${args[@]}"
21+
pnpm "${args[@]}"
2222
popd
2323
}
2424

‎ci/dev/preinstall.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
if (process.env.npm_execpath.includes("yarn")) {
2-
throw new Error("`yarn` is no longer supported; please use `npm install` instead")
1+
if (!/^pnpm\/(\d+)\.(\d+)\.(\d+)/.exec(process.env.npm_config_user_agent)) {
2+
throw new Error("`yarn` and `npm` are no longer supported; please use `pnpm install` instead")
33
}

‎ci/dev/test-e2e.sh‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
set -euo pipefail
33

44
help() {
5-
echo >&2 " You can build with 'npm run watch' or you can build a release"
6-
echo >&2 " For example: 'npm run build && npm run build:vscode && KEEP_MODULES=1 npm run release'"
7-
echo >&2 " Then 'CODE_SERVER_TEST_ENTRY=./release npm run test:e2e'"
5+
echo >&2 " You can build with 'pnpm run watch' or you can build a release"
6+
echo >&2 " For example: 'pnpm run build && pnpm run build:vscode && KEEP_MODULES=1 pnpm run release'"
7+
echo >&2 " Then 'CODE_SERVER_TEST_ENTRY=./release pnpm run test:e2e'"
88
echo >&2 " You can manually run that release with 'node ./release'"
99
}
1010

@@ -15,7 +15,7 @@ main() {
1515

1616
pushd test/e2e/extensions/test-extension
1717
echo "Building test extension"
18-
npm run build
18+
pnpm run build
1919
popd
2020

2121
local dir="$PWD"

‎ci/dev/test-integration.sh‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
set -euo pipefail
33

44
help() {
5-
echo >&2 " You can build the release with 'KEEP_MODULES=1 npm run release'"
5+
echo >&2 " You can build the release with 'KEEP_MODULES=1 pnpm run release'"
66
echo >&2 " Or you can pass in a custom path."
7-
echo >&2 " CODE_SERVER_PATH='/var/tmp/coder/code-server/bin/code-server' npm run test:integration"
7+
echo >&2 " CODE_SERVER_PATH='/var/tmp/coder/code-server/bin/code-server' pnpm run test:integration"
88
}
99

1010
# Make sure a code-server release works. You can pass in the path otherwise it
@@ -33,7 +33,10 @@ main() {
3333
exit 1
3434
fi
3535

36-
CODE_SERVER_PATH="$path" ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration" --testPathIgnorePatterns "./test/integration/fixtures"
36+
CODE_SERVER_PATH="$path" ./test/node_modules/.bin/jest "$@" \
37+
--coverage=false \
38+
--testRegex "./test/integration" \
39+
--testPathIgnorePatterns "./test/integration/fixtures"
3740
}
3841

3942
main "$@"

0 commit comments

Comments
 (0)