The image shipped a hard pin (@earendil-works/pi-coding-agent@0.78.0) while 'pi upgrade' on hosts had moved to 0.80.2, so builds lagged. Switch Pi to the @latest dist-tag so every image bundles the newest Pi. To keep the floating spec traceable, record the version that actually got fetched in build-manifest.json as pi_version, derived from the bundled tarball name (earendil-works-pi-coding-agent-<version>.tgz) after fetch+install. fetch-npm-globals.sh now also echoes the resolved tarball so the build log shows the version a dist-tag resolved to. Other globals (bw) stay pinned. Image is node24, compatible with current Pi (the legacy-node20 dist-tag is for node20 only). Verified: fetch resolves @latest → 0.80.2; version extraction matches npm. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
69 lines
2.5 KiB
Bash
Executable file
69 lines
2.5 KiB
Bash
Executable file
#!/bin/sh
|
|
# Fetch npm-global CLIs as .tgz tarballs for offline install on the ISO target.
|
|
#
|
|
# These packages are installed by firstboot with `npm install -g` from local
|
|
# tarballs (no network needed on the target). Versions are pinned in
|
|
# packages/npm-globals.txt to prevent build-to-build drift, except lines that
|
|
# use a dist-tag on purpose (Pi tracks @latest; the resolved version is recorded
|
|
# in build-manifest.json as `pi_version`).
|
|
#
|
|
# Notes:
|
|
# - Codex is shipped via the FreeBSD `codex` pkg (see pkg-list-host.txt),
|
|
# not via npm — kept out of this bundle on purpose.
|
|
# - Claude Code is intentionally not bundled in the XFCE USB image path.
|
|
# - opencode + cursor have no working FreeBSD distribution (upstream gap).
|
|
# - Output is dual-purpose: bundled into the ISO and used by firstboot.
|
|
#
|
|
# Usage:
|
|
# ./scripts/fetch-npm-globals.sh # fetch into tmp/npm-globals/
|
|
# OUT_DIR=/some/path ./scripts/fetch-npm-globals.sh
|
|
# NPM_GLOBALS_LIST=/path/to/list ./scripts/fetch-npm-globals.sh
|
|
|
|
set -eu
|
|
|
|
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
OUT_DIR="${OUT_DIR:-${ROOT_DIR}/tmp/npm-globals}"
|
|
NPM_GLOBALS_LIST="${NPM_GLOBALS_LIST:-${ROOT_DIR}/packages/npm-globals.txt}"
|
|
|
|
if ! command -v npm >/dev/null 2>&1; then
|
|
echo "ERROR: npm not found in PATH (install www/npm-node24)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$NPM_GLOBALS_LIST" ]; then
|
|
echo "ERROR: npm globals list not found: $NPM_GLOBALS_LIST" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$OUT_DIR"
|
|
cd "$OUT_DIR"
|
|
|
|
# Keep the bundle deterministic. The output directory is cached across builds,
|
|
# so remove old versions and legacy package names before fetching current
|
|
# tarballs; otherwise firstboot may install stale CLIs after newer ones.
|
|
rm -f ./*.tgz
|
|
|
|
echo "==> Fetching npm-global tarballs into ${OUT_DIR}"
|
|
echo "==> Package list: ${NPM_GLOBALS_LIST}"
|
|
while IFS= read -r pkg || [ -n "$pkg" ]; do
|
|
case "$pkg" in
|
|
''|'#'*) continue ;;
|
|
esac
|
|
echo " npm pack ${pkg}"
|
|
# `npm pack <name>@<version|dist-tag>` downloads the published tarball without
|
|
# installing it. Output is `<name>-<resolved-version>.tgz` (scoped names get
|
|
# their slash flattened to a dash). npm prints that filename on stdout — echo
|
|
# it so the build log shows exactly which version a dist-tag (e.g. @latest)
|
|
# resolved to.
|
|
_packed=$(npm pack "$pkg" 2>/dev/null | tail -1)
|
|
[ -n "${_packed}" ] && echo " → ${_packed}"
|
|
done < "$NPM_GLOBALS_LIST"
|
|
|
|
echo ""
|
|
echo "==> Bundle contents:"
|
|
ls -lh "$OUT_DIR"/*.tgz
|
|
|
|
TOTAL=$(du -sh "$OUT_DIR" | cut -f1)
|
|
echo ""
|
|
echo "==> Total size: ${TOTAL}"
|