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.
This commit is contained in:
Asher committed 2026-11-19 00:18:33 -09:00
1 parent e7ff0c41be
commit 58d66fd4bd
3 files changed
+11 -41

No files matched your search

+4
View File
@@ -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
+6 -40
View File
@@ -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 "$@"
+1 -1
View File
@@ -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
;;