mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-11 09:51:40 +00:00
fix
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import fs from "node:fs/promises"
|
||||
import path from "node:path"
|
||||
import * as React from "react"
|
||||
|
||||
import { formatCode } from "@/lib/format-code"
|
||||
import { highlightCode } from "@/lib/highlight-code"
|
||||
import { readFileFromRoot } from "@/lib/read-file"
|
||||
import { getDemoItem, getRegistryItem } from "@/lib/registry"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { CodeCollapsibleWrapper } from "@/components/code-collapsible-wrapper"
|
||||
@@ -42,8 +41,7 @@ export async function ComponentSource({
|
||||
}
|
||||
|
||||
if (src) {
|
||||
const file = await fs.readFile(path.join(process.cwd(), src), "utf-8")
|
||||
code = file
|
||||
code = await readFileFromRoot(src)
|
||||
}
|
||||
|
||||
if (!code) {
|
||||
|
||||
7
apps/v4/lib/read-file.ts
Normal file
7
apps/v4/lib/read-file.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { promises as fs } from "fs"
|
||||
import path from "path"
|
||||
|
||||
export async function readFileFromRoot(relativePath: string) {
|
||||
const absolutePath = path.join(process.cwd(), relativePath)
|
||||
return fs.readFile(absolutePath, "utf-8")
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { LRUCache } from "lru-cache"
|
||||
import { registryItemSchema, type registryItemFileSchema } from "shadcn/schema"
|
||||
import { type z } from "zod"
|
||||
|
||||
import { readFileFromRoot } from "@/lib/read-file"
|
||||
import { Index as StylesIndex } from "@/registry/__index__"
|
||||
import { BASES } from "@/registry/bases"
|
||||
import { Index as BasesIndex } from "@/registry/bases/__index__"
|
||||
@@ -43,8 +44,7 @@ export async function getDemoItem(name: string, styleName: string) {
|
||||
return null
|
||||
}
|
||||
|
||||
const filePath = path.join(process.cwd(), demo.filePath)
|
||||
const content = await fs.readFile(filePath, "utf-8")
|
||||
const content = await readFileFromRoot(demo.filePath)
|
||||
|
||||
return {
|
||||
name: demo.name,
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
"@types/react": "19.2.2",
|
||||
"@types/react-dom": "19.2.2",
|
||||
"@typescript-eslint/parser": "^8.31.0",
|
||||
"baseline-browser-mapping": "^2.10.0",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.0.0",
|
||||
"prettier": "^3.4.2",
|
||||
|
||||
Binary file not shown.
BIN
apps/v4/public/r/templates/next-monorepo.tar.gz
Normal file
BIN
apps/v4/public/r/templates/next-monorepo.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
apps/v4/public/r/templates/react-router-monorepo.tar.gz
Normal file
BIN
apps/v4/public/r/templates/react-router-monorepo.tar.gz
Normal file
Binary file not shown.
BIN
apps/v4/public/r/templates/start-app.tar.gz
Normal file
BIN
apps/v4/public/r/templates/start-app.tar.gz
Normal file
Binary file not shown.
BIN
apps/v4/public/r/templates/start-monorepo.tar.gz
Normal file
BIN
apps/v4/public/r/templates/start-monorepo.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
apps/v4/public/r/templates/vite-monorepo.tar.gz
Normal file
BIN
apps/v4/public/r/templates/vite-monorepo.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -89,7 +89,7 @@ try {
|
||||
console.log("\n⚙️ Building public/r/config.json...")
|
||||
await buildConfig()
|
||||
|
||||
console.log("\n📦 Building public/templates...")
|
||||
console.log("\n📦 Building public/r/templates...")
|
||||
await buildTemplates()
|
||||
|
||||
// Copy UI to examples before cleanup.
|
||||
@@ -732,7 +732,7 @@ async function batchPrettier(paths: string[]) {
|
||||
|
||||
async function buildTemplates() {
|
||||
const templatesDir = path.resolve(process.cwd(), "../../templates")
|
||||
const outputDir = path.join(process.cwd(), "public/templates")
|
||||
const outputDir = path.join(process.cwd(), "public/r/templates")
|
||||
await fs.mkdir(outputDir, { recursive: true })
|
||||
|
||||
await Promise.all(
|
||||
@@ -757,6 +757,10 @@ async function buildTemplates() {
|
||||
outputPath,
|
||||
"--exclude",
|
||||
"node_modules",
|
||||
"--exclude",
|
||||
".git",
|
||||
"--exclude",
|
||||
"pnpm-lock.yaml",
|
||||
"-C",
|
||||
templatesDir,
|
||||
name,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os from "os"
|
||||
import path from "path"
|
||||
import { REGISTRY_URL } from "@/src/registry/constants"
|
||||
import type { RegistryItem } from "@/src/registry/schema"
|
||||
import type { Config } from "@/src/utils/get-config"
|
||||
import { handleError } from "@/src/utils/handle-error"
|
||||
@@ -7,7 +8,7 @@ import { spinner } from "@/src/utils/spinner"
|
||||
import { execa } from "execa"
|
||||
import fs from "fs-extra"
|
||||
|
||||
export const TEMPLATE_BASE_URL = "https://ui.shadcn.com/templates"
|
||||
export const TEMPLATE_BASE_URL = `${REGISTRY_URL}/templates`
|
||||
|
||||
export interface TemplateOptions {
|
||||
projectPath: string
|
||||
|
||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -323,6 +323,9 @@ importers:
|
||||
'@typescript-eslint/parser':
|
||||
specifier: ^8.31.0
|
||||
version: 8.39.0(eslint@9.26.0(hono@4.11.7)(jiti@2.6.1))(typescript@5.9.2)
|
||||
baseline-browser-mapping:
|
||||
specifier: ^2.10.0
|
||||
version: 2.10.0
|
||||
eslint:
|
||||
specifier: ^9
|
||||
version: 9.26.0(hono@4.11.7)(jiti@2.6.1)
|
||||
@@ -3640,6 +3643,11 @@ packages:
|
||||
base64-js@1.5.1:
|
||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||
|
||||
baseline-browser-mapping@2.10.0:
|
||||
resolution: {integrity: sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
|
||||
baseline-browser-mapping@2.8.4:
|
||||
resolution: {integrity: sha512-L+YvJwGAgwJBV1p6ffpSTa2KRc69EeeYGYjRVWKs0GKrK+LON0GC0gV+rKSNtALEDvMDqkvCFq9r1r94/Gjwxw==}
|
||||
hasBin: true
|
||||
@@ -11231,6 +11239,8 @@ snapshots:
|
||||
|
||||
base64-js@1.5.1: {}
|
||||
|
||||
baseline-browser-mapping@2.10.0: {}
|
||||
|
||||
baseline-browser-mapping@2.8.4: {}
|
||||
|
||||
basic-ftp@5.0.5: {}
|
||||
@@ -14310,7 +14320,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@next/env': 16.1.6
|
||||
'@swc/helpers': 0.5.15
|
||||
baseline-browser-mapping: 2.8.4
|
||||
baseline-browser-mapping: 2.10.0
|
||||
caniuse-lite: 1.0.30001759
|
||||
postcss: 8.4.31
|
||||
react: 19.2.3
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 259 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 15 KiB |
BIN
templates/start-monorepo/apps/web/public/favicon.ico
Normal file
BIN
templates/start-monorepo/apps/web/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
25
templates/start-monorepo/apps/web/public/manifest.json
Normal file
25
templates/start-monorepo/apps/web/public/manifest.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "TanStack App",
|
||||
"name": "Create TanStack App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
3
templates/start-monorepo/apps/web/public/robots.txt
Normal file
3
templates/start-monorepo/apps/web/public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
Reference in New Issue
Block a user