check / check (push) Waiting to run
script/bootstrap kept any yarn found on PATH, so YARN_VERSION applied only where none was installed. It now keeps the yarn on PATH only when yarn --version is exactly YARN_VERSION, and otherwise prepares that version through corepack. The node on PATH is used only when it has the pinned major version and is at least NODE_MIN_VERSION, as REPO_POLICIES.md asks. After installing either, bootstrap looks the tool up through PATH again, stops naming the path if it is not the pinned one, and prints the version it uses, as it does for Go. The other host scripts that run yarn run it through the new script/yarn, which uses the same node test with ~/.local/bin first on PATH, and otherwise the pinned node in nvm. Model: opus-5-5
31 lines
910 B
Bash
Executable File
31 lines
910 B
Bash
Executable File
#!/bin/sh
|
|
# script/add-dependency: add a frontend package, or move one to another
|
|
# version, with yarn add, which changes package.json and yarn.lock
|
|
# together; then install from yarn.lock with --frozen-lockfile, as
|
|
# script/bootstrap does, to show it installs as written. --dev because
|
|
# no frontend package is needed when the page runs: it ships as the
|
|
# built dist/.
|
|
set -eu
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|
|
|
usage() {
|
|
echo "usage: make add-dependency PACKAGE=<name>@<version>" >&2
|
|
exit 2
|
|
}
|
|
|
|
main() {
|
|
# Exactly one package. A value beginning with - would reach yarn as
|
|
# an option; yarn would quietly drop all but the first of several
|
|
# packages given in one value.
|
|
[ "$#" -eq 1 ] || usage
|
|
case "$1" in
|
|
"" | -* | *[[:space:]]*) usage ;;
|
|
esac
|
|
cd "$ROOT"
|
|
"$ROOT/script/yarn" add --dev "$1"
|
|
"$ROOT/script/yarn" install --frozen-lockfile
|
|
}
|
|
|
|
main "$@"
|