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 e8075fd

Browse filesBrowse files
facutuescaRafaelGSS
authored andcommitted
tools: add automation for updating acorn dependency
Add a Github Action that checks for new versions of the `acorn` and `acorn-walk` dependencies, and creates PRs to update them if newer versions than the ones present in the repo are found. Refs: nodejs/security-wg#828 PR-URL: #45357 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent 58334a3 commit e8075fd
Copy full SHA for e8075fd

File tree

Expand file treeCollapse file tree

3 files changed

+80
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+80
-0
lines changed
Open diff view settings
Collapse file

‎.github/workflows/tools.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/tools.yml
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,26 @@ jobs:
8989
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
9090
./tools/update-base64.sh "$NEW_VERSION"
9191
fi
92+
- id: acorn
93+
subsystem: deps
94+
label: dependencies
95+
run: |
96+
NEW_VERSION=$(npm view acorn dist-tags.latest)
97+
CURRENT_VERSION=$(node -p "require('./deps/acorn/acorn/package.json').version")
98+
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
99+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
100+
./tools/update-acorn.sh
101+
fi
102+
- id: acorn-walk
103+
subsystem: deps
104+
label: dependencies
105+
run: |
106+
NEW_VERSION=$(npm view acorn-walk dist-tags.latest)
107+
CURRENT_VERSION=$(node -p "require('./deps/acorn/acorn-walk/package.json').version")
108+
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
109+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
110+
./tools/update-acorn-walk.sh
111+
fi
92112
steps:
93113
- uses: actions/checkout@v3
94114
with:
Collapse file

‎tools/update-acorn-walk.sh‎

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
# Shell script to update acorn-walk in the source tree to the latest release.
4+
5+
# This script must be in the tools directory when it runs because it uses the
6+
# script source file path to determine directories to work in.
7+
8+
set -ex
9+
10+
cd "$( dirname "$0" )/.." || exit
11+
rm -rf deps/acorn/acorn-walk
12+
13+
(
14+
rm -rf acorn-walk-tmp
15+
mkdir acorn-walk-tmp
16+
cd acorn-walk-tmp || exit
17+
18+
ROOT="$PWD/.."
19+
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
20+
[ -x "$NODE" ] || NODE=$(command -v node)
21+
NPM="$ROOT/deps/npm/bin/npm-cli.js"
22+
23+
"$NODE" "$NPM" init --yes
24+
25+
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn-walk
26+
)
27+
28+
mv acorn-walk-tmp/node_modules/acorn-walk deps/acorn
29+
30+
rm -rf acorn-walk-tmp/
Collapse file

‎tools/update-acorn.sh‎

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
# Shell script to update acorn in the source tree to the latest release.
4+
5+
# This script must be in the tools directory when it runs because it uses the
6+
# script source file path to determine directories to work in.
7+
8+
set -ex
9+
10+
cd "$( dirname "$0" )/.." || exit
11+
rm -rf deps/acorn/acorn
12+
13+
(
14+
rm -rf acorn-tmp
15+
mkdir acorn-tmp
16+
cd acorn-tmp || exit
17+
18+
ROOT="$PWD/.."
19+
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
20+
[ -x "$NODE" ] || NODE=$(command -v node)
21+
NPM="$ROOT/deps/npm/bin/npm-cli.js"
22+
23+
"$NODE" "$NPM" init --yes
24+
25+
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn
26+
)
27+
28+
mv acorn-tmp/node_modules/acorn deps/acorn
29+
30+
rm -rf acorn-tmp/

0 commit comments

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