chore: replace prepare-registry.sh pre-hooks with a Vite run task

- Delete `scripts/prepare-registry.sh` and its `prebuild`/`predev` npm lifecycle hooks
- Define a `compile-registry` task in `vite.config.ts` using the `run.tasks` API with explicit `input`/`output` globs so Vite can cache and skip the build step when sources are unchanged
This commit is contained in:
2026-05-27 18:56:04 -04:00
parent 38cc24362c
commit 77de7bcbc9
3 changed files with 15 additions and 21 deletions
+2 -4
View File
@@ -5,10 +5,8 @@
"license": "MIT",
"type": "module",
"scripts": {
"build": "vp build",
"dev": "vp dev",
"prebuild": "./scripts/prepare-registry.sh",
"predev": "./scripts/prepare-registry.sh",
"build": "vp run compile-registry && vp build",
"dev": "vp run compile-registry && vp dev",
"start": "node .output/server/index.mjs"
},
"dependencies": {
-17
View File
@@ -1,17 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# Build the registry straight into apps/web/public/ so the deployed web app
# serves it from the same origin. The build emits:
# - apps/web/public/registry/{index,modules/*}.json
# - apps/web/public/schema.json
#
# Both targets are gitignored. The web app is the canonical registry host —
# the published CLI's default STANZA_REGISTRY points at this same /registry/ URL.
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
app_dir="$(cd "$here/.." && pwd)"
repo_root="$(cd "$app_dir/../.." && pwd)"
(cd "$repo_root" && pnpm exec jiti packages/registry/src/build.ts "$app_dir/public")
echo "[prepare-registry] → ${app_dir#"$repo_root/"}/public/{registry/,schema.json}"
+13
View File
@@ -50,6 +50,19 @@ export default defineConfig({
ssr: {
external: ["@takumi-rs/image-response", "@vercel/functions"],
},
run: {
tasks: {
"compile-registry": {
cwd: "../..",
command: "jiti packages/registry/src/build.ts apps/web/public",
input: [
{ pattern: "registry/modules/**", base: "workspace" },
{ pattern: "packages/registry/src/**", base: "workspace" },
],
output: ["apps/web/public/registry/**", "apps/web/public/schema.json"],
},
},
},
optimizeDeps: {
include: [
"@base-ui/react/button",