-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): add support for custom ui dir (#2266)
* feat(cli): add support for custom ui dir * docs(www): update docs for aliases.ui * chore: add changeset
- Loading branch information
Showing
13 changed files
with
216 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"shadcn-ui": minor | ||
--- | ||
|
||
add support for custom ui dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"style": "new-york", | ||
"tailwind": { | ||
"config": "tailwind.config.ts", | ||
"css": "src/app/globals.css", | ||
"baseColor": "zinc", | ||
"cssVariables": true, | ||
"prefix": "tw-" | ||
}, | ||
"rsc": false, | ||
"aliases": { | ||
"utils": "~/lib/utils", | ||
"components": "~/components", | ||
"ui": "~/ui" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "test-cli-config-ui", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "shadcn", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2017", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"checkJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"noUncheckedIndexedAccess": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"~/*": ["./src/*"] | ||
} | ||
}, | ||
"include": [ | ||
".eslintrc.cjs", | ||
"next-env.d.ts", | ||
"**/*.ts", | ||
"**/*.tsx", | ||
"**/*.cjs", | ||
"**/*.mjs" | ||
], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import path from "path" | ||
import { expect, test } from "vitest" | ||
|
||
import { getConfig } from "../../src/utils/get-config" | ||
import { getItemTargetPath } from "../../src/utils/registry" | ||
|
||
test("get item target path", async () => { | ||
// Full config. | ||
let appDir = path.resolve(__dirname, "../fixtures/config-full") | ||
expect( | ||
await getItemTargetPath(await getConfig(appDir), { | ||
type: "components:ui", | ||
}) | ||
).toEqual(path.resolve(appDir, "./src/components/ui")) | ||
|
||
// Partial config. | ||
appDir = path.resolve(__dirname, "../fixtures/config-partial") | ||
expect( | ||
await getItemTargetPath(await getConfig(appDir), { | ||
type: "components:ui", | ||
}) | ||
).toEqual(path.resolve(appDir, "./components/ui")) | ||
|
||
// JSX. | ||
appDir = path.resolve(__dirname, "../fixtures/config-jsx") | ||
expect( | ||
await getItemTargetPath(await getConfig(appDir), { | ||
type: "components:ui", | ||
}) | ||
).toEqual(path.resolve(appDir, "./components/ui")) | ||
|
||
// Custom paths. | ||
appDir = path.resolve(__dirname, "../fixtures/config-ui") | ||
expect( | ||
await getItemTargetPath(await getConfig(appDir), { | ||
type: "components:ui", | ||
}) | ||
).toEqual(path.resolve(appDir, "./src/ui")) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
be580db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ui – ./apps/www
ui.shadcn.com
example-playground.vercel.app
ui-git-main-shadcn-pro.vercel.app
ui-shadcn-pro.vercel.app