Skip to content

armgit / ui

Public Imported from GitHub
0
TypeScript

Generate registry JSON in public/r at build time

Andrew Luoff7ea427c05b
diff --git a/apps/v4/.gitignore b/apps/v4/.gitignore
index 296fe3c..4e45406 100644
--- a/apps/v4/.gitignore
+++ b/apps/v4/.gitignore
@@ -47,3 +47,4 @@ next-env.d.ts
.content-collections
.source
.registry
+public/r
diff --git a/apps/v4/app/r/[...path]/route.ts b/apps/v4/app/r/[...path]/route.ts
index 74f631f..ce803f8 100644
--- a/apps/v4/app/r/[...path]/route.ts
+++ b/apps/v4/app/r/[...path]/route.ts
@@ -80,6 +80,8 @@ function getRegistryDirectories() {
return Array.from(
new Set([
+ path.join(cwd, "public", "r"),
+ path.join(cwd, "apps", "v4", "public", "r"),
path.join(cwd, ".registry", "r"),
path.join(cwd, "apps", "v4", ".registry", "r"),
])
diff --git a/apps/v4/next.config.mjs b/apps/v4/next.config.mjs
index 33f0ced..34554d8 100644
--- a/apps/v4/next.config.mjs
+++ b/apps/v4/next.config.mjs
@@ -8,7 +8,7 @@ const nextConfig = {
ignoreBuildErrors: true,
},
outputFileTracingIncludes: {
- "/*": ["./.registry/r/**/*.json", "./registry/**/*", "./styles/**/*"],
+ "/*": ["./public/r/**/*.json", "./registry/**/*", "./styles/**/*"],
},
images: {
remotePatterns: [
diff --git a/apps/v4/package.json b/apps/v4/package.json
index ef80e4d..99e5a1e 100644
--- a/apps/v4/package.json
+++ b/apps/v4/package.json
@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "next dev --turbopack --port 4000",
- "build": "next build",
+ "build": "pnpm registry:build && next build",
"start": "next start --port 4000",
"preview": "next build && next start --port 4000",
"lint": "eslint . --cache --cache-location .eslintcache",
@@ -13,7 +13,7 @@
"typecheck": "tsc --noEmit",
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache",
- "registry:build": "shadcn build --output .registry/r",
+ "registry:build": "shadcn build --output public/r",
"registry:validate": "shadcn registry validate",
"postinstall": "fumadocs-mdx"
},
diff --git a/turbo.json b/turbo.json
index 77ae030..1a2bb15 100644
--- a/turbo.json
+++ b/turbo.json
@@ -16,7 +16,7 @@
"V0_EDIT_SECRET",
"DEPLOYMENT_PROTECTION_BYPASS"
],
- "outputs": ["dist/**", ".next/**", "!.next/cache/**"]
+ "outputs": ["dist/**", ".next/**", "!.next/cache/**", "public/r/**"]
},
"preview": {
"env": ["NEXT_PUBLIC_APP_URL"],
@@ -53,7 +53,7 @@
"outputs": []
},
"registry:build": {
- "outputs": []
+ "outputs": ["public/r/**"]
}
}
}