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..cedea17c23f7 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" + 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" -} - -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 ;;