diff options
author | Marco Ippolito <marcoippolito54@gmail.com> | 2023-04-03 11:52:59 +0200 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2023-04-11 13:19:14 +0000 |
commit | 4899998d0dc84d3955b5c7059f2dcb29021fb9a0 (patch) | |
tree | 6b22c291dad5679bc5f5dabf5609b1f974e66a7b /tools | |
parent | 76dfb778160b49557703cad309f1d736108de1c9 (diff) | |
download | node-new-4899998d0dc84d3955b5c7059f2dcb29021fb9a0.tar.gz |
tools: move update-undici.sh to dep_updaters and create maintain md
PR-URL: https://github.com/nodejs/node/pull/47380
Refs: https://github.com/nodejs/security-wg/issues/828
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/dep_updaters/update-undici.sh (renamed from tools/update-undici.sh) | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/tools/update-undici.sh b/tools/dep_updaters/update-undici.sh index ead449bcd1..68b16b9087 100755 --- a/tools/update-undici.sh +++ b/tools/dep_updaters/update-undici.sh @@ -7,7 +7,22 @@ set -ex -cd "$( dirname "$0" )/.." || exit +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 undici dist-tags.latest) +CURRENT_VERSION=$("$NODE" -p "require('./deps/undici/src/package.json').version") + +echo "Comparing $NEW_VERSION with $CURRENT_VERSION" + +if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then + echo "Skipped because Undici is on the latest version." + exit 0 +fi + +cd "$( dirname "$0" )/../.." || exit rm -rf deps/undici/src rm -f deps/undici/undici.js @@ -16,25 +31,18 @@ rm -f deps/undici/undici.js mkdir undici-tmp cd undici-tmp || exit - ROOT="$PWD/.." - [ -z "$NODE" ] && NODE="$ROOT/out/Release/node" - [ -x "$NODE" ] || NODE=$(command -v node) - NPM="$ROOT/deps/npm/bin/npm-cli.js" - "$NODE" "$NPM" init --yes "$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts undici cd node_modules/undici "$NODE" "$NPM" run build:node - # get the new version of undici - UNDICI_VERSION=$("$NODE" -p "require('./package.json').version") # update this version information in src/undici_version.h FILE_PATH="$ROOT/src/undici_version.h" echo "// This is an auto generated file, please do not edit." > "$FILE_PATH" echo "// Refer to tools/update-undici.sh" >> "$FILE_PATH" echo "#ifndef SRC_UNDICI_VERSION_H_" >> "$FILE_PATH" echo "#define SRC_UNDICI_VERSION_H_" >> "$FILE_PATH" - echo "#define UNDICI_VERSION \"$UNDICI_VERSION\"" >> "$FILE_PATH" + echo "#define UNDICI_VERSION \"$NEW_VERSION\"" >> "$FILE_PATH" echo "#endif // SRC_UNDICI_VERSION_H_" >> "$FILE_PATH" ) @@ -43,3 +51,7 @@ mv deps/undici/src/undici-fetch.js deps/undici/undici.js cp deps/undici/src/LICENSE deps/undici/LICENSE rm -rf undici-tmp/ + +# 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" |