Skip to content

Commit 300f68e

Browse files
authored
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: #48101 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent 92a938b commit 300f68e

7 files changed

+7
-7
lines changed

tools/dep_updaters/update-acorn-walk.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ rm -rf deps/acorn/acorn-walk
3333

3434
"$NODE" "$NPM" init --yes
3535

36-
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn-walk
36+
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "acorn-walk@$NEW_VERSION"
3737
)
3838

3939
mv acorn-walk-tmp/node_modules/acorn-walk deps/acorn

tools/dep_updaters/update-acorn.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ rm -rf deps/acorn/acorn
3333

3434
"$NODE" "$NPM" init --yes
3535

36-
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn
36+
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "acorn@$NEW_VERSION"
3737
cd node_modules/acorn
3838
# update this version information in src/acorn_version.h
3939
FILE_PATH="$ROOT/src/acorn_version.h"

tools/dep_updaters/update-cjs-module-lexer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cd "$WORKSPACE"
4444

4545
"$NODE" "$NPM" init --yes
4646

47-
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts cjs-module-lexer
47+
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "cjs-module-lexer@$NEW_VERSION"
4848

4949
rm -rf "$DEPS_DIR/cjs-module-lexer"
5050

tools/dep_updaters/update-eslint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ rm -rf ../node_modules/eslint
3636
--ignore-scripts \
3737
--install-strategy=shallow \
3838
--no-bin-links \
39-
eslint
39+
"eslint@$NEW_VERSION"
4040
# Uninstall plugins that we want to install so that they are removed from
4141
# devDependencies. Otherwise --omit=dev will cause them to be skipped.
4242
(

tools/dep_updaters/update-minimatch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ rm -rf deps/minimatch/index.js
3434

3535
"$NODE" "$NPM" init --yes
3636

37-
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts minimatch
37+
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "minimatch@$NEW_VERSION"
3838
cd node_modules/minimatch
3939
"$NODE" "$NPM" exec [email protected] --yes -- esbuild ./dist/cjs/index.js --bundle --platform=node --outfile=minimatch.js
4040
)

tools/dep_updaters/update-postject.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cd test/fixtures/postject-copy || exit
2929

3030
"$NODE" "$NPM" init --yes
3131

32-
"$NODE" "$NPM" install --no-bin-links --ignore-scripts postject
32+
"$NODE" "$NPM" install --no-bin-links --ignore-scripts "postject@$NEW_VERSION"
3333

3434
# TODO(RaisinTen): Replace following with $WORKSPACE
3535
cd ../../..

tools/dep_updaters/update-undici.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ rm -f deps/undici/undici.js
3333

3434
"$NODE" "$NPM" init --yes
3535

36-
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts undici
36+
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "undici@$NEW_VERSION"
3737
cd node_modules/undici
3838
"$NODE" "$NPM" run build:node
3939
# update this version information in src/undici_version.h

0 commit comments

Comments
 (0)