diff --git a/apps/web/package.json b/apps/web/package.json index a73c220..6a8089c 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -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": { diff --git a/apps/web/scripts/prepare-registry.sh b/apps/web/scripts/prepare-registry.sh deleted file mode 100755 index 1cfa864..0000000 --- a/apps/web/scripts/prepare-registry.sh +++ /dev/null @@ -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}" diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index 37c6a27..46dc4b3 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -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",