build(editor): blog editor JS build and drift gate
- Private ESM package with exact pins: @tiptap/core, pm, starter-kit, extension-table and extension-image 3.31.4; vite 7.3.5, vitest 3.2.7, happy-dom 20.11.6 and typescript 5.9.3, the admin SPA toolchain - vite.config.ts builds assets/src/blogeditor/index.ts into fixed-name assets/dist/blogeditor.js and blogeditor.css, minified, and runs vitest on happy-dom - scripts/check-dist.sh rebuilds into a temp dir and fails when assets/dist is stale; node_modules is ignored
This commit is contained in:
26
scripts/check-dist.sh
Executable file
26
scripts/check-dist.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Drift gate for the committed Blog Editor bundle (D-16). Rebuilds the element
|
||||
# from the committed lockfile into a temporary directory and fails when the
|
||||
# result differs from assets/dist, the files admin.go embeds. After changing
|
||||
# assets/src, rebuild with `npm run build` and commit assets/dist.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
if [[ ! -d node_modules ]]; then
|
||||
npm ci
|
||||
fi
|
||||
|
||||
npm run typecheck
|
||||
|
||||
TMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
|
||||
node_modules/.bin/vite build --outDir "$TMP/dist" --emptyOutDir --logLevel warn
|
||||
|
||||
if ! diff -r "$TMP/dist" assets/dist; then
|
||||
echo "check-dist: assets/dist is stale; run npm run build and commit assets/dist" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "check-dist: assets/dist matches a fresh build"
|
||||
Reference in New Issue
Block a user