Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automation for updating acorn dependency #45357

Merged
merged 1 commit into from Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/tools.yml
Expand Up @@ -89,6 +89,26 @@ jobs:
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
./tools/update-base64.sh "$NEW_VERSION"
fi
- id: acorn
subsystem: deps
label: dependencies
run: |
NEW_VERSION=$(npm view acorn dist-tags.latest)
CURRENT_VERSION=$(node -p "require('./deps/acorn/acorn/package.json').version")
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
./tools/update-acorn.sh
fi
- id: acorn-walk
subsystem: deps
label: dependencies
run: |
NEW_VERSION=$(npm view acorn-walk dist-tags.latest)
CURRENT_VERSION=$(node -p "require('./deps/acorn/acorn-walk/package.json').version")
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
./tools/update-acorn-walk.sh
fi
steps:
- uses: actions/checkout@v3
with:
Expand Down
30 changes: 30 additions & 0 deletions tools/update-acorn-walk.sh
@@ -0,0 +1,30 @@
#!/bin/sh

# Shell script to update acorn-walk in the source tree to the latest release.

# This script must be in the tools directory when it runs because it uses the
# script source file path to determine directories to work in.

set -ex

cd "$( dirname "$0" )/.." || exit
rm -rf deps/acorn/acorn-walk

(
rm -rf acorn-walk-tmp
mkdir acorn-walk-tmp
cd acorn-walk-tmp || exit

ROOT="$PWD/.."
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
[ -x "$NODE" ] || NODE=$(command -v node)
NPM="$ROOT/deps/npm/bin/npm-cli.js"

"$NODE" "$NPM" init --yes

"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn-walk
)

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

rm -rf acorn-walk-tmp/
30 changes: 30 additions & 0 deletions tools/update-acorn.sh
@@ -0,0 +1,30 @@
#!/bin/sh

# Shell script to update acorn in the source tree to the latest release.

# This script must be in the tools directory when it runs because it uses the
# script source file path to determine directories to work in.

set -ex

cd "$( dirname "$0" )/.." || exit
rm -rf deps/acorn/acorn

(
rm -rf acorn-tmp
mkdir acorn-tmp
cd acorn-tmp || exit

ROOT="$PWD/.."
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
[ -x "$NODE" ] || NODE=$(command -v node)
NPM="$ROOT/deps/npm/bin/npm-cli.js"

"$NODE" "$NPM" init --yes

"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn
)

mv acorn-tmp/node_modules/acorn deps/acorn

rm -rf acorn-tmp/