2023-04-08 23:16:13 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Shell script to update minimatch in the source tree to the latest release.
|
|
|
|
|
|
|
|
# This script must be in the tools directory when it runs because it uses the
|
|
|
|
# script source file path to determine directories to work in.
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2023-11-13 09:32:30 +01:00
|
|
|
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
|
|
|
|
[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node"
|
2023-04-08 23:16:13 +02:00
|
|
|
[ -x "$NODE" ] || NODE=$(command -v node)
|
2023-11-13 09:32:30 +01:00
|
|
|
DEPS_DIR="$BASE_DIR/deps"
|
|
|
|
NPM="$DEPS_DIR/npm/bin/npm-cli.js"
|
2023-04-08 23:16:13 +02:00
|
|
|
|
2023-06-06 11:07:34 +02:00
|
|
|
# shellcheck disable=SC1091
|
2023-11-13 09:32:30 +01:00
|
|
|
. "$BASE_DIR/tools/dep_updaters/utils.sh"
|
2023-06-06 11:07:34 +02:00
|
|
|
|
2023-04-08 23:16:13 +02:00
|
|
|
NEW_VERSION=$("$NODE" "$NPM" view minimatch dist-tags.latest)
|
2023-11-28 23:39:29 +01:00
|
|
|
CURRENT_VERSION=$("$NODE" -p "require('./deps/minimatch/package.json').version")
|
2023-04-08 23:16:13 +02:00
|
|
|
|
2023-06-06 11:07:34 +02:00
|
|
|
# This function exit with 0 if new version and current version are the same
|
|
|
|
compare_dependency_version "minimatch" "$NEW_VERSION" "$CURRENT_VERSION"
|
2023-04-08 23:16:13 +02:00
|
|
|
|
|
|
|
cd "$( dirname "$0" )/../.." || exit
|
|
|
|
|
2023-11-13 09:32:30 +01:00
|
|
|
echo "Making temporary workspace..."
|
2023-04-08 23:16:13 +02:00
|
|
|
|
2023-11-13 09:32:30 +01:00
|
|
|
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
|
2023-04-08 23:16:13 +02:00
|
|
|
|
2023-11-13 09:32:30 +01:00
|
|
|
cleanup () {
|
|
|
|
EXIT_CODE=$?
|
|
|
|
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
|
|
|
|
exit $EXIT_CODE
|
|
|
|
}
|
2023-04-08 23:16:13 +02:00
|
|
|
|
2023-11-13 09:32:30 +01:00
|
|
|
trap cleanup INT TERM EXIT
|
2023-04-08 23:16:13 +02:00
|
|
|
|
2023-11-13 09:32:30 +01:00
|
|
|
cd "$WORKSPACE"
|
2023-04-08 23:16:13 +02:00
|
|
|
|
2023-11-13 09:32:30 +01:00
|
|
|
echo "Fetching minimatch source archive..."
|
|
|
|
|
|
|
|
"$NODE" "$NPM" pack "minimatch@$NEW_VERSION"
|
|
|
|
|
|
|
|
MINIMATCH_TGZ="minimatch-$NEW_VERSION.tgz"
|
|
|
|
|
|
|
|
log_and_verify_sha256sum "minimatch" "$MINIMATCH_TGZ"
|
|
|
|
|
|
|
|
rm -r "$DEPS_DIR/minimatch"/*
|
|
|
|
|
|
|
|
tar -xf "$MINIMATCH_TGZ"
|
|
|
|
|
|
|
|
cd package
|
|
|
|
|
|
|
|
"$NODE" "$NPM" install esbuild --save-dev
|
|
|
|
|
2024-04-15 06:42:40 +02:00
|
|
|
"$NODE" "$NPM" pkg set scripts.node-build="esbuild ./dist/commonjs/index.js --bundle --platform=node --outfile=index.js"
|
2023-11-13 09:32:30 +01:00
|
|
|
|
|
|
|
"$NODE" "$NPM" run node-build
|
|
|
|
|
|
|
|
rm -rf node_modules
|
|
|
|
|
|
|
|
mv ./* "$DEPS_DIR/minimatch"
|
|
|
|
|
2023-06-06 11:07:34 +02:00
|
|
|
# Update the version number on maintaining-dependencies.md
|
|
|
|
# and print the new version as the last line of the script as we need
|
|
|
|
# to add it to $GITHUB_ENV variable
|
|
|
|
finalize_version_update "minimatch" "$NEW_VERSION"
|