Skip to content

Commit

Permalink
feat: all up to data do not show select and add fetch cache (#61)
Browse files Browse the repository at this point in the history
* feat: all up to data do not show select

* feat: init cache

* feat: add fetch version log

* feat: add cache use in getLatestVersion

* feat: add cache script

* fix: issues

* fix: ci

* feat: optimize exec speed and exec loading state

* fix: add main pkg when upgrade (#62)

* feat: add sort disabled pkg when select compoents (#63)

* feat: add sort disabled pkg when select compoents

* feat: optimize display

* feat(doctor): add peerDependencies check and less color (#64)

* feat: optimize log and less color

* feat(doctor): add peerDependencies check

* docs: update README (#65)

* feat: optimize log and less color

* feat(doctor): add peerDependencies check

* docs: update README

* docs: update README.md

* docs: update README.md

* feat: add vite init template (#67)

* feat: add vite init template

* docs: update init command

* feat: add noCache option (#68)
  • Loading branch information
winchesHe committed May 26, 2024
1 parent fb4bf77 commit d4a1ecc
Show file tree
Hide file tree
Showing 20 changed files with 496 additions and 130 deletions.
76 changes: 49 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Usage: nextui [command]

Options:
-v, --version Output the current version
--no-cache Disable cache, by default data will be cached for 30m after the first request
-h, --help Display help information for commands

Commands:
Expand All @@ -66,7 +67,7 @@ nextui init [projectName] [options]
#### Init Options
- `-t --template [string]` The template to use for the new project e.g. app, pages
- `-t --template [string]` The template to use for the new project e.g. app, pages, vite
- `-p --package [string]` The package manager to use for the new project (default: `npm`)
##### Example
Expand All @@ -79,27 +80,32 @@ nextui init my-nextui-app -t app
output:
```bash
NextUI CLI v0.2.0
NextUI CLI v0.2.1

┌ Create a new project
◇ Select a template (Enter to select)
│ App
│ ● 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.)
│ ○ Vite (A Vite 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
│ ● npm
│ ○ yarn
│ ○ pnpm
│ ○ bun
◇ Template created successfully!
◇ Next steps ───────────╮
│ │
cd next-app-template │
│ npm install │
│ │
├───────────────────╯
◇ Next steps ───────────────────
cd next-app-template
│ npm install
├────────────────────────────────
└ 🚀 Get started with npm run dev
```
Expand Down Expand Up @@ -138,7 +144,7 @@ nextui add
Output:
```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:
Expand Down Expand Up @@ -170,7 +176,7 @@ nextui add button
Output:
```bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
Adding the required dependencies: @nextui-org/button
Expand Down Expand Up @@ -214,19 +220,34 @@ 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, react>=18.3.1, react-dom>=18.3.1
╭───────────────────── PeerDependencies ─────────────────────╮
│ @nextui-org/theme 2.0.1 -> 2.1.0 │
│ tailwindcss ^3.2.3 -> ^3.4.0 │
│ react Missing -> 18.3.1 │
│ react-dom Missing -> 18.3.1 │
╰────────────────────────────────────────────────────────────╯
2 major, 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
Already up to date
Progress: resolved 474, reused 465, downloaded 0, added 0, done
Done in 2.9s
pnpm add @nextui-org/button@2.0.31 @nextui-org/theme@2.1.0 tailwindcss@3.4.0 react@18.3.1 react-dom@18.3.1
dependencies:
- @nextui-org/theme 2.0.1
+ @nextui-org/theme 2.1.0 (2.2.3 is available)
+ react 18.3.1
+ react-dom 18.3.1
Done in 1.8s
✅ Upgrade complete. All components are up to date.
```
Expand Down Expand Up @@ -259,7 +280,7 @@ nextui remove button
Output:
```bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
❗️ Components slated for removal:
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
Expand Down Expand Up @@ -287,7 +308,7 @@ Remove the removed components tailwind content in file:/project-path/tailwind.co
### List
List all the NextUI components.
List all the current installed components.
```bash
nextui list [options]
Expand All @@ -296,7 +317,7 @@ nextui list [options]
#### List Options
- `-p --packagePath` [string] The path to the package.json file
- `-c --current` List the current installed components
- `-r --remote` List all components available remotely
##### Example
Expand All @@ -307,7 +328,7 @@ nextui list
Output:
```bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
Current installed components:
Expand Down Expand Up @@ -335,6 +356,7 @@ nextui doctor [options]
> 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
#### Doctor Options
Expand All @@ -356,7 +378,7 @@ Output:
If there is a problem in your project, the `doctor` command will display the problem information.
```bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
NextUI CLI: ❌ Your project has 1 issue that require attention
Expand All @@ -368,7 +390,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.
```bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
✅ Your project has no detected issues.
```
Expand Down Expand Up @@ -396,7 +418,7 @@ nextui env
Output:
```bash
NextUI CLI v0.1.2
NextUI CLI v0.2.1
Current installed components:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"link:remove": "pnpm uninstall --global nextui-cli",
"build": "tsup",
"update:components": "tsx src/scripts/update/update-components.ts",
"clean:cache": "tsx src/scripts/cache/clean.ts",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . -max-warnings=0 --fix",
"check:prettier": "prettier --check .",
Expand All @@ -58,22 +59,21 @@
},
"dependencies": {
"@clack/prompts": "0.7.0",
"@winches/prompts": "0.0.6",
"async-retry": "1.3.3",
"chalk": "5.3.0",
"commander": "11.0.0",
"fast-glob": "3.3.2",
"find-up": "7.0.0",
"gradient-string": "2.0.2",
"ora": "8.0.1",
"prompts": "2.4.2",
"tar": "6.2.1"
},
"devDependencies": {
"@commitlint/cli": "17.7.1",
"@commitlint/config-conventional": "17.7.0",
"@types/gradient-string": "1.1.3",
"@types/node": "20.11.30",
"@types/prompts": "2.4.9",
"@typescript-eslint/eslint-plugin": "6.7.2",
"@typescript-eslint/parser": "6.7.2",
"bumpp": "9.4.0",
Expand Down
31 changes: 18 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/actions/add-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export async function addAction(components: string[], options: AddActionOptions)

/** ======================== Step 1 Add dependencies required ======================== */
if (all) {
const [, ...missingDependencies] = checkRequiredContentInstalled('all', allDependenciesKeys);
const [, ...missingDependencies] = await checkRequiredContentInstalled(
'all',
allDependenciesKeys
);

if (missingDependencies.length) {
Logger.info(
Expand All @@ -123,7 +126,7 @@ export async function addAction(components: string[], options: AddActionOptions)
await exec(`${currentPkgManager} ${runCmd} ${[...missingDependencies].join(' ')}`);
}
} else {
const [, ..._missingDependencies] = checkRequiredContentInstalled(
const [, ..._missingDependencies] = await checkRequiredContentInstalled(
'partial',
allDependenciesKeys
);
Expand Down
Loading

0 comments on commit d4a1ecc

Please sign in to comment.