| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 03c730b commit aa8feea
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ DEPS_DIR="$BASE_DIR/deps" | |||
| 17 | 17 | . "$BASE_DIR/tools/dep_updaters/utils.sh" | |
| 18 | 18 | ||
| 19 | 19 | NEW_VERSION=$("$NODE" "$NPM" view acorn-walk dist-tags.latest) | |
| 20 | - CURRENT_VERSION=$("$NODE" -p "require('./deps/acorn/acorn-walk/package.json').version") | ||
| 20 | + CURRENT_VERSION=$("$NODE" "$NPM" --prefix './deps/acorn/acorn-walk/' pkg get version) | ||
| 21 | 21 | ||
| 22 | 22 | # This function exit with 0 if new version and current version are the same | |
| 23 | 23 | compare_dependency_version "acorn-walk" "$NEW_VERSION" "$CURRENT_VERSION" | |
@@ -40,21 +40,17 @@ cd "$WORKSPACE" | |||
| 40 | 40 | ||
| 41 | 41 | echo "Fetching acorn-walk source archive..." | |
| 42 | 42 | ||
| 43 | - DIST_URL=$(curl -sL "https://registry.npmjs.org/acorn-walk/$NEW_VERSION" | perl -n -e '/"dist".*?"tarball":"(.*?)"/ && print $1') | ||
| 43 | + "$NODE" "$NPM" pack "acorn-walk@$NEW_VERSION" | ||
| 44 | 44 | ||
| 45 | - ACORN_WALK_TGZ="acorn-walk.tgz" | ||
| 46 | - | ||
| 47 | - curl -sL -o "$ACORN_WALK_TGZ" "$DIST_URL" | ||
| 45 | + ACORN_WALK_TGZ="acorn-walk-$NEW_VERSION.tgz" | ||
| 48 | 46 | ||
| 49 | 47 | log_and_verify_sha256sum "acorn-walk" "$ACORN_WALK_TGZ" | |
| 50 | 48 | ||
| 51 | 49 | rm -r "$DEPS_DIR/acorn/acorn-walk"/* | |
| 52 | 50 | ||
| 53 | 51 | tar -xf "$ACORN_WALK_TGZ" | |
| 54 | 52 | ||
| 55 | - mv "$WORKSPACE/package"/* "$DEPS_DIR/acorn/acorn-walk" | ||
| 56 | - | ||
| 57 | - rm "$ACORN_WALK_TGZ" | ||
| 53 | + mv package/* "$DEPS_DIR/acorn/acorn-walk" | ||
| 58 | 54 | ||
| 59 | 55 | echo "All done!" | |
| 60 | 56 | echo "" | |
@@ -64,6 +60,7 @@ echo "$ git add -A deps/acorn-walk" | |||
| 64 | 60 | echo "$ git commit -m \"deps: update acorn-walk to $NEW_VERSION\"" | |
| 65 | 61 | echo "" | |
| 66 | 62 | ||
| 67 | - # The last line of the script should always print the new version, | ||
| 68 | - # as we need to add it to $GITHUB_ENV variable. | ||
| 69 | - echo "NEW_VERSION=$NEW_VERSION" | ||
| 63 | + # Update the version number on maintaining-dependencies.md | ||
| 64 | + # and print the new version as the last line of the script as we need | ||
| 65 | + # to add it to $GITHUB_ENV variable | ||
| 66 | + finalize_version_update "acorn-walk" "$NEW_VERSION" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,36 +7,53 @@ | |||
| 7 | 7 | ||
| 8 | 8 | set -ex | |
| 9 | 9 | ||
| 10 | - ROOT=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 11 | - [ -z "$NODE" ] && NODE="$ROOT/out/Release/node" | ||
| 10 | + BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 11 | + [ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" | ||
| 12 | 12 | [ -x "$NODE" ] || NODE=$(command -v node) | |
| 13 | - NPM="$ROOT/deps/npm/bin/npm-cli.js" | ||
| 13 | + NPM="$BASE_DIR/deps/npm/bin/npm-cli.js" | ||
| 14 | + DEPS_DIR="$BASE_DIR/deps" | ||
| 14 | 15 | ||
| 15 | 16 | # shellcheck disable=SC1091 | |
| 16 | - . "$ROOT/tools/dep_updaters/utils.sh" | ||
| 17 | + . "$BASE_DIR/tools/dep_updaters/utils.sh" | ||
| 17 | 18 | ||
| 18 | 19 | NEW_VERSION=$("$NODE" "$NPM" view acorn dist-tags.latest) | |
| 19 | - CURRENT_VERSION=$("$NODE" -p "require('./deps/acorn/acorn/package.json').version") | ||
| 20 | + CURRENT_VERSION=$("$NODE" "$NPM" --prefix './deps/acorn/acorn/' pkg get version) | ||
| 20 | 21 | ||
| 21 | 22 | # This function exit with 0 if new version and current version are the same | |
| 22 | 23 | compare_dependency_version "acorn" "$NEW_VERSION" "$CURRENT_VERSION" | |
| 23 | 24 | ||
| 24 | 25 | cd "$( dirname "$0" )/../.." || exit | |
| 25 | 26 | ||
| 26 | - rm -rf deps/acorn/acorn | ||
| 27 | + echo "Making temporary workspace..." | ||
| 27 | 28 | ||
| 28 | - ( | ||
| 29 | - rm -rf acorn-tmp | ||
| 30 | - mkdir acorn-tmp | ||
| 31 | - cd acorn-tmp || exit | ||
| 29 | + WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') | ||
| 32 | 30 | ||
| 33 | - "$NODE" "$NPM" init --yes | ||
| 31 | + cleanup () { | ||
| 32 | + EXIT_CODE=$? | ||
| 33 | + [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" | ||
| 34 | + exit $EXIT_CODE | ||
| 35 | + } | ||
| 34 | 36 | ||
| 35 | - "$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "acorn@$NEW_VERSION" | ||
| 36 | - ) | ||
| 37 | + trap cleanup INT TERM EXIT | ||
| 38 | + | ||
| 39 | + cd "$WORKSPACE" | ||
| 40 | + | ||
| 41 | + echo "Fetching acorn source archive..." | ||
| 42 | + | ||
| 43 | + "$NODE" "$NPM" pack "acorn@$NEW_VERSION" | ||
| 44 | + | ||
| 45 | + ACORN_TGZ="acorn-$NEW_VERSION.tgz" | ||
| 46 | + | ||
| 47 | + log_and_verify_sha256sum "acorn" "$ACORN_TGZ" | ||
| 48 | + | ||
| 49 | + rm -r "$DEPS_DIR/acorn/acorn"/* | ||
| 50 | + | ||
| 51 | + tar -xf "$ACORN_TGZ" | ||
| 52 | + | ||
| 53 | + mv package/* "$DEPS_DIR/acorn/acorn" | ||
| 37 | 54 | ||
| 38 | 55 | # update version information in src/acorn_version.h | |
| 39 | - cat > "$ROOT/src/acorn_version.h" <<EOF | ||
| 56 | + cat > "$BASE_DIR/src/acorn_version.h" <<EOF | ||
| 40 | 57 | // This is an auto generated file, please do not edit. | |
| 41 | 58 | // Refer to tools/dep_updaters/update-acorn.sh | |
| 42 | 59 | #ifndef SRC_ACORN_VERSION_H_ | |
@@ -45,9 +62,14 @@ cat > "$ROOT/src/acorn_version.h" <<EOF | |||
| 45 | 62 | #endif // SRC_ACORN_VERSION_H_ | |
| 46 | 63 | EOF | |
| 47 | 64 | ||
| 48 | - mv acorn-tmp/node_modules/acorn deps/acorn | ||
| 49 | - | ||
| 50 | - rm -rf acorn-tmp/ | ||
| 65 | + echo "All done!" | ||
| 66 | + echo "" | ||
| 67 | + echo "Please git add acorn, commit the new version:" | ||
| 68 | + echo "" | ||
| 69 | + echo "$ git add -A deps/acorn/acorn" | ||
| 70 | + echo "$ git add $BASE_DIR/src/acorn_version.h" | ||
| 71 | + echo "$ git commit -m \"deps: update acorn to $NEW_VERSION\"" | ||
| 72 | + echo "" | ||
| 51 | 73 | ||
| 52 | 74 | # Update the version number on maintaining-dependencies.md | |
| 53 | 75 | # and print the new version as the last line of the script as we need | |
| Back | FazBrowse Home | New Git URL |
0 commit comments