Skip to content

Commit

Permalink
tools: fix race condition when npm installing
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tniessen authored and targos committed May 30, 2023
1 parent 0ab840a commit 6c60d90
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-acorn-walk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-acorn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-cjs-module-lexer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-eslint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
(
Expand Down
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-minimatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] --yes -- esbuild ./dist/cjs/index.js --bundle --platform=node --outfile=minimatch.js
)
Expand Down
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-postject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ../../..
Expand Down
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-undici.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6c60d90

Please sign in to comment.