mirror of
https://github.com/jakejarvis/stanza.git
synced 2026-07-16 18:05:58 -04:00
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:
@@ -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": {
|
||||
|
||||
@@ -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}"
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user