| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3ceb2c4 commit 1271b0e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -174,6 +174,14 @@ jobs: | |||
| 174 | 174 | label: crypto, notable-change | |
| 175 | 175 | run: | | |
| 176 | 176 | node ./tools/dep_updaters/update-root-certs.mjs -v -f "$GITHUB_ENV" | |
| 177 | + - id: cjs-module-lexer | ||
| 178 | + subsystem: deps | ||
| 179 | + label: dependencies | ||
| 180 | + run: | | ||
| 181 | + ./tools/dep_updaters/update-cjs-module-lexer.sh > temp-output | ||
| 182 | + cat temp-output | ||
| 183 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 184 | + rm temp-output | ||
| 177 | 185 | steps: | |
| 178 | 186 | - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
| 179 | 187 | with: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,63 @@ | |||
| 1 | + #!/bin/sh | ||
| 2 | + set -e | ||
| 3 | + # Shell script to update cjs-module-lexer in the source tree to a specific version | ||
| 4 | + | ||
| 5 | + BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 6 | + | ||
| 7 | + DEPS_DIR="$BASE_DIR/deps" | ||
| 8 | + [ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" | ||
| 9 | + [ -x "$NODE" ] || NODE=$(command -v node) | ||
| 10 | + | ||
| 11 | + NPM="$DEPS_DIR/npm/bin/npm-cli.js" | ||
| 12 | + | ||
| 13 | + NEW_VERSION="$("$NODE" --input-type=module <<'EOF' | ||
| 14 | + const res = await fetch('https://api.github.com/repos/nodejs/cjs-module-lexer/tags'); | ||
| 15 | + if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); | ||
| 16 | + const tags = await res.json(); | ||
| 17 | + const { name } = tags.at(0) | ||
| 18 | + console.log(name); | ||
| 19 | + EOF | ||
| 20 | + )" | ||
| 21 | + | ||
| 22 | + CURRENT_VERSION=$("$NODE" -p "require('./deps/cjs-module-lexer/package.json').version") | ||
| 23 | + | ||
| 24 | + echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
| 25 | + | ||
| 26 | + if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| 27 | + echo "Skipped because ada is on the latest version." | ||
| 28 | + exit 0 | ||
| 29 | + fi | ||
| 30 | + | ||
| 31 | + echo "Making temporary workspace" | ||
| 32 | + | ||
| 33 | + WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') | ||
| 34 | + | ||
| 35 | + cleanup () { | ||
| 36 | + EXIT_CODE=$? | ||
| 37 | + [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" | ||
| 38 | + exit $EXIT_CODE | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + trap cleanup INT TERM EXIT | ||
| 42 | + | ||
| 43 | + cd "$WORKSPACE" | ||
| 44 | + | ||
| 45 | + "$NODE" "$NPM" init --yes | ||
| 46 | + | ||
| 47 | + "$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts cjs-module-lexer | ||
| 48 | + | ||
| 49 | + rm -rf "$DEPS_DIR/cjs-module-lexer" | ||
| 50 | + | ||
| 51 | + mv node_modules/cjs-module-lexer "$DEPS_DIR/cjs-module-lexer" | ||
| 52 | + | ||
| 53 | + echo "All done!" | ||
| 54 | + echo "" | ||
| 55 | + echo "Please git add cjs-module-lexer, commit the new version:" | ||
| 56 | + echo "" | ||
| 57 | + echo "$ git add -A deps/cjs-module-lexer" | ||
| 58 | + echo "$ git commit -m \"deps: update cjs-module-lexer to $NEW_VERSION\"" | ||
| 59 | + echo "" | ||
| 60 | + | ||
| 61 | + # The last line of the script should always print the new version, | ||
| 62 | + # as we need to add it to $GITHUB_ENV variable. | ||
| 63 | + echo "NEW_VERSION=$NEW_VERSION" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments