Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 226e5b8

Browse filesBrowse files
marco-ippolitotargos
authored andcommitted
tools: move update-npm to dep updaters
PR-URL: #47619 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 9d0bef6 commit 226e5b8
Copy full SHA for 226e5b8

File tree

Expand file treeCollapse file tree

1 file changed

+16
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-13
lines changed
Open diff view settings
Collapse file
+16-13Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
set -e
33
# Shell script to update npm in the source tree to a specific version
44

5-
BASE_DIR=$(cd "$(dirname "$0")/.." && pwd)
5+
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
66
DEPS_DIR="$BASE_DIR/deps"
7+
[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node"
8+
[ -x "$NODE" ] || NODE=$(command -v node)
9+
10+
NPM="$DEPS_DIR/npm/bin/npm-cli.js"
11+
712
NPM_VERSION=$1
813

914
if [ "$#" -le 0 ]; then
@@ -25,22 +30,17 @@ trap cleanup INT TERM EXIT
2530

2631
cd "$WORKSPACE"
2732

28-
git clone --depth=1 --branch="v$NPM_VERSION" git@github.com:npm/cli.git
29-
cd cli
33+
NPM_TGZ=npm.tgz
3034

31-
echo "Preparing npm release"
35+
NPM_TARBALL="$($NODE "$NPM" view npm@"$NPM_VERSION" dist.tarball)"
3236

33-
make
34-
make release
37+
curl -s "$NPM_TARBALL" > "$NPM_TGZ"
3538

36-
echo "Removing old npm"
39+
rm -rf "$DEPS_DIR/npm"
3740

38-
cd "$DEPS_DIR"
39-
rm -rf npm/
41+
mkdir "$DEPS_DIR/npm"
4042

41-
echo "Copying new npm"
42-
43-
tar zxf "$WORKSPACE/cli/release/npm-$NPM_VERSION.tgz"
43+
tar zxvf "$NPM_TGZ" --strip-component=1 -C "$DEPS_DIR/npm"
4444

4545
echo ""
4646
echo "All done!"
@@ -49,5 +49,8 @@ echo "Please git add npm, commit the new version, and whitespace-fix:"
4949
echo ""
5050
echo "$ git add -A deps/npm"
5151
echo "$ git commit -m \"deps: upgrade npm to $NPM_VERSION\""
52-
echo "$ git rebase --whitespace=fix main"
5352
echo ""
53+
54+
# The last line of the script should always print the new version,
55+
# as we need to add it to $GITHUB_ENV variable.
56+
echo "NEW_VERSION=$NPM_VERSION"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.