tools: fix race condition when npm installing

The update scripts that install dependencies from npm blindly assume
that `npm install` will always install the version that was previously
fetched as `dist-tags.latest`. That is not necessarily true, so instead
always install the specific version that the script thinks is current.

PR-URL: https://github.com/nodejs/node/pull/48101
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
Tobias Nießen authored and GitHub committed 2023-05-23 09:45:56 +00:00
1 parent 92a938b4dd
commit 300f68e9d0
7 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ rm -rf deps/acorn/acorn-walk
"$NODE" "$NPM" init --yes
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn-walk
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "acorn-walk@$NEW_VERSION"
)
mv acorn-walk-tmp/node_modules/acorn-walk deps/acorn
+1 -1
View File
@@ -33,7 +33,7 @@ rm -rf deps/acorn/acorn
"$NODE" "$NPM" init --yes
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "acorn@$NEW_VERSION"
cd node_modules/acorn
# update this version information in src/acorn_version.h
FILE_PATH="$ROOT/src/acorn_version.h"
@@ -44,7 +44,7 @@ cd "$WORKSPACE"
"$NODE" "$NPM" init --yes
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts cjs-module-lexer
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "cjs-module-lexer@$NEW_VERSION"
rm -rf "$DEPS_DIR/cjs-module-lexer"
+1 -1
View File
@@ -36,7 +36,7 @@ rm -rf ../node_modules/eslint
--ignore-scripts \
--install-strategy=shallow \
--no-bin-links \
eslint
"eslint@$NEW_VERSION"
# Uninstall plugins that we want to install so that they are removed from
# devDependencies. Otherwise --omit=dev will cause them to be skipped.
(
+1 -1
View File
@@ -34,7 +34,7 @@ rm -rf deps/minimatch/index.js
"$NODE" "$NPM" init --yes
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts minimatch
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "minimatch@$NEW_VERSION"
cd node_modules/minimatch
"$NODE" "$NPM" exec --package=esbuild@0.17.15 --yes -- esbuild ./dist/cjs/index.js --bundle --platform=node --outfile=minimatch.js
)
+1 -1
View File
@@ -29,7 +29,7 @@ cd test/fixtures/postject-copy || exit
"$NODE" "$NPM" init --yes
"$NODE" "$NPM" install --no-bin-links --ignore-scripts postject
"$NODE" "$NPM" install --no-bin-links --ignore-scripts "postject@$NEW_VERSION"
# TODO(RaisinTen): Replace following with $WORKSPACE
cd ../../..
+1 -1
View File
@@ -33,7 +33,7 @@ rm -f deps/undici/undici.js
"$NODE" "$NPM" init --yes
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts undici
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "undici@$NEW_VERSION"
cd node_modules/undici
"$NODE" "$NPM" run build:node
# update this version information in src/undici_version.h