Skip to content

Commit ee79770

Browse files
committed
cli
1 parent 52639bb commit ee79770

File tree

348 files changed

+4873
-22201
lines changed

Some content is hidden

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

348 files changed

+4873
-22201
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ When adding or modifying components, please ensure that you update the documenta
111111

112112
## CLI
113113

114-
The `@udecode/plate-ui` package is a CLI for adding components to your project. You can find the documentation for the CLI [here](https://platejs.org/docs/components/cli).
114+
The `shadcx` package is a CLI for adding components to your project. You can find the documentation for the CLI [here](https://platejs.org/docs/components/cli).
115115

116116
Any changes to the CLI should be made in the `packages/plate-ui` directory. If you can, it would be great if you could add tests for your changes.
117117

apps/www/content/docs/components/align-dropdown-menu.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ docs:
2323
<TabsContent value="cli">
2424

2525
```bash
26-
npx @udecode/plate-ui@latest add align-dropdown-menu
26+
npx shadcx@latest add align-dropdown-menu -r plate-ui
2727
```
2828

2929
</TabsContent>

apps/www/content/docs/components/avatar.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ links:
1818
<TabsContent value="cli">
1919

2020
```bash
21-
npx @udecode/plate-ui@latest add avatar
21+
npx shadcx@latest add avatar -r plate-ui
2222
```
2323

2424
</TabsContent>

apps/www/content/docs/components/blockquote-element.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docs:
1818
<TabsContent value="cli">
1919

2020
```bash
21-
npx @udecode/plate-ui@latest add blockquote-element
21+
npx shadcx@latest add blockquote-element -r plate-ui
2222
```
2323

2424
</TabsContent>

apps/www/content/docs/components/button.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ links:
1717
<TabsContent value="cli">
1818

1919
```bash
20-
npx @udecode/plate-ui@latest add button
20+
npx shadcx@latest add button -r plate-ui
2121
```
2222

2323
</TabsContent>

apps/www/content/docs/components/calendar.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ links:
1818
<TabsContent value="cli">
1919

2020
```bash
21-
npx @udecode/plate-ui@latest add calendar
21+
npx shadcx@latest add calendar -r plate-ui
2222
```
2323

2424
</TabsContent>

apps/www/content/docs/components/caption.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docs:
1818
<TabsContent value="cli">
1919

2020
```bash
21-
npx @udecode/plate-ui@latest add caption
21+
npx shadcx@latest add caption -r plate-ui
2222
```
2323

2424
</TabsContent>

apps/www/content/docs/components/changelog.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Use the [CLI](https://platejs.org/docs/components/cli) to install the latest ver
1111

1212
## October 2024 #15
1313

14+
### October 14 #15.3
15+
16+
- New cli: `shadcx`. See [CLI](/docs/components/cli) and [components.json](/docs/components/components-json).
17+
1418
### October 10 #15.3
1519

1620
- `dropdown-menu`(`DropdownMenuContent`): prevent default on `onCloseAutoFocus`

apps/www/content/docs/components/checkbox.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ links:
1717
<TabsContent value="cli">
1818

1919
```bash
20-
npx @udecode/plate-ui@latest add checkbox
20+
npx shadcx@latest add checkbox -r plate-ui
2121
```
2222

2323
</TabsContent>
+56-104
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,55 @@
11
---
22
title: CLI
3-
description: Use the CLI to add components to your project.
3+
description: Use the CLI to add Plate UI components to your project.
44
---
55

6-
<Callout className="mt-6">
7-
WIP – We're migrating to <Link href="https://ui.shadcn.com/docs/cli">npx shadcn</Link>.
8-
</Callout>
9-
10-
{/* <Callout>
11-
12-
**Note:** We are now using the `shadcn` CLI.
13-
14-
</Callout>
15-
166
## init
177

18-
Use the `init` command to initialize configuration and dependencies for a new project.
8+
Use the `init` command to initialize configuration and dependencies for a new project with Plate UI.
199

2010
The `init` command installs dependencies, adds the `cn` util, configures `tailwind.config.js`, and CSS variables for the project.
2111

2212
```bash
23-
npx @udecode/plate-ui@latest init
13+
npx shadcx@latest init -u https://platejs.org/r -n plate-ui
14+
```
15+
16+
If you also want to use <Link href="https://ui.shadcn.com/">shadcn/ui</Link> in your project, you can use the following command:
17+
18+
```bash
19+
npx shadcx@latest init
20+
npx shadcx@latest init -u https://platejs.org/r -n plate-ui
2421
```
2522

2623
You will be asked a few questions to configure `components.json`:
2724

2825
```txt showLineNumbers
29-
Which style would you like to use? › Default
3026
Which color would you like to use as base color? › Slate
3127
Do you want to use CSS variables for colors? › yes
3228
```
3329

34-
To have the same look than Plate UI, you should:
35-
36-
- Pick "Default" for the style. Plate does not have the "New York" style.
37-
- Pick "Slate" for the base color.
38-
- Pick "Yes" for using CSS variables.
39-
40-
You should get something like this:
41-
42-
```txt
43-
npx shadcn@latest init
44-
Need to install the following packages:
45-
46-
Ok to proceed? (y) y
47-
48-
✔ Preflight checks.
49-
✔ Verifying framework. Found Next.js.
50-
✔ Validating Tailwind CSS.
51-
✔ Validating import alias.
52-
✔ Which style would you like to use? › Default
53-
✔ Which color would you like to use as the base color? › Slate
54-
✔ Would you like to use CSS variables for theming? … no / yes
55-
✔ Writing components.json.
56-
✔ Checking registry.
57-
✔ Updating tailwind.config.js
58-
✔ Updating src/styles/globals.css
59-
✔ Installing dependencies.
60-
✔ Created 1 file:
61-
- src/lib/utils.ts
62-
63-
Success! Project initialization completed.
64-
You may now add components.
65-
```
66-
6730
### Options
6831

6932
```txt
70-
Usage: shadcn init [options] [components...]
33+
Usage: shadcx init [options]
7134
7235
initialize your project and install dependencies
7336
74-
Arguments:
75-
components the components to add or a url to the component.
76-
7737
Options:
78-
-d, --defaults use default values i.e new-york, zinc and css variables. (default: false)
38+
-d, --defaults use default values i.e slate and css variables. (default: false)
7939
-f, --force force overwrite of existing components.json. (default: false)
8040
-y, --yes skip confirmation prompt. (default: false)
8141
-c, --cwd <cwd> the working directory. defaults to the current directory.
82-
-h, --help display help for command
42+
-u, --url <url> custom registry URL. (default: https://platejs.org/r)
43+
-n, --name <name> registry name. (default: plate-ui)
44+
-h, --help display help for command
8345
```
8446

8547
## add
8648

87-
Use the `add` command to add components and dependencies to your project.
49+
Use the `add` command to add Plate UI components and dependencies to your project.
8850

8951
```bash
90-
npx @udecode/plate-ui@latest add [component]
52+
npx shadcx@latest add [component]
9153
```
9254

9355
You will be presented with a list of components to choose from:
@@ -107,73 +69,63 @@ Enter to submit.
10769
◯ combobox
10870
```
10971

110-
<Callout className="my-4">
111-
Pick the components you want in our <Link href="/?builder=true" target="_blank">interactive builder</Link> to generate the bulk add command to run.
112-
</Callout>
113-
11472
### Options
11573

11674
```txt
117-
Usage: @udecode/plate-ui add [options] [components...]
75+
Usage: shadcx add [options] [components...]
11876
11977
add a component to your project
12078
12179
Arguments:
122-
components the components to add
80+
components the components to add.
12381
12482
Options:
125-
-y, --yes skip confirmation prompt. (default: false)
126-
-o, --overwrite overwrite existing files. (default: false)
127-
-c, --cwd <cwd> the working directory. defaults to the current directory.
128-
-p, --path <path> the path to add the component to.
129-
-h, --help display help for command
83+
-y, --yes skip confirmation prompt. (default: false)
84+
-o, --overwrite overwrite existing files. (default: false)
85+
-c, --cwd <cwd> the working directory. defaults to the current directory.
86+
-p, --path <path> the path to add the component to.
87+
-h, --help display help for command
13088
```
13189

132-
## diff (experimental)
133-
134-
You can use the diff command to check for updates against the registry.
90+
## Monorepo
13591

136-
Run the following command to get a list of components that have updates available:
92+
In a monorepo, you can specify the path to your workspace with the `-c` or `--cwd` option.
13793

13894
```bash
139-
npx @udecode/plate-ui@latest diff
95+
npx shadcx@latest init -u https://platejs.org/r -n plate-ui -c ./apps/www
14096
```
14197

142-
```txt
143-
The following components have updates available:
144-
- blockquote-element
145-
- /path/to/my-app/components/ui/blockquote-element.tsx
146-
- button
147-
- /path/to/my-app/components/ui/button.tsx
148-
- combobox
149-
- /path/to/my-app/components/ui/combobox.ts
150-
```
151-
152-
Then run `diff [component]` to see the changes:
98+
or
15399

154100
```bash
155-
npx @udecode/plate-ui@latest diff blockquote-element
101+
npx shadcx@latest add align-dropdown-menu -c ./apps/www
156102
```
157103

158-
```diff /pl-6/
159-
ref={ref}
160-
- className={cn('my-1 border-l-2 pl-4 italic', className)}
161-
+ className={cn('my-1 border-l-2 pl-6 italic', className)}
162-
{...props}
104+
## Example components.json
105+
106+
Here's an example `components.json` file configured for <Link href="https://ui.shadcn.com/">shadcn/ui</Link> and Plate UI:
107+
108+
```json
109+
{
110+
"style": "default",
111+
"tailwind": {
112+
"config": "tailwind.config.js",
113+
"css": "app/globals.css",
114+
"baseColor": "slate",
115+
"cssVariables": true
116+
},
117+
"aliases": {
118+
"components": "@/components",
119+
"utils": "@/lib/utils"
120+
},
121+
"registries": {
122+
"plate-ui": {
123+
"url": "https://platejs.org/r",
124+
"style": "default",
125+
"aliases": {
126+
"ui": "@/components/plate-ui"
127+
}
128+
}
129+
}
130+
}
163131
```
164-
165-
### Options
166-
167-
```txt
168-
Usage: @udecode/plate-ui diff [options] [component]
169-
170-
check for updates against the registry
171-
172-
Arguments:
173-
component the component name
174-
175-
Options:
176-
-y, --yes skip confirmation prompt. (default: false)
177-
-c, --cwd <cwd> the working directory. defaults to the current directory.
178-
-h, --help display help for command
179-
``` */}

apps/www/content/docs/components/cloud.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docs:
1818
<TabsContent value="cli">
1919

2020
```bash
21-
npx @udecode/plate-ui@latest add cloud
21+
npx shadcx@latest add cloud -r plate-ui
2222
```
2323

2424
</TabsContent>

apps/www/content/docs/components/code-block-element.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ docs:
2020
<TabsContent value="cli">
2121

2222
```bash
23-
npx @udecode/plate-ui@latest add code-block-element
23+
npx shadcx@latest add code-block-element -r plate-ui
2424
```
2525

2626
</TabsContent>

apps/www/content/docs/components/code-leaf.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docs:
1818
<TabsContent value="cli">
1919

2020
```bash
21-
npx @udecode/plate-ui@latest add code-leaf
21+
npx shadcx@latest add code-leaf -r plate-ui
2222
```
2323

2424
</TabsContent>

apps/www/content/docs/components/code-line-element.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docs:
1818
<TabsContent value="cli">
1919

2020
```bash
21-
npx @udecode/plate-ui@latest add code-line-element
21+
npx shadcx@latest add code-line-element -r plate-ui
2222
```
2323

2424
</TabsContent>

apps/www/content/docs/components/code-syntax-leaf.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docs:
1818
<TabsContent value="cli">
1919

2020
```bash
21-
npx @udecode/plate-ui@latest add code-syntax-leaf
21+
npx shadcx@latest add code-syntax-leaf -r plate-ui
2222
```
2323

2424
</TabsContent>

apps/www/content/docs/components/color-dropdown-menu.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ docs:
2828
<TabsContent value="cli">
2929

3030
```bash
31-
npx @udecode/plate-ui@latest add color-dropdown-menu
31+
npx shadcx@latest add color-dropdown-menu -r plate-ui
3232
```
3333

3434
</TabsContent>

apps/www/content/docs/components/column-element.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ docs:
2020
<TabsContent value="cli">
2121

2222
```bash
23-
npx @udecode/plate-ui@latest add column-element
23+
npx shadcx@latest add column-element -r plate-ui
2424
```
2525

2626
</TabsContent>

apps/www/content/docs/components/column-group-element.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ docs:
2020
<TabsContent value="cli">
2121

2222
```bash
23-
npx @udecode/plate-ui@latest add column-group-element
23+
npx shadcx@latest add column-group-element -r plate-ui
2424
```
2525

2626
</TabsContent>

apps/www/content/docs/components/command.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ links:
1717
<TabsContent value="cli">
1818

1919
```bash
20-
npx @udecode/plate-ui@latest add command
20+
npx shadcx@latest add command -r plate-ui
2121
```
2222

2323
</TabsContent>

apps/www/content/docs/components/comment-leaf.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docs:
1818
<TabsContent value="cli">
1919

2020
```bash
21-
npx @udecode/plate-ui@latest add comment-leaf
21+
npx shadcx@latest add comment-leaf -r plate-ui
2222
```
2323

2424
</TabsContent>

0 commit comments

Comments
 (0)