-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: move update-acorn.sh to dep_updaters and create maintaining md
PR-URL: #47382 Refs: nodejs/security-wg#828 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
- Loading branch information
1 parent
e50eb65
commit d11c6ba
Showing
5 changed files
with
138 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Maintaining acorn | ||
|
||
The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser. | ||
[acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is | ||
an abstract syntax tree walker for the ESTree format. | ||
|
||
## Updating acorn | ||
|
||
The `tools/dep_updaters/update-acorn.sh` script automates the update of the | ||
acorn source files. | ||
|
||
Check that Node.js still builds and tests. | ||
|
||
## Committing acorn | ||
|
||
1. Add acorn: | ||
```console | ||
$ git add deps/acorn | ||
``` | ||
2. Commit the changes: `git commit`. | ||
3. Add a message like: | ||
```text | ||
deps: update acorn to <version> | ||
|
||
Updated as described in doc/contributing/maintaining-acorn.md. | ||
``` | ||
|
||
## Updating acorn-walk | ||
|
||
The `tools/dep_updaters/update-acorn-walk.sh` script automates the update of the | ||
acorn-walk source files. | ||
|
||
Check that Node.js still builds and tests. | ||
|
||
## Committing acorn-walk | ||
|
||
1. Add acorn-walk: | ||
```console | ||
$ git add deps/acorn-walk | ||
``` | ||
2. Commit the changes: `git commit`. | ||
3. Add a message like: | ||
```text | ||
deps: update acorn-walk to <version> | ||
|
||
Updated as described in doc/contributing/maintaining-acorn.md. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/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 | ||
|
||
ROOT=$(cd "$(dirname "$0")/../.." && pwd) | ||
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" | ||
[ -x "$NODE" ] || NODE=$(command -v node) | ||
NPM="$ROOT/deps/npm/bin/npm-cli.js" | ||
|
||
NEW_VERSION=$("$NODE" "$NPM" view acorn-walk dist-tags.latest) | ||
CURRENT_VERSION=$("$NODE" -p "require('./deps/acorn/acorn-walk/package.json').version") | ||
|
||
echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
|
||
if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
echo "Skipped because Acorn-walk is on the latest version." | ||
exit 0 | ||
fi | ||
|
||
cd "$( dirname "$0" )/../.." || exit | ||
|
||
rm -rf deps/acorn/acorn-walk | ||
|
||
( | ||
rm -rf acorn-walk-tmp | ||
mkdir acorn-walk-tmp | ||
cd acorn-walk-tmp || exit | ||
|
||
"$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/ | ||
|
||
echo "All done!" | ||
echo "" | ||
echo "Please git add acorn-walk, commit the new version:" | ||
echo "" | ||
echo "$ git add -A deps/acorn-walk" | ||
echo "$ git commit -m \"deps: update acorn-walk to $NEW_VERSION\"" | ||
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=$NEW_VERSION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.