script/fmt and script/fmt-check now run gofmt for Go and prettier for Markdown; fmt-check reports each independently. prettier is pinned at 3.8.1 by package.json/yarn.lock (integrity hash); .prettierrc and .prettierignore are the house settings copied from the prompts repo. script/bootstrap installs node and yarn from the host package manager and runs `yarn install --frozen-lockfile`. The Markdown check runs in CI via the Dockerfile build stage, where bootstrap provides prettier; it is removed from the lint stage because the golangci-lint image has no node. JS manifests are copied before bootstrap so the yarn layer caches, and node_modules is dockerignored. node is an unpinned host runtime like git/make/go: nvm's glibc node does not run on the musl/Alpine build image, so the canonical nvm route is not usable here; prettier is the hash-pinned formatter. The wholesale Markdown reformat follows in the next commit. Model: opus-4-8
24 lines
567 B
Bash
Executable File
24 lines
567 B
Bash
Executable File
#!/bin/sh
|
|
# script/fmt: format all files (writes). gofmt for Go, prettier for
|
|
# Markdown. prettier is the pinned devDependency in package.json/
|
|
# yarn.lock; script/bootstrap installs it (see run_prettier).
|
|
set -eu
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|
|
|
run_prettier() {
|
|
if ! command -v yarn >/dev/null 2>&1; then
|
|
echo "fmt: yarn not found; run script/bootstrap first" >&2
|
|
exit 1
|
|
fi
|
|
yarn run prettier "$@"
|
|
}
|
|
|
|
main() {
|
|
cd "$ROOT"
|
|
gofmt -s -w .
|
|
run_prettier --write '**/*.md' --tab-width 4 --prose-wrap always
|
|
}
|
|
|
|
main "$@"
|