docs: sync nextui-cli api (#3035)

* docs: sync nextui-cli  api

* docs: update

* chore: update routes.json with new path and set updated flag

---------

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
This commit is contained in:
winches 2024-05-22 22:56:02 +08:00 committed by GitHub
parent 06ecd213cf
commit bc759838cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 106 additions and 44 deletions

View File

@ -417,7 +417,8 @@
"key": "cli-api",
"title": "NextUI CLI",
"keywords": "api references, nextui, api, cli",
"path": "/docs/api-references/cli-api.mdx"
"path": "/docs/api-references/cli-api.mdx",
"updated": true
},
{
"key": "nextui-provider",

View File

@ -51,6 +51,7 @@ nextui init [projectName] [options]
### Options
- `-t --template [string]` The template to use for the new project e.g. app, pages
- `-p --package [string]` The package manager to use for the new project (default: `npm`)
### Example
@ -58,6 +59,38 @@ nextui init [projectName] [options]
nextui init my-nextui-app -t app
```
output:
```codeBlock bash
NextUI CLI v0.2.1
┌ Create a new project
◇ Select a template (Enter to select)
│ ● App (A Next.js 14 with app directory template pre-configured with NextUI (v2) and Tailwind CSS.)
│ ○ Pages (A Next.js 14 with pages directory template pre-configured with NextUI (v2) and Tailwind CSS.)
◇ New project name (Enter to skip with default name)
│ my-nextui-app
◇ Select a package manager (Enter to select)
│ ● npm
│ ○ yarn
│ ○ pnpm
│ ○ bun
◇ Template created successfully!
◇ Next steps ───────╮
│ │
│ cd my-nextui-app │
│ npm install │
│ │
├────────────────────╯
└ 🚀 Get started with npm run dev
```
## add
> 1. Auto add the missing required `dependencies` to your project
@ -79,7 +112,6 @@ nextui add [components...] [options]
- `--prettier` [boolean] Add prettier format in the add content which required installed prettier - (default: false)
- `--addApp` [boolean] Add App.tsx file content which required provider (default: `false`)
### Example
Without setting a specific component, the `add` command will show a list of available components.
@ -91,27 +123,22 @@ nextui add
Output:
```codeBlock bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
? Which components would you like to add? - Space to select. Return to submit
Instructions:
↑/↓: Highlight option
←/→/[space]: Toggle selection
[a,b,c]/delete: Filter choices
enter/return: Complete answer
? Which components would you like to add? - Space to select. Return to submit
Filtered results for: Enter something to filter
accordion
◯ autocomplete
◯ avatar
◯ badge
◯ breadcrumbs
◯ button
◯ card
checkbox
chip
code
◯ accordion
◯ autocomplete
avatar
badge
breadcrumbs
button
calendar
card
checkbox
↓ chip
```
If you want to add a specific component, you can specify the component name.
@ -123,7 +150,7 @@ nextui add button input
Output:
```bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
Adding the required dependencies: @nextui-org/button
@ -142,7 +169,6 @@ Tailwind CSS settings have been updated in: /project-path/tailwind.config.js
✅ Components added successfully
```
## upgrade
Upgrade the NextUI components to the latest version.
@ -157,27 +183,33 @@ nextui upgrade [components...] [options]
- `-a --all` [boolean] Upgrade all the NextUI components (default: `false`).
- `-h, --help` Display help for commands.
### Example
```codeBlock bash
nextui upgrade button
```
Output:
```bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
╭───────────────────────── Component ─────────────────────────╮
│ @nextui-org/button ^2.0.11 -> ^2.0.31 │
╰─────────────────────────────────────────────────────────────╯
Required min version: @nextui-org/theme>=2.1.0, tailwindcss>=3.4.0
╭───────────────────── PeerDependencies ─────────────────────╮
│ @nextui-org/theme 2.0.1 -> 2.1.0 │
│ tailwindcss ^3.2.3 -> ^3.4.0 │
╰────────────────────────────────────────────────────────────╯
2 minor, 1 patch
╭───────────────────────────────────────────────────────────╮
│ @nextui-org/button 2.0.24 -> 2.0.27 │
╰───────────────────────────────────────────────────────────╯
? Would you like to proceed with the upgrade? - Use arrow-keys. Return to submit.
Yes
No
pnpm add @nextui-org/button@2.0.27
pnpm add @nextui-org/button@2.0.31 @nextui-org/theme@2.1.0 tailwindcss@3.4.0
Already up to date
Progress: resolved 474, reused 465, downloaded 0, added 0, done
Done in 2.9s
@ -195,7 +227,6 @@ Remove NextUI components from your project.
nextui remove [components...] [options]
```
### Options
- `-p --packagePath` [string] The path to the package.json file.
@ -213,7 +244,7 @@ nextui remove button
Output:
```bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
❗️ Components slated for removal:
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
@ -249,8 +280,8 @@ nextui list [options]
### Options
- `-p --packagePath` [string] The path to the package.json file.
- `-c --current` List the current installed components.
- `-p --packagePath` [string] The path to the package.json file
- `-r --remote` List all components available remotely
### Example
@ -261,7 +292,7 @@ nextui list
Output:
```codeBlock bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
Current installed components:
@ -283,6 +314,7 @@ Diagnose problems in your project.
> 2. Check whether the NextUI components `required dependencies are installed` in the project
> 3. Check the required `tailwind.config.js` file and the content is correct
> 4. Check `.npmrc` is correct when using `pnpm`
> 5. Check `peerDependencies with required version` are installed in the project
```codeBlock bash
nextui doctor [options]
@ -310,7 +342,7 @@ Output:
If there is a problem in your project, the `doctor` command will display the problem information.
```codeBlock bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
NextUI CLI: ❌ Your project has 1 issue that require attention
@ -322,7 +354,7 @@ Missing tailwind.config.(j|t)s file. To set up, visit: https://nextui.org/docs/g
Otherwise, the `doctor` command will display the following message.
```codeBlock bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
✅ Your project has no detected issues.
```
@ -348,7 +380,7 @@ nextui env
Output:
```codeBlock bash
NextUI CLI 0.1.0
NextUI CLI 0.2.1
Current installed components:

View File

@ -83,19 +83,41 @@ nextui init my-nextui-app
You will be prompted to configure your project:
```codeBlock bash
? Select a template - Use arrow-keys. Return to submit.
App
A Next.js 13 with app directory template pre-configured with NextUI (v2) and Tailwind CSS.
Pages
A Next.js 13 with pages directory template pre-configured with NextUI (v2) and Tailwind CSS.
┌ Create a new project
◇ Select a template (Enter to select)
│ ● App (A Next.js 14 with app directory template pre-configured with NextUI (v2) and Tailwind CSS.)
│ ○ Pages (A Next.js 14 with pages directory template pre-configured with NextUI (v2) and Tailwind CSS.)
◇ New project name (Enter to skip with default name)
│ my-nextui-app
◇ Select a package manager (Enter to select)
│ ● npm
│ ○ yarn
│ ○ pnpm
│ ○ bun
◇ Template created successfully!
◇ Next steps ───────╮
│ │
│ cd my-nextui-app │
│ npm install │
│ │
├────────────────────╯
└ 🚀 Get started with npm run dev
```
Install the dependencies to start the local server:
```codeBlock bash
cd my-nextui-app && npm install
```
Start the local server:
```codeBlock bash
npm run dev
```
@ -164,9 +186,16 @@ You will be asked to confirm the upgrade:
```codeBlock bash
╭───────────────────────────────────────────────────────────╮
│ @nextui-org/button 2.0.24 -> 2.0.27 │
╰───────────────────────────────────────────────────────────╯
╭───────────────────────── Component ─────────────────────────╮
│ @nextui-org/button ^2.0.11 -> ^2.0.31 │
╰─────────────────────────────────────────────────────────────╯
Required min version: @nextui-org/theme>=2.1.0, tailwindcss>=3.4.0
╭───────────────────── PeerDependencies ─────────────────────╮
│ @nextui-org/theme 2.0.1 -> 2.1.0 │
│ tailwindcss ^3.2.3 -> ^3.4.0 │
╰────────────────────────────────────────────────────────────╯
2 minor, 1 patch
? Would you like to proceed with the upgrade? - Use arrow-keys. Return to submit.
Yes