| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e50eb65 commit d11c6ba
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,22 +95,18 @@ jobs: | |||
| 95 | 95 | subsystem: deps | |
| 96 | 96 | label: dependencies | |
| 97 | 97 | run: | | |
| 98 | - NEW_VERSION=$(npm view acorn dist-tags.latest) | ||
| 99 | - CURRENT_VERSION=$(node -p "require('./deps/acorn/acorn/package.json').version") | ||
| 100 | - if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then | ||
| 101 | - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
| 102 | - ./tools/update-acorn.sh | ||
| 103 | - fi | ||
| 98 | + ./tools/dep_updaters/update-acorn.sh > temp-output | ||
| 99 | + cat temp-output | ||
| 100 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 101 | + rm temp-output | ||
| 104 | 102 | - id: acorn-walk | |
| 105 | 103 | subsystem: deps | |
| 106 | 104 | label: dependencies | |
| 107 | 105 | run: | | |
| 108 | - NEW_VERSION=$(npm view acorn-walk dist-tags.latest) | ||
| 109 | - CURRENT_VERSION=$(node -p "require('./deps/acorn/acorn-walk/package.json').version") | ||
| 110 | - if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then | ||
| 111 | - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
| 112 | - ./tools/update-acorn-walk.sh | ||
| 113 | - fi | ||
| 106 | + ./tools/dep_updaters/update-acorn-walk.sh > temp-output | ||
| 107 | + cat temp-output | ||
| 108 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 109 | + rm temp-output | ||
| 114 | 110 | - id: libuv | |
| 115 | 111 | subsystem: deps | |
| 116 | 112 | label: dependencies | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,47 @@ | |||
| 1 | + # Maintaining acorn | ||
| 2 | + | ||
| 3 | + The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser. | ||
| 4 | + [acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is | ||
| 5 | + an abstract syntax tree walker for the ESTree format. | ||
| 6 | + | ||
| 7 | + ## Updating acorn | ||
| 8 | + | ||
| 9 | + The `tools/dep_updaters/update-acorn.sh` script automates the update of the | ||
| 10 | + acorn source files. | ||
| 11 | + | ||
| 12 | + Check that Node.js still builds and tests. | ||
| 13 | + | ||
| 14 | + ## Committing acorn | ||
| 15 | + | ||
| 16 | + 1. Add acorn: | ||
| 17 | + ```console | ||
| 18 | + $ git add deps/acorn | ||
| 19 | + ``` | ||
| 20 | + 2. Commit the changes: `git commit`. | ||
| 21 | + 3. Add a message like: | ||
| 22 | + ```text | ||
| 23 | + deps: update acorn to <version> | ||
| 24 | + | ||
| 25 | + Updated as described in doc/contributing/maintaining-acorn.md. | ||
| 26 | + ``` | ||
| 27 | + | ||
| 28 | + ## Updating acorn-walk | ||
| 29 | + | ||
| 30 | + The `tools/dep_updaters/update-acorn-walk.sh` script automates the update of the | ||
| 31 | + acorn-walk source files. | ||
| 32 | + | ||
| 33 | + Check that Node.js still builds and tests. | ||
| 34 | + | ||
| 35 | + ## Committing acorn-walk | ||
| 36 | + | ||
| 37 | + 1. Add acorn-walk: | ||
| 38 | + ```console | ||
| 39 | + $ git add deps/acorn-walk | ||
| 40 | + ``` | ||
| 41 | + 2. Commit the changes: `git commit`. | ||
| 42 | + 3. Add a message like: | ||
| 43 | + ```text | ||
| 44 | + deps: update acorn-walk to <version> | ||
| 45 | + | ||
| 46 | + Updated as described in doc/contributing/maintaining-acorn.md. | ||
| 47 | + ``` | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,53 @@ | |||
| 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 | + ROOT=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 11 | + [ -z "$NODE" ] && NODE="$ROOT/out/Release/node" | ||
| 12 | + [ -x "$NODE" ] || NODE=$(command -v node) | ||
| 13 | + NPM="$ROOT/deps/npm/bin/npm-cli.js" | ||
| 14 | + | ||
| 15 | + NEW_VERSION=$("$NODE" "$NPM" view acorn-walk dist-tags.latest) | ||
| 16 | + CURRENT_VERSION=$("$NODE" -p "require('./deps/acorn/acorn-walk/package.json').version") | ||
| 17 | + | ||
| 18 | + echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
| 19 | + | ||
| 20 | + if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| 21 | + echo "Skipped because Acorn-walk is on the latest version." | ||
| 22 | + exit 0 | ||
| 23 | + fi | ||
| 24 | + | ||
| 25 | + cd "$( dirname "$0" )/../.." || exit | ||
| 26 | + | ||
| 27 | + rm -rf deps/acorn/acorn-walk | ||
| 28 | + | ||
| 29 | + ( | ||
| 30 | + rm -rf acorn-walk-tmp | ||
| 31 | + mkdir acorn-walk-tmp | ||
| 32 | + cd acorn-walk-tmp || exit | ||
| 33 | + | ||
| 34 | + "$NODE" "$NPM" init --yes | ||
| 35 | + | ||
| 36 | + "$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn-walk | ||
| 37 | + ) | ||
| 38 | + | ||
| 39 | + mv acorn-walk-tmp/node_modules/acorn-walk deps/acorn | ||
| 40 | + | ||
| 41 | + rm -rf acorn-walk-tmp/ | ||
| 42 | + | ||
| 43 | + echo "All done!" | ||
| 44 | + echo "" | ||
| 45 | + echo "Please git add acorn-walk, commit the new version:" | ||
| 46 | + echo "" | ||
| 47 | + echo "$ git add -A deps/acorn-walk" | ||
| 48 | + echo "$ git commit -m \"deps: update acorn-walk to $NEW_VERSION\"" | ||
| 49 | + echo "" | ||
| 50 | + | ||
| 51 | + # The last line of the script should always print the new version, | ||
| 52 | + # as we need to add it to $GITHUB_ENV variable. | ||
| 53 | + echo "NEW_VERSION=$NEW_VERSION" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,35 +7,56 @@ | |||
| 7 | 7 | ||
| 8 | 8 | set -ex | |
| 9 | 9 | ||
| 10 | - cd "$( dirname "$0" )/.." || exit | ||
| 10 | + ROOT=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 11 | + [ -z "$NODE" ] && NODE="$ROOT/out/Release/node" | ||
| 12 | + [ -x "$NODE" ] || NODE=$(command -v node) | ||
| 13 | + NPM="$ROOT/deps/npm/bin/npm-cli.js" | ||
| 14 | + | ||
| 15 | + NEW_VERSION=$("$NODE" "$NPM" view acorn dist-tags.latest) | ||
| 16 | + CURRENT_VERSION=$("$NODE" -p "require('./deps/acorn/acorn/package.json').version") | ||
| 17 | + | ||
| 18 | + echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
| 19 | + | ||
| 20 | + if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| 21 | + echo "Skipped because Acorn is on the latest version." | ||
| 22 | + exit 0 | ||
| 23 | + fi | ||
| 24 | + | ||
| 25 | + cd "$( dirname "$0" )/../.." || exit | ||
| 26 | + | ||
| 11 | 27 | rm -rf deps/acorn/acorn | |
| 12 | 28 | ||
| 13 | 29 | ( | |
| 14 | 30 | rm -rf acorn-tmp | |
| 15 | 31 | mkdir acorn-tmp | |
| 16 | 32 | cd acorn-tmp || exit | |
| 17 | 33 | ||
| 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 | 34 | "$NODE" "$NPM" init --yes | |
| 24 | 35 | ||
| 25 | 36 | "$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts acorn | |
| 26 | 37 | cd node_modules/acorn | |
| 27 | - # get acorn version | ||
| 28 | - ACORN_VERSION=$("$NODE" -p "require('./package.json').version") | ||
| 29 | 38 | # update this version information in src/acorn_version.h | |
| 30 | 39 | FILE_PATH="$ROOT/src/acorn_version.h" | |
| 31 | 40 | echo "// This is an auto generated file, please do not edit." > "$FILE_PATH" | |
| 32 | 41 | echo "// Refer to tools/update-acorn.sh" >> "$FILE_PATH" | |
| 33 | 42 | echo "#ifndef SRC_ACORN_VERSION_H_" >> "$FILE_PATH" | |
| 34 | 43 | echo "#define SRC_ACORN_VERSION_H_" >> "$FILE_PATH" | |
| 35 | - echo "#define ACORN_VERSION \"$ACORN_VERSION\"" >> "$FILE_PATH" | ||
| 44 | + echo "#define ACORN_VERSION \"$NEW_VERSION\"" >> "$FILE_PATH" | ||
| 36 | 45 | echo "#endif // SRC_ACORN_VERSION_H_" >> "$FILE_PATH" | |
| 37 | 46 | ) | |
| 38 | 47 | ||
| 39 | 48 | mv acorn-tmp/node_modules/acorn deps/acorn | |
| 40 | 49 | ||
| 41 | 50 | rm -rf acorn-tmp/ | |
| 51 | + | ||
| 52 | + echo "All done!" | ||
| 53 | + echo "" | ||
| 54 | + echo "Please git add acorn, commit the new version:" | ||
| 55 | + echo "" | ||
| 56 | + echo "$ git add -A deps/acorn" | ||
| 57 | + echo "$ git commit -m \"deps: update acorn to $NEW_VERSION\"" | ||
| 58 | + echo "" | ||
| 59 | + | ||
| 60 | + # The last line of the script should always print the new version, | ||
| 61 | + # as we need to add it to $GITHUB_ENV variable. | ||
| 62 | + echo "NEW_VERSION=$NEW_VERSION" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments