Skip to content

Commit a62a155

Browse files
authored
(1/N) cli: framework support (shadcn-ui#4569)
1 parent dc8853c commit a62a155

File tree

602 files changed

+24936
-12487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

602 files changed

+24936
-12487
lines changed

.changeset/large-phones-poke.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"shadcn-ui": minor
3+
---
4+
5+
Add support for frameworks

.changeset/tidy-rings-ring.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"shadcn": major
3+
---
4+
5+
npx shadcn init

.eslintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"plugin:tailwindcss/recommended"
99
],
1010
"plugins": ["tailwindcss"],
11+
"ignorePatterns": ["**/fixtures/**"],
1112
"rules": {
1213
"@next/next/no-html-link-for-pages": "off",
1314
"tailwindcss/no-custom-classname": "off",

.github/version-script-beta.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { exec } from "child_process"
55
import fs from "fs"
66

7-
const pkgJsonPath = "packages/cli/package.json"
7+
const pkgJsonPath = "packages/shadcn/package.json"
88
try {
99
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath))
1010
exec("git rev-parse --short HEAD", (err, stdout) => {

.github/version-script-next.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { exec } from "child_process"
55
import fs from "fs"
66

7-
const pkgJsonPath = "packages/cli/package.json"
7+
const pkgJsonPath = "packages/shadcn/package.json"
88
try {
99
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath))
1010
exec("git rev-parse --short HEAD", (err, stdout) => {

.github/workflows/prerelease-comment.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
2929
for (const artifact of allArtifacts.data.artifacts) {
3030
// Extract the PR number and package version from the artifact name
31-
const match = /^npm-package-shadcn-ui@(.*?)-pr-(\d+)/.exec(artifact.name);
32-
31+
const match = /^npm-package-shadcn@(.*?)-pr-(\d+)/.exec(artifact.name);
32+
3333
if (match) {
3434
require("fs").appendFileSync(
3535
process.env.GITHUB_ENV,
@@ -49,7 +49,7 @@ jobs:
4949
A new prerelease is available for testing:
5050
5151
```sh
52-
npx shadcn-ui@${{ env.BETA_PACKAGE_VERSION }}
52+
npx shadcn@${{ env.BETA_PACKAGE_VERSION }}
5353
```
5454
5555
- name: "Remove the autorelease label once published"

.github/workflows/prerelease.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: node .github/version-script-beta.js
4141

4242
- name: Authenticate to NPM
43-
run: echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" >> packages/cli/.npmrc
43+
run: echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" >> packages/shadcn/.npmrc
4444
env:
4545
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
4646

@@ -51,10 +51,10 @@ jobs:
5151
id: package-version
5252
uses: martinbeentjes/npm-get-version-action@main
5353
with:
54-
path: packages/cli
54+
path: packages/shadcn
5555

5656
- name: Upload packaged artifact
5757
uses: actions/upload-artifact@v2
5858
with:
59-
name: npm-package-shadcn-ui@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name
60-
path: packages/cli/dist/index.js
59+
name: npm-package-shadcn@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name
60+
path: packages/shadcn/dist/index.js

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
# run: pnpm check
3838

3939
- name: Build the package
40-
run: pnpm build:cli
40+
run: pnpm shadcn:build
4141

4242
- name: Create Version PR or Publish to NPM
4343
id: changesets

.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ node_modules
33
.next
44
build
55
.contentlayer
6-
apps/www/pages/api/registry.json
6+
apps/www/pages/api/registry.json
7+
**/fixtures

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@
66
"tailwindCSS.experimental.classRegex": [
77
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
88
["cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
9+
],
10+
"vitest.debugExclude": [
11+
"<node_internals>/**",
12+
"**/node_modules/**",
13+
"**/fixtures/**"
914
]
1015
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { LoginForm } from "@/registry/default/block/login-01/components/login-form"
2+
3+
export const iframeHeight = "870px"
4+
5+
export const containerClassName = "w-full h-full"
6+
7+
export default function Page() {
8+
return (
9+
<div className="flex h-screen w-full items-center justify-center px-4">
10+
<LoginForm />
11+
</div>
12+
)
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { AppSidebar } from "@/registry/default/block/sidebar-01/components/app-sidebar"
2+
import {
3+
SidebarLayout,
4+
SidebarTrigger,
5+
} from "@/registry/default/block/sidebar-01/ui/sidebar"
6+
7+
export const iframeHeight = "870px"
8+
9+
export const containerClassName = "w-full h-full"
10+
11+
export default async function Page() {
12+
const { cookies } = await import("next/headers")
13+
return (
14+
<SidebarLayout
15+
defaultOpen={cookies().get("sidebar:state")?.value === "true"}
16+
>
17+
<AppSidebar />
18+
<main className="flex flex-1 flex-col p-2 transition-all duration-300 ease-in-out">
19+
<div className="h-full rounded-md border-2 border-dashed p-2">
20+
<SidebarTrigger />
21+
</div>
22+
</main>
23+
</SidebarLayout>
24+
)
25+
}

apps/www/__registry__/default/example/accordion-demo.tsx

-33
This file was deleted.

apps/www/__registry__/default/example/alert-demo.tsx

-19
This file was deleted.

apps/www/__registry__/default/example/alert-destructive.tsx

-19
This file was deleted.

apps/www/__registry__/default/example/alert-dialog-demo.tsx

-35
This file was deleted.

apps/www/__registry__/default/example/aspect-ratio-demo.tsx

-16
This file was deleted.

apps/www/__registry__/default/example/avatar-demo.tsx

-14
This file was deleted.

apps/www/__registry__/default/example/badge-demo.tsx

-5
This file was deleted.

apps/www/__registry__/default/example/badge-destructive.tsx

-5
This file was deleted.

apps/www/__registry__/default/example/badge-outline.tsx

-5
This file was deleted.

apps/www/__registry__/default/example/badge-secondary.tsx

-5
This file was deleted.

apps/www/__registry__/default/example/breadcrumb-demo.tsx

-49
This file was deleted.

0 commit comments

Comments
 (0)