Skip to content

Commit

Permalink
(1/N) cli: framework support (shadcn-ui#4569)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadcn authored Aug 30, 2024
1 parent dc8853c commit a62a155
Show file tree
Hide file tree
Showing 602 changed files with 24,936 additions and 12,487 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-phones-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"shadcn-ui": minor
---

Add support for frameworks
5 changes: 5 additions & 0 deletions .changeset/tidy-rings-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"shadcn": major
---

npx shadcn init
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"plugin:tailwindcss/recommended"
],
"plugins": ["tailwindcss"],
"ignorePatterns": ["**/fixtures/**"],
"rules": {
"@next/next/no-html-link-for-pages": "off",
"tailwindcss/no-custom-classname": "off",
Expand Down
2 changes: 1 addition & 1 deletion .github/version-script-beta.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { exec } from "child_process"
import fs from "fs"

const pkgJsonPath = "packages/cli/package.json"
const pkgJsonPath = "packages/shadcn/package.json"
try {
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath))
exec("git rev-parse --short HEAD", (err, stdout) => {
Expand Down
2 changes: 1 addition & 1 deletion .github/version-script-next.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { exec } from "child_process"
import fs from "fs"

const pkgJsonPath = "packages/cli/package.json"
const pkgJsonPath = "packages/shadcn/package.json"
try {
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath))
exec("git rev-parse --short HEAD", (err, stdout) => {
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/prerelease-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
for (const artifact of allArtifacts.data.artifacts) {
// Extract the PR number and package version from the artifact name
const match = /^npm-package-shadcn-ui@(.*?)-pr-(\d+)/.exec(artifact.name);
const match = /^npm-package-shadcn@(.*?)-pr-(\d+)/.exec(artifact.name);
if (match) {
require("fs").appendFileSync(
process.env.GITHUB_ENV,
Expand All @@ -49,7 +49,7 @@ jobs:
A new prerelease is available for testing:
```sh
npx shadcn-ui@${{ env.BETA_PACKAGE_VERSION }}
npx shadcn@${{ env.BETA_PACKAGE_VERSION }}
```
- name: "Remove the autorelease label once published"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: node .github/version-script-beta.js

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

Expand All @@ -51,10 +51,10 @@ jobs:
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: packages/cli
path: packages/shadcn

- name: Upload packaged artifact
uses: actions/upload-artifact@v2
with:
name: npm-package-shadcn-ui@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name
path: packages/cli/dist/index.js
name: npm-package-shadcn@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name
path: packages/shadcn/dist/index.js
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# run: pnpm check

- name: Build the package
run: pnpm build:cli
run: pnpm shadcn:build

- name: Create Version PR or Publish to NPM
id: changesets
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
.next
build
.contentlayer
apps/www/pages/api/registry.json
apps/www/pages/api/registry.json
**/fixtures
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
],
"vitest.debugExclude": [
"<node_internals>/**",
"**/node_modules/**",
"**/fixtures/**"
]
}
13 changes: 13 additions & 0 deletions apps/www/__registry__/default/block/login-01.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { LoginForm } from "@/registry/default/block/login-01/components/login-form"

export const iframeHeight = "870px"

export const containerClassName = "w-full h-full"

export default function Page() {
return (
<div className="flex h-screen w-full items-center justify-center px-4">
<LoginForm />
</div>
)
}
25 changes: 25 additions & 0 deletions apps/www/__registry__/default/block/sidebar-01.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { AppSidebar } from "@/registry/default/block/sidebar-01/components/app-sidebar"
import {
SidebarLayout,
SidebarTrigger,
} from "@/registry/default/block/sidebar-01/ui/sidebar"

export const iframeHeight = "870px"

export const containerClassName = "w-full h-full"

export default async function Page() {
const { cookies } = await import("next/headers")
return (
<SidebarLayout
defaultOpen={cookies().get("sidebar:state")?.value === "true"}
>
<AppSidebar />
<main className="flex flex-1 flex-col p-2 transition-all duration-300 ease-in-out">
<div className="h-full rounded-md border-2 border-dashed p-2">
<SidebarTrigger />
</div>
</main>
</SidebarLayout>
)
}
33 changes: 0 additions & 33 deletions apps/www/__registry__/default/example/accordion-demo.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions apps/www/__registry__/default/example/alert-demo.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions apps/www/__registry__/default/example/alert-destructive.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions apps/www/__registry__/default/example/alert-dialog-demo.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions apps/www/__registry__/default/example/aspect-ratio-demo.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions apps/www/__registry__/default/example/avatar-demo.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions apps/www/__registry__/default/example/badge-demo.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions apps/www/__registry__/default/example/badge-destructive.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions apps/www/__registry__/default/example/badge-outline.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions apps/www/__registry__/default/example/badge-secondary.tsx

This file was deleted.

49 changes: 0 additions & 49 deletions apps/www/__registry__/default/example/breadcrumb-demo.tsx

This file was deleted.

Loading

0 comments on commit a62a155

Please sign in to comment.