From 58d66fd4bdd643221f7a787d8920101fcc073978 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 18 Nov 2026 23:13:01 -0900 Subject: [PATCH 1/2] Stop generating shrinkwraps npm 12 removes support for shrinkwraps. Additionally, VS Code has switched to pnpm and this will make generating the shrinkwraps less straightforward. Exact pins in the package.json would not be a sufficient replacement since that does not cover transitive dependencies. The recommendation for end user packages installed globally with npm seems to be to be to bundle dependencies. One idea would be to build for every platform and bundle them all, but the whole reason we have the npm package is to support platforms for which we are not building. If we build them, we could just add a regular release for that platform on GitHub. So instead for each native module we would need to add rebuild commands in the postinstall. And ideally remove the current platform builds to at least try keeping the tarball size down. I am not sure it is worth the effort for what it feels like fighting with npm, so this change does not attempt that. --- CHANGELOG.md | 4 ++++ ci/build/build-release.sh | 46 +++++-------------------------------- ci/build/npm-postinstall.sh | 2 +- 3 files changed, 11 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9089dbb3e1ab..171167943f30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,10 @@ Code v1.145.3 ### Changed - Update to Code 1.145.3 +- The NPM package no longer ships with shrinkwraps, since shrinkwrap support is + removed in npm v12. Although this makes it easier for end users to get updated + dependencies, it also means users can get dependencies different from known + good versions tested at release. ## [4.145.2](https://github.com/coder/code-server/releases/tag/v4.145.2) - 2026-11-07 diff --git a/ci/build/build-release.sh b/ci/build/build-release.sh index 56ad29050237..da7538e0d8f2 100755 --- a/ci/build/build-release.sh +++ b/ci/build/build-release.sh @@ -6,9 +6,9 @@ if [[ ${RUNNER_DEBUG-} = 1 ]]; then fi # Once both code-server and VS Code have been built, use this script to copy -# them into a single directory (./release), prepare the package.json and -# product.json, and add shrinkwraps. This results in a generic NPM package that -# we can publish to NPM. +# them into a single directory (./release) and prepare the package.json and +# product.json. This results in a generic NPM package that we can publish to +# NPM. # MINIFY controls whether minified VS Code is bundled. It must match the value # used when VS Code was built. @@ -28,8 +28,6 @@ main() { VSCODE_SRC_PATH="lib/vscode" VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode" - create_shrinkwraps - mkdir -p "$RELEASE_PATH" bundle_code_server @@ -85,7 +83,7 @@ bundle_code_server() { } EOF ) > "$RELEASE_PATH/package.json" - mv npm-shrinkwrap.json "$RELEASE_PATH" + cp package-lock.json "$RELEASE_PATH" if [ "$KEEP_MODULES" = 1 ]; then local rsync_opts=(-a) @@ -148,44 +146,12 @@ bundle_vscode() { "$VSCODE_SRC_PATH/remote/package.json" \ "$VSCODE_OUT_PATH/package.json" > "$VSCODE_OUT_PATH/package.json.merged" mv "$VSCODE_OUT_PATH/package.json.merged" "$VSCODE_OUT_PATH/package.json" - cp "$VSCODE_SRC_PATH/remote/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/npm-shrinkwrap.json" + cp "$VSCODE_SRC_PATH/remote/package-lock.json" "$VSCODE_OUT_PATH/package-lock.json" # Include global extension dependencies as well. rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json" - cp "$VSCODE_SRC_PATH/extensions/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/extensions/npm-shrinkwrap.json" rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs" -} - -create_shrinkwraps() { - # package-lock.json files (used to ensure deterministic versions of - # dependencies) are not packaged when publishing to the NPM registry. - # - # To ensure deterministic dependency versions (even when code-server is - # installed with NPM), we create an npm-shrinkwrap.json file from the - # currently installed node_modules. This ensures the versions used from - # development (that the package-lock.json guarantees) are also the ones - # installed by end-users. These will include devDependencies, but those will - # be ignored when installing globally (for code-server), and because we use - # --omit=dev (for VS Code). - - # We first generate the shrinkwrap file for code-server itself - which is the - # current directory. - cp package-lock.json package-lock.json.temp - npm shrinkwrap - mv package-lock.json.temp package-lock.json - - # Then the shrinkwrap files for the bundled VS Code. - pushd "$VSCODE_SRC_PATH/remote/" - cp package-lock.json package-lock.json.temp - npm shrinkwrap - mv package-lock.json.temp package-lock.json - popd - - pushd "$VSCODE_SRC_PATH/extensions/" - cp package-lock.json package-lock.json.temp - npm shrinkwrap - mv package-lock.json.temp package-lock.json - popd + rsync "$VSCODE_SRC_PATH/extensions/package-lock.json" "$VSCODE_OUT_PATH/extensions/package-lock.json" } main "$@" diff --git a/ci/build/npm-postinstall.sh b/ci/build/npm-postinstall.sh index 856f1acfa9eb..3621e1e6125f 100755 --- a/ci/build/npm-postinstall.sh +++ b/ci/build/npm-postinstall.sh @@ -101,7 +101,7 @@ install_with_yarn_or_npm() { fi ;; yarn*) - if ! yarn --production --frozen-lockfile --no-default-rc; then + if ! yarn --production --no-default-rc; then return 1 fi ;; From a9ee5d1b88667cafda97210393918a03318eda20 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 18 Nov 2026 23:13:03 -0900 Subject: [PATCH 2/2] Remove devDependencies from extensions package.json Not strictly necessary since we only install production dependencies in the postinstall, but might as well save some bytes. --- ci/build/build-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build/build-release.sh b/ci/build/build-release.sh index da7538e0d8f2..cedea17c23f7 100755 --- a/ci/build/build-release.sh +++ b/ci/build/build-release.sh @@ -149,7 +149,7 @@ bundle_vscode() { cp "$VSCODE_SRC_PATH/remote/package-lock.json" "$VSCODE_OUT_PATH/package-lock.json" # Include global extension dependencies as well. - rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json" + jq 'del(.devDependencies)' "$VSCODE_SRC_PATH/extensions/package.json" > "$VSCODE_OUT_PATH/extensions/package.json" rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs" rsync "$VSCODE_SRC_PATH/extensions/package-lock.json" "$VSCODE_OUT_PATH/extensions/package-lock.json" }