Skip to content

Commit

Permalink
tools: harmonize dep_updaters scripts
Browse files Browse the repository at this point in the history
PR-URL: #48201
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
  • Loading branch information
aduh95 authored and MoLow committed Jul 6, 2023
1 parent 19ad471 commit 1a5cddf
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
21 changes: 11 additions & 10 deletions tools/dep_updaters/update-acorn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@ rm -rf deps/acorn/acorn
"$NODE" "$NPM" init --yes

"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "acorn@$NEW_VERSION"
cd node_modules/acorn
# update this version information in src/acorn_version.h
FILE_PATH="$ROOT/src/acorn_version.h"
echo "// This is an auto generated file, please do not edit." > "$FILE_PATH"
echo "// Refer to tools/update-acorn.sh" >> "$FILE_PATH"
echo "#ifndef SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
echo "#define SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
echo "#define ACORN_VERSION \"$NEW_VERSION\"" >> "$FILE_PATH"
echo "#endif // SRC_ACORN_VERSION_H_" >> "$FILE_PATH"
)

# update version information in src/acorn_version.h
cat > "$ROOT/src/acorn_version.h" <<EOF
// This is an auto generated file, please do not edit.
// Refer to tools/update-acorn.sh
#ifndef SRC_ACORN_VERSION_H_
#define SRC_ACORN_VERSION_H_
#define ACORN_VERSION "$NEW_VERSION"
#endif // SRC_ACORN_VERSION_H_
EOF

mv acorn-tmp/node_modules/acorn deps/acorn

rm -rf acorn-tmp/
Expand All @@ -53,7 +54,7 @@ echo "All done!"
echo ""
echo "Please git add acorn, commit the new version:"
echo ""
echo "$ git add -A deps/acorn"
echo "$ git add -A deps/acorn src/acorn_version.h"
echo "$ git commit -m \"deps: update acorn to $NEW_VERSION\""
echo ""

Expand Down
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-base64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ echo "All done!"
echo ""
echo "Please git add base64/base64, commit the new version:"
echo ""
echo "$ git add -A deps/base64/base64"
echo "$ git add -A deps/base64/base64 src/base64_version.h"
echo "$ git commit -m \"deps: update base64 to $NEW_VERSION\""
echo ""

Expand Down
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-cjs-module-lexer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ echo "All done!"
echo ""
echo "Please git add cjs-module-lexer, commit the new version:"
echo ""
echo "$ git add -A deps/cjs-module-lexer"
echo "$ git add -A deps/cjs-module-lexer src/cjs_module_lexer_version.h"
echo "$ git commit -m \"deps: update cjs-module-lexer to $NEW_VERSION\""
echo ""

Expand Down
26 changes: 18 additions & 8 deletions tools/dep_updaters/update-undici.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,32 @@ rm -f deps/undici/undici.js
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "undici@$NEW_VERSION"
cd node_modules/undici
"$NODE" "$NPM" run build:node
# 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 \"$NEW_VERSION\"" >> "$FILE_PATH"
echo "#endif // SRC_UNDICI_VERSION_H_" >> "$FILE_PATH"
)

# update version information in src/undici_version.h
cat > "$ROOT/src/undici_version.h" <<EOF
// This is an auto generated file, please do not edit.
// Refer to tools/update-undici.sh
#ifndef SRC_UNDICI_VERSION_H_
#define SRC_UNDICI_VERSION_H_
#define UNDICI_VERSION "$NEW_VERSION"
#endif // SRC_UNDICI_VERSION_H_
EOF

mv undici-tmp/node_modules/undici deps/undici/src
mv deps/undici/src/undici-fetch.js deps/undici/undici.js
cp deps/undici/src/LICENSE deps/undici/LICENSE

rm -rf undici-tmp/

echo "All done!"
echo ""
echo "Please git add and commit the new version:"
echo ""
echo "$ git add -A deps/undici src/undici_version.h"
echo "$ git commit -m \"deps: update Undici 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"

0 comments on commit 1a5cddf

Please sign in to comment.