Skip to content

Commit

Permalink
fix: npm update file
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-ippolito committed Apr 24, 2023
1 parent 42acfbf commit 20c9307
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions tools/dep_updaters/update-npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -e

BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
DEPS_DIR="$BASE_DIR/deps"
[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node"
[ -x "$NODE" ] || NODE=$(command -v node)

NPM="$DEPS_DIR/npm/bin/npm-cli.js"

NPM_VERSION=$1

if [ "$#" -le 0 ]; then
Expand All @@ -25,22 +30,15 @@ trap cleanup INT TERM EXIT

cd "$WORKSPACE"

git clone --depth=1 --branch="v$NPM_VERSION" git@github.com:npm/cli.git
cd cli

echo "Preparing npm release"
NPM_TGZ=npm.tgz

make
make release
curl -s $("$NODE" "$NPM" view "npm@$NPM_VERSION" dist.tarball) > "$NPM_TGZ"

echo "Removing old npm"
rm -rf "$DEPS_DIR/npm"

cd "$DEPS_DIR"
rm -rf npm/
mkdir "$DEPS_DIR/npm"

echo "Copying new npm"

tar zxf "$WORKSPACE/cli/release/npm-$NPM_VERSION.tgz"
tar zxvf "$NPM_TGZ" --strip-component=1 -C "$DEPS_DIR/npm"

echo ""
echo "All done!"
Expand All @@ -49,5 +47,8 @@ echo "Please git add npm, commit the new version, and whitespace-fix:"
echo ""
echo "$ git add -A deps/npm"
echo "$ git commit -m \"deps: upgrade npm to $NPM_VERSION\""
echo "$ git rebase --whitespace=fix main"
echo ""

# The last line of the script should always print the new version,
# as we need to add it to $GITHUB_ENV variable.
echo "NEW_VERSION=$NPM_VERSION"

0 comments on commit 20c9307

Please sign in to comment.