Files
netwatch/script/add-dependency
T
sneak 7494fd6197
check / check (push) Successful in 4m0s
Add make add-dependency and make tidy (closes #45)
No entrypoint could change yarn.lock or go.mod: script/bootstrap
installs with --frozen-lockfile, so adding a package meant running
yarn by hand. make add-dependency PACKAGE=<name>@<version> shims to
the new script/add-dependency: yarn add --dev, then yarn install
--frozen-lockfile. make tidy shims to the new script/tidy, go mod
tidy in backend/; a Go module is added by importing it, or moved by
editing its require line, then make tidy. script/bootstrap is
unchanged.

Model: opus-5-5
2026-10-04 02:25:34 +00:00

22 lines
612 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
# every frontend package is used only at build time.
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
main() {
if [ -z "${1:-}" ]; then
echo "usage: make add-dependency PACKAGE=<name>@<version>" >&2
exit 2
fi
cd "$ROOT"
yarn add --dev "$1"
yarn install --frozen-lockfile
}
main "$@"