From cf99755329fcc7fd6c2fd413c3069a91c1fe73cb Mon Sep 17 00:00:00 2001 From: winches <329487092@qq.com> Date: Fri, 17 Jan 2025 02:16:57 +0800 Subject: [PATCH] refactor: nextui-cli to heroui-cli (#129) * refactor: nextui-cli to heroui-cli * fix: update nextui in codemod * docs: update readme * fix: update pkg --------- Co-authored-by: Junior Garcia --- .github/ISSUE_TEMPLATE/bug_report.yml | 16 +- .github/ISSUE_TEMPLATE/config.yml | 8 +- .github/ISSUE_TEMPLATE/feature_request.yml | 4 +- .github/workflows/sync.yml | 16 +- CHANGELOG.md | 2 +- CONTRIBUTING.md | 20 +- README.md | 162 ++--- package.json | 23 +- packages/codemod/README.md | 1 + packages/codemod/src/index.ts | 10 +- src/actions/add-action.ts | 32 +- src/actions/doctor-action.ts | 8 +- src/actions/init-action.ts | 6 +- src/actions/list-action.ts | 6 +- src/actions/remove-action.ts | 28 +- src/actions/upgrade-action.ts | 38 +- src/constants/component.ts | 80 +-- src/constants/components.json | 717 +-------------------- src/constants/required.ts | 56 +- src/constants/store.ts | 66 +- src/constants/templates.ts | 18 +- src/helpers/beta.ts | 8 +- src/helpers/check.ts | 24 +- src/helpers/debug.ts | 4 +- src/helpers/fix.ts | 12 +- src/helpers/logger.ts | 2 +- src/helpers/output-info.ts | 20 +- src/helpers/package.ts | 22 +- src/helpers/remove.ts | 38 +- src/helpers/type.ts | 16 +- src/helpers/upgrade.ts | 24 +- src/index.ts | 46 +- src/scripts/helpers.ts | 6 +- src/scripts/path.ts | 4 +- src/scripts/sync/index.ts | 8 +- 35 files changed, 419 insertions(+), 1132 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7630eba..9d3c24d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -8,25 +8,25 @@ body: value: | Thank you for reporting an issue :pray:. - This issue tracker is for reporting bugs found in [NextUI CLI github repository](https://github.com/nextui-org/nextui-cli/) + This issue tracker is for reporting bugs found in [HeroUI CLI github repository](https://github.com/frontio-ai/heroui-cli/) If you have a question about how to achieve something and are struggling, please post a question inside of either of the following places: - - NextUI CLI's [Discussion's tab](https://github.com/nextui-org/nextui-cli/discussions) - - NextUI's [Discord channel](https://discord.gg/9b6yyZKmH4) + - HeroUI CLI's [Discussion's tab](https://github.com/frontio-ai/heroui-cli/discussions) + - HeroUI's [Discord channel](https://discord.gg/9b6yyZKmH4) Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already: - - NextUI CLI's [Issue's tab](https://github.com/nextui-org/nextui-cli/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) - - NextUI CLI's [closed issues tab](https://github.com/nextui-org/nextui-cli/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed) - - NextUI CLI's [Discussions tab](https://github.com/nextui-org/nextui-cli/discussions) + - HeroUI CLI's [Issue's tab](https://github.com/frontio-ai/heroui-cli/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) + - HeroUI CLI's [closed issues tab](https://github.com/frontio-ai/heroui-cli/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed) + - HeroUI CLI's [Discussions tab](https://github.com/frontio-ai/heroui-cli/discussions) The more information you fill in, the better the community can help you. - type: input id: version attributes: - label: NextUI CLI Version + label: HeroUI CLI Version description: | - Please provide the version of NextUI CLI you are using. + Please provide the version of HeroUI CLI you are using. You can find the version number in the package.json file. placeholder: ex. 0.1.4 validations: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index cef1a28..cd5ea1e 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,11 @@ blank_issues_enabled: true contact_links: - name: ๐Ÿค” Long question or ideas? - url: https://github.com/nextui-org/nextui-cli/discussions + url: https://github.com/frontio-ai/heroui-cli/discussions about: Ask long-form questions and discuss ideas. - name: ๐Ÿ’ฌ Discord Community Chat url: https://discord.gg/9b6yyZKmH4 - about: Ask quick questions or simply chat on the `NextUI` community Discord server. + about: Ask quick questions or simply chat on the `HeroUI` community Discord server. - name: ๐Ÿ’ฌ New Updates (Twitter) - url: https://twitter.com/getnextui - about: Link to our twitter account if you want to follow us and stay up to date with NextUI news + url: https://twitter.com/hero_ui + about: Link to our twitter account if you want to follow us and stay up to date with HeroUI news diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 83e2c4b..94c143e 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -2,7 +2,7 @@ name: Feature request title: "[Feature Request] YOUR_FEATURE_TITLE_HERE_REPLACE_ME" labels: [feature request] description: | - ๐Ÿ’ก Suggest an idea for the `NextUI CLI` project + ๐Ÿ’ก Suggest an idea for the `HeroUI CLI` project Examples - propose a new command - improve an exiting features @@ -12,7 +12,7 @@ body: attributes: value: | This issue form is for requesting features only! For example, requesting a new command, behavior ... etc - If you want to report a bug, please use the [bug report form](https://github.com/nextui-org/nextui-cli/issues/new?assignees=&labels=&template=bug_report.yml). + If you want to report a bug, please use the [bug report form](https://github.com/frontio-ai/heroui-cli/issues/new?assignees=&labels=&template=bug_report.yml). - type: textarea validations: required: true diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 2f8f578..1d743a4 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -31,9 +31,9 @@ jobs: git config --global user.name 'GitHub Action' git config --global user.email 'action@github.com' - - name: Clone nextui repository + - name: Clone heroui repository run: | - git clone https://github.com/nextui-org/nextui nextui --depth 1 + git clone https://github.com/frontio-ai/heroui-cli heroui --depth 1 - name: Run docs sync script run: | @@ -45,17 +45,17 @@ jobs: VERSION=$(jq -r '.version' package.json) echo "::set-output name=version::$VERSION" - - name: Commit changes to nextui repository + - name: Commit changes to heroui repository run: | - cd nextui + cd heroui git add . - git commit -m "docs: sync api from nextui-cli v${{ steps.get_version.outputs.version }}" + git commit -m "docs: sync api from heroui-cli v${{ steps.get_version.outputs.version }}" - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.PAT }} - path: nextui + path: heroui branch: sync-docs-${{ steps.get_version.outputs.version }}-${{ github.run_id }} - title: "docs: sync api from nextui-cli v${{ steps.get_version.outputs.version }}" - body: Sync api from nextui-cli. \ No newline at end of file + title: "docs: sync api from heroui-cli v${{ steps.get_version.outputs.version }}" + body: Sync api from heroui-cli. \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb0ab8..7201394 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,7 +104,7 @@ ### Bug Fixes - add command error in tailwind ([#80](https://github.com/nextui-org/nextui-cli/issues/80)) ([455d6e0](https://github.com/nextui-org/nextui-cli/commit/455d6e03ed33f2bba18cb5cd113966af0a7dc69f)) -- upgrade command select option cannot select @nextui-org/react pkg ([#78](https://github.com/nextui-org/nextui-cli/issues/78)) ([93e5cdc](https://github.com/nextui-org/nextui-cli/commit/93e5cdc98299ec75d5720c0a6d44d08241c66dc7)) +- upgrade command select option cannot select @heroui/react pkg ([#78](https://github.com/nextui-org/nextui-cli/issues/78)) ([93e5cdc](https://github.com/nextui-org/nextui-cli/commit/93e5cdc98299ec75d5720c0a6d44d08241c66dc7)) ### Features diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e5c35a3..5cb2df8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,8 @@ -# NextUI CLI Contributing Guide +# HeroUI CLI Contributing Guide -Hello!, I am very excited that you are interested in contributing with Next UI CLI. However, before submitting your contribution, be sure to take a moment and read the following guidelines. +Hello!, I am very excited that you are interested in contributing with HeroUI CLI. However, before submitting your contribution, be sure to take a moment and read the following guidelines. -- [Code of Conduct](https://github.com/nextui-org/nextui-cli/blob/main/CODE_OF_CONDUCT.md) +- [Code of Conduct](https://github.com/frontio-ai/heroui-cli/blob/main/CODE_OF_CONDUCT.md) - [Pull Request Guidelines](#pull-request-guidelines) - [Development Setup](#development-setup) - [Documentation](#documentation) @@ -60,7 +60,7 @@ https://www.conventionalcommits.org/ or check out the ### Steps to PR -1. Fork of the nextui cli repository and clone your fork +1. Fork of the heroui cli repository and clone your fork 2. Create a new branch out of the `main` branch. We follow the convention `[type/scope]`. For example `fix/dropdown-hook` or `docs/menu-typo`. `type` @@ -68,7 +68,7 @@ https://www.conventionalcommits.org/ or check out the commit type. `scope` is just a short id that describes the scope of work. 3. Make and commit your changes following the - [commit convention](https://github.com/nextui-org/nextui-cli/blob/main/CONTRIBUTING.md#commit-convention). + [commit convention](https://github.com/frontio-ai/heroui-cli/blob/main/CONTRIBUTING.md#commit-convention). As you develop, you can run `pnpm lint` and `pnpm build` e.g. `pnpm lint && pnpm build` to make sure everything works as expected. @@ -92,7 +92,7 @@ After cloning the repository, execute the following commands in the root folder: 2. Run dev to start development ```bash - ## Start the dev babel server of NextUI CLI + ## Start the dev babel server of HeroUI CLI pnpm dev ``` @@ -115,7 +115,7 @@ After cloning the repository, execute the following commands in the root folder: ```bash ## make sure pnpm dev is running npm link - ## then run nextui-cli locally and test + ## then run heroui-cli locally and test ``` > Note: ensure your version of Node is 18.17.x or higher to run scripts @@ -136,7 +136,7 @@ After cloning the repository, execute the following commands in the root folder: Please update the docs with any command changes, the code and docs should always be in sync. -The main documentation lives in `https://nextui.org/docs/guide/cli`, please create a PR in `nextui-org/nextui` instead. +The main documentation lives in `https://heroui.com/docs/guide/cli`, please create a PR in `frontio-ai/heroui` instead. ## Breaking changes @@ -144,7 +144,7 @@ Breaking changes should be accompanied with deprecations of removed functionalit ## Becoming a maintainer -If you are interested in becoming a NextUI maintainer, start by +If you are interested in becoming a HeroUI maintainer, start by reviewing issues and pull requests. Answer questions for those in need of troubleshooting. Join us in the [Discord Community](https://discord.gg/9b6yyZKmH4) chat room. @@ -155,7 +155,7 @@ best to be proactive in reaching out to those that are already helping out. GitHub by default does not publicly state that you are a member of the organization. Please feel free to change that setting for yourself so others will know who's helping out. That can be configured on the [organization -list](https://github.com/orgs/nextui-org/people) page. +list](https://github.com/orgs/frontio-ai/people) page. Being a maintainer is not an obligation. You can help when you have time and be less active when you don't. If you get a new job and get busy, that's alright. diff --git a/README.md b/README.md index a929bbd..8bdd955 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,43 @@

- - nextui -

NextUI CLI

+ + heroui (previously nextui) +

HeroUI CLI (Previously NextUI CLI)


- - License + + License - - npm downloads + + npm downloads

-The CLI offers a comprehensive suite of commands to initialize, manage, and improve your NextUI projects. It enables you to `add`, `remove`, or `upgrade` individual components, assess the health of your project, and more. +The CLI offers a comprehensive suite of commands to initialize, manage, and improve your HeroUI projects. It enables you to `add`, `remove`, or `upgrade` individual components, assess the health of your project, and more. ## Quick Start -> **Note**: The NextUI CLI requires [Node.js](https://nodejs.org/en) _18.17.x+_ or later +> **Note**: The HeroUI CLI requires [Node.js](https://nodejs.org/en) _18.17.x+_ or later -You can choose the following ways to start the NextUI CLI. +You can choose the following ways to start the HeroUI CLI. ### Npx ```bash -npx nextui-cli@latest +npx heroui-cli@latest ``` ### Global Installation ```bash -npm install -g nextui-cli +npm install -g heroui-cli ``` ## Usage ```bash -Usage: nextui [command] +Usage: heroui [command] Options: -v, --version Output the current version @@ -60,10 +60,10 @@ Commands: ### Init -Initialize a new NextUI project with official templates. +Initialize a new HeroUI project with official templates. ```bash -nextui init [projectName] [options] +heroui init [projectName] [options] ``` #### Init Options @@ -74,24 +74,24 @@ nextui init [projectName] [options] ##### Example ```bash -# Initialize a new NextUI project with the app template, named my-nextui-app -nextui init my-nextui-app -t app +# Initialize a new HeroUI project with the app template, named my-heroui-app +heroui init my-heroui-app -t app ``` output: ```bash -NextUI CLI v0.2.1 +HeroUI 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.) -โ”‚ โ—‹ Vite (A Vite template pre-configured with NextUI (v2) and Tailwind CSS.) +โ”‚ โ— App (A Next.js 14 with app directory template pre-configured with HeroUI (v2) and Tailwind CSS.) +โ”‚ โ—‹ Pages (A Next.js 14 with pages directory template pre-configured with HeroUI (v2) and Tailwind CSS.) +โ”‚ โ—‹ Vite (A Vite template pre-configured with HeroUI (v2) and Tailwind CSS.) โ”‚ โ—‡ New project name (Enter to skip with default name) -โ”‚ my-nextui-app +โ”‚ my-heroui-app โ”‚ โ—‡ Select a package manager (Enter to select) โ”‚ โ— npm @@ -103,7 +103,7 @@ NextUI CLI v0.2.1 โ”‚ โ—‡ Next steps โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ -โ”‚ cd my-nextui-app โ”‚ +โ”‚ cd my-heroui-app โ”‚ โ”‚ npm install โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ @@ -113,7 +113,7 @@ NextUI CLI v0.2.1 ### Add -Add NextUI components to your project. +Add HeorUI components to your project. #### Features @@ -122,12 +122,12 @@ Add NextUI components to your project. > 3. Detect whether using pnpm, if so, add the required configuration to your `.npmrc` file ```bash -nextui add [components...] [options] +heroui add [components...] [options] ``` #### Add Options -- `-a --all` [boolean] Add all the NextUI components (default: `false`) +- `-a --all` [boolean] Add all the HeroUI components (default: `false`) - `-p --packagePath` [string] The path to the package.json file - `-tw --tailwindPath` [string] The path to the tailwind.config file file - `-app --appPath` [string] The path to the App.tsx file @@ -140,13 +140,13 @@ nextui add [components...] [options] Without setting a specific component, the `add` command will show a list of available components. ```bash -nextui add +heroui add ``` Output: ```bash -NextUI CLI v0.2.1 +HeroUI CLI v0.2.1 ? Which components would you like to add? โ€บ - Space to select. Return to submit Instructions: @@ -172,23 +172,23 @@ Filtered results for: Enter something to filter If you want to add a specific component, you can specify the component name. ```bash -nextui add button +heroui add button ``` Output: ```bash -NextUI CLI v0.2.1 +HeroUI CLI v0.2.1 -Adding the required dependencies: @nextui-org/button +Adding the required dependencies: @heroui/button -pnpm add @nextui-org/button +pnpm add @heroui/button Packages: +1 + Progress: resolved 470, reused 462, downloaded 0, added 0, done dependencies: -+ @nextui-org/button 2.0.24 ++ @heroui/button 2.0.24 Done in 3.4s @@ -199,16 +199,16 @@ Tailwind CSS settings have been updated in: /project-path/tailwind.config.js ### Upgrade -Upgrade the NextUI components to the latest version. +Upgrade the HeroUI components to the latest version. ```bash -nextui upgrade [components...] [options] +heroui upgrade [components...] [options] ``` #### Upgrade Options - `-p --packagePath` [string] The path to the package.json file -- `-a --all` [boolean] Upgrade all the NextUI components (default: `false`) +- `-a --all` [boolean] Upgrade all the HeroUI components (default: `false`) - `-w --write` [boolean] Write the upgrade version to package.json file (default: `false`) - `-b --beta` [boolean] Upgrade beta components (default: `false`) - `-h --help` Display help for command @@ -218,21 +218,21 @@ nextui upgrade [components...] [options] Upgrade the **Button** component to the latest version. ```bash -nextui upgrade button +heroui upgrade button ``` Output: ```bash -NextUI CLI v0.2.1 +HeroUI CLI v0.2.1 โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Component โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ @nextui-org/button ^2.0.11 -> ^2.0.31 โ”‚ +โ”‚ @heroui/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 +Required min version: @heroui/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 โ”‚ +โ”‚ @heroui/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 โ”‚ @@ -243,11 +243,11 @@ Required min version: @nextui-org/theme>=2.1.0, tailwindcss>=3.4.0, react>=18.3. โฏ Yes No -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 +pnpm add @heroui/button@2.0.31 @heroui/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) +- @heroui/theme 2.0.1 ++ @heroui/theme 2.1.0 (2.2.3 is available) + react 18.3.1 + react-dom 18.3.1 @@ -258,18 +258,18 @@ Done in 1.8s ### Remove -Remove NextUI components from your project. +Remove HeroUI components from your project. -> **Note**: If there are no NextUI components after removing, the required content will also be removed +> **Note**: If there are no HeroUI components after removing, the required content will also be removed ```bash -nextui remove [components...] [options] +heroui remove [components...] [options] ``` #### Remove Options - `-p --packagePath` [string] The path to the package.json file -- `-a --all` [boolean] Remove all the NextUI components (default: `false`) +- `-a --all` [boolean] Remove all the HeroUI components (default: `false`) - `-tw --tailwindPath` [string] The path to the tailwind.config file file - `--prettier` [boolean] Add prettier format in the add content which required installed prettier - (default: `false`) @@ -278,36 +278,36 @@ nextui remove [components...] [options] Remove the **Button** component from your project. ```bash -nextui remove button +heroui remove button ``` Output: ```bash -NextUI CLI v0.2.1 +HeroUI CLI v0.2.1 โ—๏ธ Components slated for removal: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ Package โ”‚ Version โ”‚ Status โ”‚ Docs โ”‚ โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ -โ”‚ @nextui-org/button โ”‚ 2.0.27 ๐Ÿš€latest โ”‚ stable โ”‚ https://nextui.org/docs/components/button โ”‚ +โ”‚ @heroui/button โ”‚ 2.0.27 ๐Ÿš€latest โ”‚ stable โ”‚ https://heroui.com/docs/components/button โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ? Confirm removal of these components: โ€บ - Use arrow-keys. Return to submit. โฏ Yes No -pnpm remove @nextui-org/button +pnpm remove @heroui/button Already up to date Progress: resolved 474, reused 465, downloaded 0, added 0, done dependencies: -- @nextui-org/button 2.0.27 +- @heroui/button 2.0.27 Done in 2.1s Remove the removed components tailwind content in file:/project-path/tailwind.config.js -โœ… Successfully removed the specified NextUI components: @nextui-org/button +โœ… Successfully removed the specified HeroUI components: @heroui/button ``` ### List @@ -315,7 +315,7 @@ Remove the removed components tailwind content in file:/project-path/tailwind.co List all the current installed components. ```bash -nextui list [options] +heroui list [options] ``` #### List Options @@ -326,23 +326,23 @@ nextui list [options] ##### Example ```bash -nextui list +heroui list ``` Output: ```bash -NextUI CLI v0.2.1 +HeroUI CLI v0.2.1 Current installed components: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ Package โ”‚ Version โ”‚ Status โ”‚ Docs โ”‚ โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ -โ”‚ @nextui-org/autocomplete โ”‚ 2.0.10 ๐Ÿš€latest โ”‚ stable โ”‚ https://nextui.org/docs/components/autocomplete โ”‚ -โ”‚ @nextui-org/badge โ”‚ 2.0.24 ๐Ÿš€latest โ”‚ stable โ”‚ https://nextui.org/docs/components/badge โ”‚ -โ”‚ @nextui-org/button โ”‚ 2.0.27 ๐Ÿš€latest โ”‚ stable โ”‚ https://nextui.org/docs/components/button โ”‚ -โ”‚ @nextui-org/chip โ”‚ 2.0.25 ๐Ÿš€latest โ”‚ stable โ”‚ https://nextui.org/docs/components/chip โ”‚ +โ”‚ @heroui/autocomplete โ”‚ 2.0.10 ๐Ÿš€latest โ”‚ stable โ”‚ https://heroui.com/docs/components/autocomplete โ”‚ +โ”‚ @heroui/badge โ”‚ 2.0.24 ๐Ÿš€latest โ”‚ stable โ”‚ https://heroui.com/docs/components/badge โ”‚ +โ”‚ @heroui/button โ”‚ 2.0.27 ๐Ÿš€latest โ”‚ stable โ”‚ https://heroui.com/docs/components/button โ”‚ +โ”‚ @heroui/chip โ”‚ 2.0.25 ๐Ÿš€latest โ”‚ stable โ”‚ https://heroui.com/docs/components/chip โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` @@ -351,13 +351,13 @@ Current installed components: Check whether exist problem in your project by using the `doctor` command. ```bash -nextui doctor [options] +heroui doctor [options] ``` ### Features > 1. Check whether have `redundant dependencies` in the project -> 2. Check whether the NextUI components `required dependencies are installed` in the project +> 2. Check whether the HeroUI 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 @@ -374,7 +374,7 @@ nextui doctor [options] #### Example ```bash -nextui doctor +heroui doctor ``` Output: @@ -382,19 +382,19 @@ Output: If there is a problem in your project, the `doctor` command will display the problem information. ```bash -NextUI CLI v0.2.1 +HeroUI CLI v0.2.1 -NextUI CLI: โŒ Your project has 1 issue that require attention +HeroUI CLI: โŒ Your project has 1 issue that require attention โ—๏ธIssue 1: missingTailwind -Missing tailwind.config.(j|t)s file. To set up, visit: https://nextui.org/docs/guide/installation#tailwind-css-setup +Missing tailwind.config.(j|t)s file. To set up, visit: https://heroui.com/docs/guide/installation#tailwind-css-setup ``` Otherwise, the `doctor` command will display the following message. ```bash -NextUI CLI v0.2.1 +HeroUI CLI v0.2.1 โœ… Your project has no detected issues. ``` @@ -404,7 +404,7 @@ NextUI CLI v0.2.1 Display debug information about the local environment. ```bash -nextui env [options] +heroui env [options] ``` #### Env Options @@ -416,23 +416,23 @@ nextui env [options] Display the local environment Information by using the `env` command. ```bash -nextui env +heroui env ``` Output: ```bash -NextUI CLI v0.2.1 +HeroUI CLI v0.2.1 Current installed components: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ Package โ”‚ Version โ”‚ Status โ”‚ Docs โ”‚ โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ -โ”‚ @nextui-org/autocomplete โ”‚ 2.0.10 ๐Ÿš€latest โ”‚ stable โ”‚ https://nextui.org/docs/components/autocomplete โ”‚ -โ”‚ @nextui-org/badge โ”‚ 2.0.24 ๐Ÿš€latest โ”‚ stable โ”‚ https://nextui.org/docs/components/badge โ”‚ -โ”‚ @nextui-org/button โ”‚ 2.0.27 ๐Ÿš€latest โ”‚ stable โ”‚ https://nextui.org/docs/components/button โ”‚ -โ”‚ @nextui-org/chip โ”‚ 2.0.25 ๐Ÿš€latest โ”‚ stable โ”‚ https://nextui.org/docs/components/chip โ”‚ +โ”‚ @heroui/autocomplete โ”‚ 2.0.10 ๐Ÿš€latest โ”‚ stable โ”‚ https://heroui.com/docs/components/autocomplete โ”‚ +โ”‚ @heroui/badge โ”‚ 2.0.24 ๐Ÿš€latest โ”‚ stable โ”‚ https://heroui.com/docs/components/badge โ”‚ +โ”‚ @heroui/button โ”‚ 2.0.27 ๐Ÿš€latest โ”‚ stable โ”‚ https://heroui.com/docs/components/button โ”‚ +โ”‚ @heroui/chip โ”‚ 2.0.25 ๐Ÿš€latest โ”‚ stable โ”‚ https://heroui.com/docs/components/chip โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ Environment Info: @@ -445,24 +445,24 @@ Environment Info: ## Documentation -Visit [https://nextui.org/docs/guide/cli](https://nextui.org/docs/guide/cli) to view the full documentation. +Visit [https://heroui.com/docs/guide/cli](https://heroui.com/docs/guide/cli) to view the full documentation. ### Community -We're excited to see the community adopt NextUI CLI, raise issues, and provide feedback. +We're excited to see the community adopt HeroUI CLI, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved! - [Discord](https://discord.gg/9b6yyZKmH4) -- [Twitter](https://twitter.com/getnextui) -- [GitHub Discussions](https://github.com/nextui-org/nextui-cli/discussions) +- [Twitter](https://twitter.com/hero_ui) +- [GitHub Discussions](https://github.com/frontio-ai/heroui-cli/discussions) ## Contributing Contributions are always welcome! -See [CONTRIBUTING.md](https://github.com/nextui-org/nextui-cli/blob/main/CONTRIBUTING.md) for ways to get started. +See [CONTRIBUTING.md](https://github.com/frontio-ai/heroui-cli/blob/main/CONTRIBUTING.md) for ways to get started. -Please adhere to this project's [CODE_OF_CONDUCT](https://github.com/nextui-org/nextui-cli/blob/main/CODE_OF_CONDUCT.md). +Please adhere to this project's [CODE_OF_CONDUCT](https://github.com/frontio-ai/heroui-cli/blob/main/CODE_OF_CONDUCT.md). ## License diff --git a/package.json b/package.json index 0d53529..105d1e5 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { - "name": "nextui-cli", + "name": "heroui-cli", "private": false, "type": "module", "license": "MIT", "version": "0.5.2", - "homepage": "https://github.com/nextui-org/nextui-cli#readme", - "description": "A CLI tool that unlocks seamless NextUI integration", + "homepage": "https://github.com/frontio-ai/heroui-cli#readme", + "description": "A CLI tool that unlocks seamless HeroUI integration (Previously NextUI CLI)", "keywords": [ "UI", "CLI", @@ -13,19 +13,20 @@ "NextUI", "Template", "Integration", - "Add Component" + "Add Component", + "HeroUI" ], "author": { - "name": "NextUI", - "email": "support@nextui.org", - "url": "https://github.com/nextui-org" + "name": "HeroUI", + "email": "support@heroui.com", + "url": "https://github.com/frontio-ai" }, "repository": { "type": "git", - "url": "https://github.com/nextui-org/nextui-cli.git" + "url": "https://github.com/frontio-ai/heroui-cli.git" }, "bugs": { - "url": "https://github.com/nextui-org/nextui-cli/issues" + "url": "https://github.com/frontio-ai/heroui-cli/issues" }, "publishConfig": { "access": "public", @@ -35,7 +36,7 @@ "dist" ], "bin": { - "nextui": "./dist/index.js" + "heroui": "./dist/index.js" }, "main": "./dist/index.js", "module": "./dist/index.js", @@ -43,7 +44,7 @@ "scripts": { "dev": "tsup --watch", "link:cli": "pnpm link --global", - "link:remove": "pnpm uninstall --global nextui-cli", + "link:remove": "pnpm uninstall --global heroui-cli", "build": "tsup", "update:components": "tsx src/scripts/update/update-components.ts", "sync:docs": "tsx src/scripts/sync/sync.ts", diff --git a/packages/codemod/README.md b/packages/codemod/README.md index a675e41..d34257d 100644 --- a/packages/codemod/README.md +++ b/packages/codemod/README.md @@ -4,6 +4,7 @@

@heroui/codemod

+
The CLI provides a comprehensive suite of tools to migrate your codebase from NextUI to HeroUI. diff --git a/packages/codemod/src/index.ts b/packages/codemod/src/index.ts index 90d8402..fffdded 100644 --- a/packages/codemod/src/index.ts +++ b/packages/codemod/src/index.ts @@ -12,9 +12,9 @@ import {DEBUG} from './helpers/debug'; import {initOptions} from './helpers/options'; import {codemods} from './types'; -const nextui = new Command(); +const heroui = new Command(); -nextui +heroui .name(pkg.name) .usage('[command]') .description(getCommandDescAndLog(`\nHeroUI Codemod v${pkg.version}\n`, pkg.description)) @@ -26,13 +26,13 @@ nextui .option('-f, --format', 'Format the affected files with Prettier') .action(codemodAction); -nextui +heroui .command('migrate') .description('Migrates your codebase to use the heroui') .argument('[projectPath]', 'Path to the project to migrate') .action(migrateAction); -nextui.hook('preAction', async (command) => { +heroui.hook('preAction', async (command) => { const options = (command as SAFE_ANY).rawArgs.slice(2); const debug = options.includes('--debug') || options.includes('-d'); const format = options.includes('--format') || options.includes('-f'); @@ -42,7 +42,7 @@ nextui.hook('preAction', async (command) => { DEBUG.enabled = debug; }); -nextui.parseAsync(process.argv).catch(async (reason) => { +heroui.parseAsync(process.argv).catch(async (reason) => { Logger.newLine(); Logger.error('Unexpected error. Please report it as a bug:'); Logger.log(reason); diff --git a/src/actions/add-action.ts b/src/actions/add-action.ts index ef4e341..a690cea 100644 --- a/src/actions/add-action.ts +++ b/src/actions/add-action.ts @@ -22,7 +22,7 @@ import {findFiles, strip} from '@helpers/utils'; import {resolver} from 'src/constants/path'; import { DOCS_PROVIDER_SETUP, - NEXT_UI, + HERO_UI, individualTailwindRequired, pnpmRequired } from 'src/constants/required'; @@ -53,10 +53,10 @@ export async function addAction(components: string[], options: AddActionOptions) var {allDependencies, allDependenciesKeys, currentComponents} = getPackageInfo(packagePath); const prettier = options.prettier ?? allDependenciesKeys.has('prettier'); - const isNextUIAll = !!allDependencies[NEXT_UI]; + const isHeroUIAll = !!allDependencies[HERO_UI]; if (!components.length && !all) { - const filteredComponents = store.nextUIComponents.filter( + const filteredComponents = store.heroUIComponents.filter( (component) => !currentComponents.some((currentComponent) => currentComponent.name === component.name) ); @@ -77,7 +77,7 @@ export async function addAction(components: string[], options: AddActionOptions) }) ); } else if (all) { - components = [NEXT_UI]; + components = [HERO_UI]; } /** ======================== Add judge whether illegal component exist ======================== */ @@ -85,12 +85,12 @@ export async function addAction(components: string[], options: AddActionOptions) return; } - // Check whether have added the NextUI components + // Check whether have added the HeroUI components var {allDependenciesKeys, currentComponents} = getPackageInfo(packagePath); const currentComponentsKeys = currentComponents.map((c) => c.name); const filterCurrentComponents = components.filter( - (c) => currentComponentsKeys.includes(c) || (isNextUIAll && c === NEXT_UI) + (c) => currentComponentsKeys.includes(c) || (isHeroUIAll && c === HERO_UI) ); if (filterCurrentComponents.length && !getStoreSync('debug')) { @@ -122,7 +122,7 @@ export async function addAction(components: string[], options: AddActionOptions) let [, ...missingDependencies] = await checkRequiredContentInstalled( 'all', allDependenciesKeys, - {allDependencies, beta, packageNames: [NEXT_UI], peerDependencies: true} + {allDependencies, beta, packageNames: [HERO_UI], peerDependencies: true} ); missingDependencies = missingDependencies.map((c) => strip(c)); @@ -142,7 +142,7 @@ export async function addAction(components: string[], options: AddActionOptions) } else { const mergedComponents = beta ? await getBetaComponents(components) - : components.map((c) => store.nextUIComponentsMap[c]!.package); + : components.map((c) => store.heroUIComponentsMap[c]!.package); const [, ..._missingDependencies] = await checkRequiredContentInstalled( 'partial', allDependenciesKeys, @@ -213,9 +213,9 @@ export async function addAction(components: string[], options: AddActionOptions) fixProvider(appPath, {format: prettier}); Logger.newLine(); - Logger.info(`NextUIProvider successfully added to the App file at: ${appPath}`); + Logger.info(`HeroUIProvider successfully added to the App file at: ${appPath}`); Logger.warn( - "Please check the placement of NextUIProvider in the App file to ensure it's correctly integrated.'" + "Please check the placement of HeroUIProvider in the App file to ensure it's correctly integrated.'" ); } } @@ -235,16 +235,16 @@ export async function addAction(components: string[], options: AddActionOptions) } } - // Finish adding the NextUI components + // Finish adding the HeroUI components Logger.newLine(); Logger.success('โœ… Components added successfully'); - // Check whether the user has installed the All NextUI components - if ((allDependenciesKeys.has(NEXT_UI) || all) && currentComponents.length) { + // Check whether the user has installed the All HeroUI components + if ((allDependenciesKeys.has(HERO_UI) || all) && currentComponents.length) { // Check whether have added redundant dependencies Logger.newLine(); Logger.log( - `${chalk.yellow('Attention')} Individual components from NextUI do not require the \`@nextui-org/react\` package. For optimized bundle sizes, consider using individual components.` + `${chalk.yellow('Attention')} Individual components from HeroUI do not require the \`@heroui/react\` package. For optimized bundle sizes, consider using individual components.` ); Logger.log('The redundant dependencies are:'); [...new Set(currentComponents)].forEach((component) => { @@ -252,11 +252,11 @@ export async function addAction(components: string[], options: AddActionOptions) }); } - // Warn the user to check the NextUIProvider whether in the correct place + // Warn the user to check the HeroUIProvider whether in the correct place Logger.newLine(); Logger.grey( `Please check the ${chalk.bold( - 'NextUIProvider' + 'HeroUIProvider' )} whether in the correct place (ignore if added)\nSee more info here: ${DOCS_PROVIDER_SETUP}` ); diff --git a/src/actions/doctor-action.ts b/src/actions/doctor-action.ts index 0496e24..7ba1581 100644 --- a/src/actions/doctor-action.ts +++ b/src/actions/doctor-action.ts @@ -13,7 +13,7 @@ import {Logger, type PrefixLogType} from '@helpers/logger'; import {getPackageInfo} from '@helpers/package'; import {findFiles, strip, transformOption} from '@helpers/utils'; import {resolver} from 'src/constants/path'; -import {DOCS_PNPM_SETUP, DOCS_TAILWINDCSS_SETUP, NEXT_UI} from 'src/constants/required'; +import {DOCS_PNPM_SETUP, DOCS_TAILWINDCSS_SETUP, HERO_UI} from 'src/constants/required'; interface DoctorActionOptions { packagePath?: string; @@ -52,8 +52,8 @@ export async function doctorAction(options: DoctorActionOptions) { Logger.prefix( 'error', `โŒ No ${chalk.underline( - 'NextUI components' - )} found in your project. Please consult the installation guide at: https://nextui.org/docs/guide/installation#global-installation` + 'HeroUI components' + )} found in your project. Please consult the installation guide at: https://heroui.com/docs/guide/installation#global-installation` ); return; @@ -111,7 +111,7 @@ export async function doctorAction(options: DoctorActionOptions) { let [isCorrectInstalled, ...missingDependencies] = await checkRequiredContentInstalled( 'all', allDependenciesKeys, - {allDependencies, packageNames: [NEXT_UI], peerDependencies: true} + {allDependencies, packageNames: [HERO_UI], peerDependencies: true} ); // Check if other allComponents are installed diff --git a/src/actions/init-action.ts b/src/actions/init-action.ts index 2c3e9c0..fe748f8 100644 --- a/src/actions/init-action.ts +++ b/src/actions/init-action.ts @@ -132,17 +132,17 @@ export type GenerateOptions> = [T] extends [never async function getTableInfo(packageName?: string, projectName?: string, template?: string) { const options: GenerateOptions> = [ { - hint: 'A Next.js 14 with app directory template pre-configured with NextUI (v2) and Tailwind CSS.', + hint: 'A Next.js 14 with app directory template pre-configured with HeroUI (v2) and Tailwind CSS.', label: chalk.gray('App'), value: 'app' }, { - hint: 'A Next.js 14 with pages directory template pre-configured with NextUI (v2) and Tailwind CSS.', + hint: 'A Next.js 14 with pages directory template pre-configured with HeroUI (v2) and Tailwind CSS.', label: chalk.gray('Pages'), value: 'pages' }, { - hint: 'A Vite template pre-configured with NextUI (v2) and Tailwind CSS.', + hint: 'A Vite template pre-configured with HeroUI (v2) and Tailwind CSS.', label: chalk.gray('Vite'), value: 'vite' } diff --git a/src/actions/list-action.ts b/src/actions/list-action.ts index 7e3efbf..bd1d4ee 100644 --- a/src/actions/list-action.ts +++ b/src/actions/list-action.ts @@ -3,7 +3,7 @@ import {outputComponents} from '@helpers/output-info'; import {getPackageInfo} from '@helpers/package'; import {store} from 'src/constants/store'; -import {type NextUIComponents} from '../../src/constants/component'; +import {type HeroUIComponents} from '../../src/constants/component'; import {resolver} from '../../src/constants/path'; interface ListActionOptions { @@ -14,7 +14,7 @@ interface ListActionOptions { export async function listAction(options: ListActionOptions) { const {packagePath = resolver('package.json'), remote = false} = options; - let components = store.nextUIComponents as NextUIComponents; + let components = store.heroUIComponents as HeroUIComponents; try { /** ======================== Get the installed components ======================== */ @@ -25,7 +25,7 @@ export async function listAction(options: ListActionOptions) { } if (!components.length) { - Logger.warn(`No NextUI components detected in the specified package.json at: ${packagePath}`); + Logger.warn(`No HeroUI components detected in the specified package.json at: ${packagePath}`); return; } diff --git a/src/actions/remove-action.ts b/src/actions/remove-action.ts index c8ea9e6..c064151 100644 --- a/src/actions/remove-action.ts +++ b/src/actions/remove-action.ts @@ -19,7 +19,7 @@ import {findFiles} from '@helpers/utils'; import {resolver} from 'src/constants/path'; import { DOCS_PROVIDER_SETUP, - NEXT_UI, + HERO_UI, SYSTEM_UI, THEME_UI, pnpmRequired @@ -44,17 +44,17 @@ export async function removeAction(components: string[], options: RemoveOptionsA const packageManager = await detect(); const prettier = options.prettier ?? allDependenciesKeys.has('prettier'); - let isNextUIAll = !!allDependencies[NEXT_UI]; + let isHeroUIAll = !!allDependencies[HERO_UI]; - // If no Installed NextUI components then exit - if (!currentComponents.length && !isNextUIAll) { - Logger.prefix('error', `No NextUI components detected in your package.json at: ${packagePath}`); + // If no Installed HeroUI components then exit + if (!currentComponents.length && !isHeroUIAll) { + Logger.prefix('error', `No HeroUI components detected in your package.json at: ${packagePath}`); return; } - if (all || isNextUIAll) { - components = isNextUIAll ? [NEXT_UI] : currentComponents.map((component) => component.package); + if (all || isHeroUIAll) { + components = isHeroUIAll ? [HERO_UI] : currentComponents.map((component) => component.package); } else if (!components.length) { components = await getAutocompleteMultiselect( 'Select the components to remove', @@ -76,7 +76,7 @@ export async function removeAction(components: string[], options: RemoveOptionsA } // Ask user whether need to remove these components - const filteredComponents = components.includes(NEXT_UI) + const filteredComponents = components.includes(HERO_UI) ? await transformPackageDetail(components, allDependencies) : currentComponents.filter((component) => components.some((c) => c.includes(component.package) || c.includes(component.name)) @@ -113,20 +113,20 @@ export async function removeAction(components: string[], options: RemoveOptionsA // Get the new package information var {allDependencies, currentComponents} = getPackageInfo(packagePath, false); - isNextUIAll = !!allDependencies[NEXT_UI]; + isHeroUIAll = !!allDependencies[HERO_UI]; - const type: SAFE_ANY = isNextUIAll ? 'all' : 'partial'; + const type: SAFE_ANY = isHeroUIAll ? 'all' : 'partial'; removeTailwind(type, { currentComponents, - isNextUIAll, + isHeroUIAll, isPnpm: packageManager === 'pnpm', prettier, tailwindPath: tailwindPath! }); /** ======================== Step 3 Remove the pnpm ======================== */ - if (!currentComponents.length && !isNextUIAll) { + if (!currentComponents.length && !isHeroUIAll) { if (packageManager === 'pnpm') { const npmrcPath = resolver('.npmrc'); @@ -144,14 +144,14 @@ export async function removeAction(components: string[], options: RemoveOptionsA Logger.newLine(); Logger.warn( - `No NextUI components remain installed. Ensure the NextUIProvider is also removed if necessary.\nFor more information, visit: ${DOCS_PROVIDER_SETUP}` + `No HeroUI components remain installed. Ensure the HeroUIProvider is also removed if necessary.\nFor more information, visit: ${DOCS_PROVIDER_SETUP}` ); } Logger.newLine(); Logger.success( - `โœ… Successfully removed the specified NextUI components: ${components + `โœ… Successfully removed the specified HeroUI components: ${components .map((c) => chalk.underline(c)) .join(', ')}` ); diff --git a/src/actions/upgrade-action.ts b/src/actions/upgrade-action.ts index 4136cb2..46d467b 100644 --- a/src/actions/upgrade-action.ts +++ b/src/actions/upgrade-action.ts @@ -13,9 +13,9 @@ import {getPackageInfo} from '@helpers/package'; import {setupPnpm} from '@helpers/setup'; import {upgrade, writeUpgradeVersion} from '@helpers/upgrade'; import {getColorVersion, getPackageManagerInfo, transformPeerVersion} from '@helpers/utils'; -import {type NextUIComponents} from 'src/constants/component'; +import {type HeroUIComponents} from 'src/constants/component'; import {resolver} from 'src/constants/path'; -import {NEXT_UI} from 'src/constants/required'; +import {HERO_UI} from 'src/constants/required'; import {store} from 'src/constants/store'; import {getAutocompleteMultiselect, getMultiselect, getSelect} from 'src/prompts'; import {compareVersions, getLatestVersion} from 'src/scripts/helpers'; @@ -31,7 +31,7 @@ interface UpgradeActionOptions { } type TransformComponent = Required< - AppendKeyValue & {isLatest: boolean} + AppendKeyValue & {isLatest: boolean} >; function betaCompareVersions(version: string, latestVersion: string, beta: boolean) { @@ -62,14 +62,14 @@ export async function upgradeAction(components: string[], options: UpgradeAction const {allDependencies, currentComponents, dependencies, devDependencies, packageJson} = getPackageInfo(packagePath, false); - const isNextUIAll = !!allDependencies[NEXT_UI]; + const isHeroUIAll = !!allDependencies[HERO_UI]; const transformComponents: TransformComponent[] = []; await Promise.all( currentComponents.map(async (component) => { const latestVersion = - store.nextUIComponentsMap[component.name]?.version || + store.heroUIComponentsMap[component.name]?.version || (await getLatestVersion(component.package)); const mergedVersion = beta ? await getBetaVersion(component.package) : latestVersion; const compareResult = betaCompareVersions(component.version, mergedVersion, beta); @@ -82,9 +82,9 @@ export async function upgradeAction(components: string[], options: UpgradeAction }) ); - // If no Installed NextUI components then exit - if (!transformComponents.length && !isNextUIAll) { - Logger.prefix('error', `No NextUI components detected in your package.json at: ${packagePath}`); + // If no Installed HeroUI components then exit + if (!transformComponents.length && !isHeroUIAll) { + Logger.prefix('error', `No HeroUI components detected in your package.json at: ${packagePath}`); return; } @@ -92,22 +92,22 @@ export async function upgradeAction(components: string[], options: UpgradeAction if (all) { components = currentComponents.map((component) => component.package); } else if (!components.length) { - // If have the main nextui then add - if (isNextUIAll) { - const nextuiData = { + // If have the main heroui then add + if (isHeroUIAll) { + const herouiData = { isLatest: - compareVersions(store.latestVersion, transformPeerVersion(allDependencies[NEXT_UI])) <= 0, + compareVersions(store.latestVersion, transformPeerVersion(allDependencies[HERO_UI])) <= 0, latestVersion: store.latestVersion, - package: NEXT_UI, - version: transformPeerVersion(allDependencies[NEXT_UI]) + package: HERO_UI, + version: transformPeerVersion(allDependencies[HERO_UI]) } as TransformComponent; - transformComponents.push(nextuiData); + transformComponents.push(herouiData); } // If all package is latest then pass if (transformComponents.every((component) => component.isLatest)) { - Logger.success('โœ… All NextUI packages are up to date'); + Logger.success('โœ… All HeroUI packages are up to date'); process.exit(0); } @@ -139,8 +139,8 @@ export async function upgradeAction(components: string[], options: UpgradeAction } components = components.map((c) => { - if (store.nextUIComponentsMap[c]?.package) { - return store.nextUIComponentsMap[c]!.package; + if (store.heroUIComponentsMap[c]?.package) { + return store.heroUIComponentsMap[c]!.package; } return c; @@ -152,7 +152,7 @@ export async function upgradeAction(components: string[], options: UpgradeAction let result = await upgrade({ all, allDependencies, - isNextUIAll, + isHeroUIAll, upgradeOptionList }); let ignoreList: string[] = []; diff --git a/src/constants/component.ts b/src/constants/component.ts index 89c06b7..294d748 100644 --- a/src/constants/component.ts +++ b/src/constants/component.ts @@ -2,76 +2,76 @@ import type {Components} from 'src/scripts/helpers'; import {store} from './store'; -export function getNextuiComponentsData(nextUIComponents: Components) { - const nextUIComponentsKeys = nextUIComponents.map((component) => component.name); - const nextUIcomponentsPackages = nextUIComponents.map((component) => component.package); +export function getHerouiComponentsData(heroUIComponents: Components) { + const heroUIComponentsKeys = heroUIComponents.map((component) => component.name); + const heroUIcomponentsPackages = heroUIComponents.map((component) => component.package); - const nextUIComponentsKeysSet = new Set(nextUIComponentsKeys); + const heroUIComponentsKeysSet = new Set(heroUIComponentsKeys); - const nextUIComponentsMap = nextUIComponents.reduce((acc, component) => { + const heroUIComponentsMap = heroUIComponents.reduce((acc, component) => { acc[component.name] = component; return acc; - }, {} as NextUIComponentsMap); - const nextUIComponentsPackageMap = nextUIComponents.reduce((acc, component) => { + }, {} as HeroUIComponentsMap); + const heroUIComponentsPackageMap = heroUIComponents.reduce((acc, component) => { acc[component.package] = component; return acc; - }, {} as NextUIComponentsMap); + }, {} as HeroUIComponentsMap); return { - nextUIComponentsKeys, - nextUIComponentsKeysSet, - nextUIComponentsMap, - nextUIComponentsPackageMap, - nextUIcomponentsPackages + heroUIComponentsKeys, + heroUIComponentsKeysSet, + heroUIComponentsMap, + heroUIComponentsPackageMap, + heroUIcomponentsPackages }; } export function initStoreComponentsData({ beta, - nextUIComponents + heroUIComponents }: { beta: boolean; - nextUIComponents: Components; + heroUIComponents: Components; }) { const { - nextUIComponentsKeys, - nextUIComponentsKeysSet, - nextUIComponentsMap, - nextUIComponentsPackageMap, - nextUIcomponentsPackages - } = getNextuiComponentsData(nextUIComponents); + heroUIComponentsKeys, + heroUIComponentsKeysSet, + heroUIComponentsMap, + heroUIComponentsPackageMap, + heroUIcomponentsPackages + } = getHerouiComponentsData(heroUIComponents); if (beta) { - store.betaNextUIComponents = nextUIComponents; - store.betaNextUIComponentsKeys = nextUIComponentsKeys; - store.betaNextUIComponentsKeysSet = nextUIComponentsKeysSet; - store.betaNextUIComponentsMap = nextUIComponentsMap; - store.betaNextUIComponentsPackageMap = nextUIComponentsPackageMap; - store.betaNextUIcomponentsPackages = nextUIcomponentsPackages; + store.betaHeroUIComponents = heroUIComponents; + store.betaHeroUIIComponentsKeys = heroUIComponentsKeys; + store.betaHeroUIComponentsKeysSet = heroUIComponentsKeysSet; + store.betaHeroUIComponentsMap = heroUIComponentsMap; + store.betaHeroUIComponentsPackageMap = heroUIComponentsPackageMap; + store.betaHeroUIcomponentsPackages = heroUIcomponentsPackages; } else { - store.nextUIComponents = nextUIComponents; - store.nextUIComponentsKeys = nextUIComponentsKeys; - store.nextUIComponentsKeysSet = nextUIComponentsKeysSet; - store.nextUIComponentsMap = nextUIComponentsMap; - store.nextUIComponentsPackageMap = nextUIComponentsPackageMap; - store.nextUIcomponentsPackages = nextUIcomponentsPackages; + store.heroUIComponents = heroUIComponents; + store.heroUIComponentsKeys = heroUIComponentsKeys; + store.heroUIComponentsKeysSet = heroUIComponentsKeysSet; + store.heroUIComponentsMap = heroUIComponentsMap; + store.heroUIComponentsPackageMap = heroUIComponentsPackageMap; + store.heroUIcomponentsPackages = heroUIcomponentsPackages; } } -export type NextUIComponentsMap = Record; +export type HeroUIComponentsMap = Record; -export const orderNextUIComponentKeys = ['package', 'version', 'status', 'docs'] as const; +export const orderHeroUIComponentKeys = ['package', 'version', 'status', 'docs'] as const; -export const colorNextUIComponentKeys = ['package', 'version', 'status']; +export const colorHeroUIComponentKeys = ['package', 'version', 'status']; // eslint-disable-next-line @typescript-eslint/ban-types -export type NextUIComponentStatus = 'stable' | 'updated' | 'new' | (string & {}); +export type HeroUIComponentStatus = 'stable' | 'updated' | 'new' | (string & {}); -export type NextUIComponent = (typeof store.nextUIComponents)[0]; +export type HeroUIComponent = (typeof store.heroUIComponents)[0]; -export type NextUIComponents = (Omit & { - status: NextUIComponentStatus; +export type HeroUIComponents = (Omit & { + status: HeroUIComponentStatus; versionMode: string; })[]; diff --git a/src/constants/components.json b/src/constants/components.json index e68c7e5..00bb605 100644 --- a/src/constants/components.json +++ b/src/constants/components.json @@ -1,720 +1,5 @@ { - "betaComponents": [ - { - "name": "accordion", - "package": "@nextui-org/accordion", - "version": "2.1.0-beta.13", - "docs": "https://nextui.org/docs/components/accordion", - "description": "Collapse display a list of high-level options that can expand/collapse to reveal more information.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "alert", - "package": "@nextui-org/alert", - "version": "2.1.0-beta.14", - "docs": "https://nextui.org/docs/components/alert", - "description": "Alerts are temporary notifications that provide concise feedback about an action or event.", - "status": "new", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "autocomplete", - "package": "@nextui-org/autocomplete", - "version": "2.2.0-beta.17", - "docs": "https://nextui.org/docs/components/autocomplete", - "description": "An autocomplete combines a text input with a listbox, allowing users to filter a list of options to items matching a query.", - "status": "updated", - "style": "", - "peerDependencies": { - "@nextui-org/system": ">=2.3.0-beta.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "avatar", - "package": "@nextui-org/avatar", - "version": "2.1.0-beta.12", - "docs": "https://nextui.org/docs/components/avatar", - "description": "The Avatar component is used to represent a user, and displays the profile picture, initials or fallback icon.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "badge", - "package": "@nextui-org/badge", - "version": "2.1.0-beta.8", - "docs": "https://nextui.org/docs/components/badge", - "description": "Badges are used as a small numerical value or status descriptor for UI elements.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "breadcrumbs", - "package": "@nextui-org/breadcrumbs", - "version": "2.1.0-beta.11", - "docs": "https://nextui.org/docs/components/breadcrumbs", - "description": "Breadcrumbs display a hierarchy of links to the current page or resource in an application.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "button", - "package": "@nextui-org/button", - "version": "2.1.0-beta.10", - "docs": "https://nextui.org/docs/components/button", - "description": "Buttons allow users to perform actions and choose with a single tap.", - "status": "updated", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "calendar", - "package": "@nextui-org/calendar", - "version": "2.1.0-beta.14", - "docs": "https://nextui.org/docs/components/calendar", - "description": "A calendar displays one or more date grids and allows users to select a single date.", - "status": "stable", - "style": "", - "peerDependencies": { - "@nextui-org/system": ">=2.3.0-beta.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "card", - "package": "@nextui-org/card", - "version": "2.1.0-beta.10", - "docs": "https://nextui.org/docs/components/card", - "description": "Card is a container for text, photos, and actions in the context of a single subject.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "checkbox", - "package": "@nextui-org/checkbox", - "version": "2.2.0-beta.9", - "docs": "https://nextui.org/docs/components/checkbox", - "description": "Checkboxes allow users to select multiple items from a list of individual items, or to mark one individual item as selected.", - "status": "updated", - "style": "", - "peerDependencies": { - "@nextui-org/system": ">=2.3.0-beta.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "chip", - "package": "@nextui-org/chip", - "version": "2.1.0-beta.11", - "docs": "https://nextui.org/docs/components/chip", - "description": "Chips help people enter information, make selections, filter content, or trigger actions.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "code", - "package": "@nextui-org/code", - "version": "2.1.0-beta.9", - "docs": "https://nextui.org/docs/components/code", - "description": "Code is a component used to display inline code.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "date-input", - "package": "@nextui-org/date-input", - "version": "2.2.0-beta.9", - "docs": "https://nextui.org/docs/components/date-input", - "description": "A date input allows users to enter and edit date and time values using a keyboard.", - "status": "stable", - "style": "", - "peerDependencies": { - "@nextui-org/system": ">=2.3.0-beta.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "date-picker", - "package": "@nextui-org/date-picker", - "version": "2.2.0-beta.15", - "docs": "https://nextui.org/docs/components/date-picker", - "description": "A date picker combines a DateInput and a Calendar popover to allow users to enter or select a date and time value.", - "status": "stable", - "style": "", - "peerDependencies": { - "@nextui-org/system": ">=2.3.0-beta.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "divider", - "package": "@nextui-org/divider", - "version": "2.1.0-beta.9", - "docs": "https://nextui.org/docs/components/divider", - "description": ". A separator is a visual divider between two groups of content", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "drawer", - "package": "@nextui-org/drawer", - "version": "2.1.0-beta.14", - "docs": "https://nextui.org/docs/components/drawer", - "description": "Used to render a content that slides in from the side of the screen.", - "status": "new", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "dropdown", - "package": "@nextui-org/dropdown", - "version": "2.2.0-beta.14", - "docs": "https://nextui.org/docs/components/dropdown", - "description": "A dropdown displays a list of actions or options that a user can choose.", - "status": "stable", - "style": "", - "peerDependencies": { - "@nextui-org/system": ">=2.3.0-beta.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "form", - "package": "@nextui-org/form", - "version": "2.0.1-beta.1", - "docs": "https://nextui.org/docs/components/form", - "description": "A form is a group of inputs that allows users submit data to a server and supports field validation errors.", - "status": "stable", - "style": "", - "peerDependencies": { - "@nextui-org/system": ">=2.3.0-beta.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "react": ">=18", - "react-dom": ">=18", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "image", - "package": "@nextui-org/image", - "version": "2.1.0-beta.11", - "docs": "https://nextui.org/docs/components/image", - "description": "A simple image component", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "input", - "package": "@nextui-org/input", - "version": "2.3.0-beta.12", - "docs": "https://nextui.org/docs/components/input", - "description": "The input component is designed for capturing user input within a text field.", - "status": "updated", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "input-otp", - "package": "@nextui-org/input-otp", - "version": "2.0.1-beta.0", - "docs": "https://nextui.org/docs/components/input-otp", - "description": "", - "status": "new", - "style": "", - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18", - "@nextui-org/theme": ">=2.3.0-beta.17", - "@nextui-org/system": ">=2.0.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "kbd", - "package": "@nextui-org/kbd", - "version": "2.1.0-beta.9", - "docs": "https://nextui.org/docs/components/kbd", - "description": "The keyboard key components indicates which key or set of keys used to execute a specificv action", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "link", - "package": "@nextui-org/link", - "version": "2.1.0-beta.11", - "docs": "https://nextui.org/docs/components/link", - "description": "Links allow users to click their way from page to page. This component is styled to resemble a hyperlink and semantically renders an <a>", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "listbox", - "package": "@nextui-org/listbox", - "version": "2.2.0-beta.14", - "docs": "https://nextui.org/docs/components/listbox", - "description": "A listbox displays a list of options and allows a user to select one or more of them.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "menu", - "package": "@nextui-org/menu", - "version": "2.1.0-beta.13", - "docs": "https://nextui.org/docs/components/menu", - "description": "A menu displays a list of options and allows a user to select one or more of them.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "modal", - "package": "@nextui-org/modal", - "version": "2.1.0-beta.14", - "docs": "https://nextui.org/docs/components/modal", - "description": "Displays a dialog with a custom content that requires attention or provides additional information.", - "status": "updated", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "navbar", - "package": "@nextui-org/navbar", - "version": "2.1.0-beta.11", - "docs": "https://nextui.org/docs/components/navbar", - "description": "A responsive navigation header positioned on top side of your page that includes support for branding, links, navigation, collapse and more.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "pagination", - "package": "@nextui-org/pagination", - "version": "2.1.0-beta.11", - "docs": "https://nextui.org/docs/components/pagination", - "description": "The Pagination component allows you to display active page and navigate between multiple pages.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "popover", - "package": "@nextui-org/popover", - "version": "2.2.0-beta.12", - "docs": "https://nextui.org/docs/components/popover", - "description": "A popover is an overlay element positioned relative to a trigger.", - "status": "stable", - "style": "", - "peerDependencies": { - "@nextui-org/system": ">=2.3.0-beta.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "progress", - "package": "@nextui-org/progress", - "version": "2.1.0-beta.9", - "docs": "https://nextui.org/docs/components/progress", - "description": "Progress bars show either determinate or indeterminate progress of an operation over time.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "radio", - "package": "@nextui-org/radio", - "version": "2.2.0-beta.9", - "docs": "https://nextui.org/docs/components/radio", - "description": "Radios allow users to select a single option from a list of mutually exclusive options.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "ripple", - "package": "@nextui-org/ripple", - "version": "2.1.0-beta.8", - "docs": "https://nextui.org/docs/components/ripple", - "description": "A simple implementation to display a ripple animation when the source component is clicked", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "scroll-shadow", - "package": "@nextui-org/scroll-shadow", - "version": "2.2.0-beta.8", - "docs": "https://nextui.org/docs/components/scroll-shadow", - "description": "A component that applies top and bottom shadows when content overflows on scroll.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "select", - "package": "@nextui-org/select", - "version": "2.3.0-beta.19", - "docs": "https://nextui.org/docs/components/select", - "description": "A select displays a collapsible list of options and allows a user to select one of them.", - "status": "updated", - "style": "", - "peerDependencies": { - "@nextui-org/system": ">=2.3.0-beta.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "skeleton", - "package": "@nextui-org/skeleton", - "version": "2.1.0-beta.8", - "docs": "https://nextui.org/docs/components/skeleton", - "description": "Skeleton is used to display the loading state of some component.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "slider", - "package": "@nextui-org/slider", - "version": "2.3.0-beta.11", - "docs": "https://nextui.org/docs/components/slider", - "description": "A slider allows a user to select one or more values within a range.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "snippet", - "package": "@nextui-org/snippet", - "version": "2.1.0-beta.13", - "docs": "https://nextui.org/docs/components/snippet", - "description": "Display a snippet of copyable code for the command line.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "spacer", - "package": "@nextui-org/spacer", - "version": "2.1.0-beta.9", - "docs": "https://nextui.org/docs/components/spacer", - "description": "A flexible spacer component designed to create consistent spacing and maintain alignment in your layout.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "spinner", - "package": "@nextui-org/spinner", - "version": "2.1.0-beta.9", - "docs": "https://nextui.org/docs/components/spinner", - "description": "Loaders express an unspecified wait time or display the length of a process.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "switch", - "package": "@nextui-org/switch", - "version": "2.1.0-beta.9", - "docs": "https://nextui.org/docs/components/switch", - "description": "A switch is similar to a checkbox, but represents on/off values as opposed to selection.", - "status": "updated", - "style": "toggle", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "table", - "package": "@nextui-org/table", - "version": "2.1.0-beta.12", - "docs": "https://nextui.org/docs/components/table", - "description": "Tables are used to display tabular data using rows and columns. ", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "tabs", - "package": "@nextui-org/tabs", - "version": "2.1.0-beta.11", - "docs": "https://nextui.org/docs/components/tabs", - "description": "Tabs organize content into multiple sections and allow users to navigate between them.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "tooltip", - "package": "@nextui-org/tooltip", - "version": "2.1.0-beta.11", - "docs": "https://nextui.org/docs/components/tooltip", - "description": "A React Component for rendering dynamically positioned Tooltips", - "status": "stable", - "style": "popover", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - }, - { - "name": "user", - "package": "@nextui-org/user", - "version": "2.1.0-beta.12", - "docs": "https://nextui.org/docs/components/user", - "description": "Flexible User Profile Component.", - "status": "stable", - "style": "", - "peerDependencies": { - "react": ">=18 || >=19.0.0-rc.0", - "react-dom": ">=18 || >=19.0.0-rc.0", - "@nextui-org/theme": ">=2.3.0-beta.0", - "@nextui-org/system": ">=2.3.0-beta.0", - "tailwindcss": ">=3.4.0" - } - } - ], + "betaComponents": [], "betaVersion": "2.5.0-beta.26", "components": [ { diff --git a/src/constants/required.ts b/src/constants/required.ts index bdd237e..b4528b5 100644 --- a/src/constants/required.ts +++ b/src/constants/required.ts @@ -5,44 +5,44 @@ import {join} from 'pathe'; import {getPackageInfo} from '@helpers/package'; -import {type NextUIComponent, type NextUIComponents} from './component'; +import {type HeroUIComponent, type HeroUIComponents} from './component'; import {resolver} from './path'; -export const NEXTUI_CLI = 'nextui-cli'; +export const HEROUI_CLI = 'heroui-cli'; export const FRAMER_MOTION = 'framer-motion'; export const TAILWINDCSS = 'tailwindcss'; -export const NEXT_UI = '@nextui-org/react'; -export const THEME_UI = '@nextui-org/theme'; -export const SYSTEM_UI = '@nextui-org/system'; -export const ALL_COMPONENTS_REQUIRED = [NEXT_UI, FRAMER_MOTION] as const; +export const HERO_UI = '@heroui/react'; +export const THEME_UI = '@heroui/theme'; +export const SYSTEM_UI = '@heroui/system'; +export const ALL_COMPONENTS_REQUIRED = [HERO_UI, FRAMER_MOTION] as const; -export const DOCS_INSTALLED = 'https://nextui.org/docs/guide/installation#global-installation'; +export const DOCS_INSTALLED = 'https://heroui.com/docs/guide/installation#global-installation'; export const DOCS_TAILWINDCSS_SETUP = - 'https://nextui.org/docs/guide/installation#tailwind-css-setup'; -export const DOCS_APP_SETUP = 'https://nextui.org/docs/guide/installation#provider-setup'; -export const DOCS_PNPM_SETUP = 'https://nextui.org/docs/guide/installation#setup-pnpm-optional'; -export const DOCS_PROVIDER_SETUP = 'https://nextui.org/docs/guide/installation#provider-setup'; + 'https://heroui.com/docs/guide/installation#tailwind-css-setup'; +export const DOCS_APP_SETUP = 'https://heroui.com/docs/guide/installation#provider-setup'; +export const DOCS_PNPM_SETUP = 'https://heroui.com/docs/guide/installation#setup-pnpm-optional'; +export const DOCS_PROVIDER_SETUP = 'https://heroui.com/docs/guide/installation#provider-setup'; // Record the required content of tailwind.config file export const tailwindRequired = { - checkPluginsRegex: /nextui(([\W\w]+)?)/, - content: './node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}', + checkPluginsRegex: /heroui(([\W\w]+)?)/, + content: './node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}', darkMode: 'darkMode: "class"', importContent: (isTypescript = false) => { if (isTypescript) { - return `import {nextui} from '@nextui-org/theme';`; + return `import {heroui} from '@heroui/theme';`; } - return `const {nextui} = require('@nextui-org/theme');`; + return `const {heroui} = require('@heroui/theme');`; }, - plugins: 'nextui()' + plugins: 'heroui()' } as const; export const individualTailwindRequired = { - content: (currentComponents: NextUIComponents, isPnpm: boolean) => { + content: (currentComponents: HeroUIComponents, isPnpm: boolean) => { currentComponents.forEach((component) => { - const walkDeps = walkDepComponents(component, isPnpm) as NextUIComponents; + const walkDeps = walkDepComponents(component, isPnpm) as HeroUIComponents; currentComponents.push(...walkDeps); }); @@ -56,7 +56,7 @@ export const individualTailwindRequired = { ]; if (outputComponents.length === 1) { - return `./node_modules/@nextui-org/theme/dist/components/${outputComponents[0]}.js`; + return `./node_modules/@heroui/theme/dist/components/${outputComponents[0]}.js`; } const requiredContent = outputComponents .reduce((acc, component) => { @@ -64,28 +64,28 @@ export const individualTailwindRequired = { }, '') .replace(/\|$/, ''); - return `./node_modules/@nextui-org/theme/dist/components/(${requiredContent}).js`; + return `./node_modules/@heroui/theme/dist/components/(${requiredContent}).js`; }, - plugins: 'nextui()' + plugins: 'heroui()' } as const; export const appRequired = { - import: 'NextUIProvider' + import: 'HeroUIProvider' } as const; export const pnpmRequired = { - content: 'public-hoist-pattern[]=*@nextui-org/*' + content: 'public-hoist-pattern[]=*@heroui/*' } as const; -export function walkDepComponents(nextUIComponent: NextUIComponent, isPnpm: boolean) { - const component = nextUIComponent.name; - let componentPath = resolver(`node_modules/@nextui-org/${component}`); - const components = [nextUIComponent]; +export function walkDepComponents(heroUIComponent: HeroUIComponent, isPnpm: boolean) { + const component = heroUIComponent.name; + let componentPath = resolver(`node_modules/@heroui/${component}`); + const components = [heroUIComponent]; if (!existsSync(componentPath) && isPnpm) { const pnpmDir = resolver('node_modules/.pnpm'); - const file = fg.sync(`**/@nextui-org/${component}`, { + const file = fg.sync(`**/@heroui/${component}`, { absolute: true, cwd: pnpmDir, onlyDirectories: true diff --git a/src/constants/store.ts b/src/constants/store.ts index 6dfd692..da632db 100644 --- a/src/constants/store.ts +++ b/src/constants/store.ts @@ -3,9 +3,9 @@ import type {ExtractStoreData, SAFE_ANY} from '@helpers/type'; import {getBetaVersion} from '@helpers/beta'; import {type Components, getLatestVersion} from 'src/scripts/helpers'; -import {NEXTUI_CLI, NEXT_UI} from './required'; +import {HEROUI_CLI, HERO_UI} from './required'; -export type NextUIComponentsMap = Record; +export type HeroUIComponentsMap = Record; export type Store = { debug: boolean; @@ -14,21 +14,21 @@ export type Store = { latestVersion: string; betaVersion: string; - // NextUI - nextUIComponents: Components; - nextUIComponentsKeys: string[]; - nextUIcomponentsPackages: string[]; - nextUIComponentsKeysSet: Set; - nextUIComponentsMap: NextUIComponentsMap; - nextUIComponentsPackageMap: NextUIComponentsMap; - - // Beta NextUI - betaNextUIComponents: Components; - betaNextUIComponentsKeys: string[]; - betaNextUIcomponentsPackages: string[]; - betaNextUIComponentsKeysSet: Set; - betaNextUIComponentsMap: NextUIComponentsMap; - betaNextUIComponentsPackageMap: NextUIComponentsMap; + // HeroUI + heroUIComponents: Components; + heroUIComponentsKeys: string[]; + heroUIcomponentsPackages: string[]; + heroUIComponentsKeysSet: Set; + heroUIComponentsMap: HeroUIComponentsMap; + heroUIComponentsPackageMap: HeroUIComponentsMap; + + // Beta HeroUI + betaHeroUIComponents: Components; + betaHeroUIIComponentsKeys: string[]; + betaHeroUIcomponentsPackages: string[]; + betaHeroUIComponentsKeysSet: Set; + betaHeroUIComponentsMap: HeroUIComponentsMap; + betaHeroUIComponentsPackageMap: HeroUIComponentsMap; }; /* eslint-disable sort-keys-fix/sort-keys-fix, sort-keys */ @@ -39,19 +39,19 @@ export const store = { latestVersion: '', betaVersion: '', - betaNextUIComponents: [], - betaNextUIComponentsKeys: [], - betaNextUIComponentsKeysSet: new Set(), - betaNextUIComponentsMap: {}, - betaNextUIComponentsPackageMap: {}, - betaNextUIcomponentsPackages: [], - - nextUIComponents: [], - nextUIComponentsKeys: [], - nextUIComponentsKeysSet: new Set(), - nextUIComponentsMap: {}, - nextUIComponentsPackageMap: {}, - nextUIcomponentsPackages: [] + betaHeroUIComponents: [], + betaHeroUIIComponentsKeys: [], + betaHeroUIComponentsKeysSet: new Set(), + betaHeroUIComponentsMap: {}, + betaHeroUIComponentsPackageMap: {}, + betaHeroUIcomponentsPackages: [], + + heroUIComponents: [], + heroUIComponentsKeys: [], + heroUIComponentsKeysSet: new Set(), + heroUIComponentsMap: {}, + heroUIComponentsPackageMap: {}, + heroUIcomponentsPackages: [] } as Store; /* eslint-enable sort-keys-fix/sort-keys-fix, sort-keys */ @@ -64,15 +64,15 @@ export async function getStore( if (!data) { if (key === 'latestVersion') { - data = (await getLatestVersion(NEXT_UI)) as SAFE_ANY; + data = (await getLatestVersion(HERO_UI)) as SAFE_ANY; store[key] = data; } else if (key === 'cliLatestVersion') { - data = (await getLatestVersion(NEXTUI_CLI)) as SAFE_ANY; + data = (await getLatestVersion(HEROUI_CLI)) as SAFE_ANY; store[key] = data; } else if (key === 'betaVersion') { - data = (await getBetaVersion(NEXT_UI)) as SAFE_ANY; + data = (await getBetaVersion(HERO_UI)) as SAFE_ANY; store[key] = data; } diff --git a/src/constants/templates.ts b/src/constants/templates.ts index f90d035..ef06cb2 100644 --- a/src/constants/templates.ts +++ b/src/constants/templates.ts @@ -1,8 +1,8 @@ import type {CheckType} from '@helpers/check'; -export const APP_REPO = 'https://codeload.github.com/nextui-org/next-app-template/tar.gz/main'; -export const PAGES_REPO = 'https://codeload.github.com/nextui-org/next-pages-template/tar.gz/main'; -export const VITE_REPO = 'https://codeload.github.com/nextui-org/vite-template/tar.gz/main'; +export const APP_REPO = 'https://codeload.github.com/frontio-ai/next-app-template/tar.gz/main'; +export const PAGES_REPO = 'https://codeload.github.com/frontio-ai/next-pages-template/tar.gz/main'; +export const VITE_REPO = 'https://codeload.github.com/frontio-ai/vite-template/tar.gz/main'; export const APP_DIR = 'next-app-template-main'; export const PAGES_DIR = 'next-pages-template-main'; @@ -11,29 +11,29 @@ export const VITE_DIR = 'vite-template-main'; export const APP_NAME = 'next-app-template'; export const PAGES_NAME = 'next-pages-template'; export const VITE_NAME = 'vite-template'; -export const DEFAULT_PROJECT_NAME = 'nextui-app'; +export const DEFAULT_PROJECT_NAME = 'heroui-app'; export function tailwindTemplate(type: 'all', content?: string): string; export function tailwindTemplate(type: 'partial', content: string): string; export function tailwindTemplate(type: CheckType, content?: string) { if (type === 'all') { return `// tailwind.config.js -const {nextui} = require("@nextui-org/react"); +const {heroui} = require("@heroui/react"); /** @type {import('tailwindcss').Config} */ module.exports = { content: [ - "./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}", + "./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}", ], theme: { extend: {}, }, darkMode: "class", - plugins: [nextui()], + plugins: [heroui()], };`; } else { return `// tailwind.config.js -const {nextui} = require("@nextui-org/theme"); +const {heroui} = require("@heroui/theme"); /** @type {import('tailwindcss').Config} */ module.exports = { @@ -44,7 +44,7 @@ module.exports = { extend: {}, }, darkMode: "class", - plugins: [nextui()], + plugins: [heroui()], };`; } } diff --git a/src/helpers/beta.ts b/src/helpers/beta.ts index c5c5adb..99921e3 100644 --- a/src/helpers/beta.ts +++ b/src/helpers/beta.ts @@ -13,12 +13,12 @@ export async function getBetaVersionData(component: string) { } export function getPrefixComponent(component: string) { - return `@nextui-org/${component.replace('@nextui-org/', '')}`; + return `@heroui/${component.replace('@heroui/', '')}`; } export async function getBetaVersion(componentName: string) { - if (store.betaNextUIComponentsPackageMap[componentName]) { - return store.betaNextUIComponentsPackageMap[componentName]!.version; + if (store.betaHeroUIComponentsPackageMap[componentName]) { + return store.betaHeroUIComponentsPackageMap[componentName]!.version; } const data = await getBetaVersionData(componentName); @@ -35,7 +35,7 @@ export async function getBetaVersion(componentName: string) { * @example Input: ["drawer"] * * Return: - * ["@nextui-org/drawer@beta"] + * ["@heroui/drawer@beta"] */ export async function getBetaComponents(components: string[]) { const componentsVersionList = await Promise.all( diff --git a/src/helpers/check.ts b/src/helpers/check.ts index 74031eb..c7b7aa6 100644 --- a/src/helpers/check.ts +++ b/src/helpers/check.ts @@ -5,12 +5,12 @@ import {readFileSync} from 'node:fs'; import chalk from 'chalk'; -import {type NextUIComponents} from 'src/constants/component'; +import {type HeroUIComponents} from 'src/constants/component'; import { DOCS_INSTALLED, DOCS_TAILWINDCSS_SETUP, FRAMER_MOTION, - NEXT_UI, + HERO_UI, SYSTEM_UI, TAILWINDCSS, THEME_UI, @@ -111,7 +111,7 @@ interface CheckPeerDependenciesConfig { /** * Check if the required content is installed - * @example return result and missing required [false, '@nextui-org/react', 'framer-motion'] + * @example return result and missing required [false, '@heroui/react', 'framer-motion'] * @param type * @param dependenciesKeys * @param checkPeerDependenciesConfig @@ -140,14 +140,14 @@ export async function checkRequiredContentInstalled< } if (type === 'all') { - const hasAllComponents = dependenciesKeys.has(NEXT_UI); + const hasAllComponents = dependenciesKeys.has(HERO_UI); const hasFramerMotion = dependenciesKeys.has(FRAMER_MOTION); const hasTailwind = dependenciesKeys.has(TAILWINDCSS); if (hasAllComponents && hasFramerMotion && !peerDependenciesList.length) { return [true]; } - !hasAllComponents && result.push(beta ? `${NEXT_UI}@${store.betaVersion}` : NEXT_UI); + !hasAllComponents && result.push(beta ? `${HERO_UI}@${store.betaVersion}` : HERO_UI); !hasFramerMotion && result.push(FRAMER_MOTION); !hasTailwind && result.push(TAILWINDCSS); } else if (type === 'partial') { @@ -214,7 +214,7 @@ export async function checkPeerDependencies( export function checkTailwind( type: 'all', tailwindPath: string, - currentComponents?: NextUIComponents, + currentComponents?: HeroUIComponents, isPnpm?: boolean, content?: string, logWarning?: boolean @@ -222,7 +222,7 @@ export function checkTailwind( export function checkTailwind( type: 'partial', tailwindPath: string, - currentComponents: NextUIComponents, + currentComponents: HeroUIComponents, isPnpm: boolean, content?: string, logWarning?: boolean @@ -230,7 +230,7 @@ export function checkTailwind( export function checkTailwind( type: CheckType, tailwindPath: string, - currentComponents?: NextUIComponents, + currentComponents?: HeroUIComponents, isPnpm?: boolean, content?: string, logWarning?: boolean @@ -247,7 +247,7 @@ export function checkTailwind( const pluginsMatch = getMatchArray('plugins', tailwindContent); if (type === 'all') { - // Check if the required content is added Detail: https://nextui.org/docs/guide/installation#global-installation + // Check if the required content is added Detail: https://heroui.com/docs/guide/installation#global-installation const darkMatch = getMatchArray('darkMode', tailwindContent); // Some tailwind.config.js use darkMode: 'class' not darkMode: ['class'] const isDarkModeCorrect = @@ -283,7 +283,7 @@ export function checkTailwind( if (logWarning && isHaveAllContent) { Logger.log( - `\n${chalk.yellow('Attention')} Individual components from NextUI do not require the "${chalk.bold( + `\n${chalk.yellow('Attention')} Individual components from HeroUI do not require the "${chalk.bold( tailwindRequired.content )}" in the tailwind config\nFor optimized bundle sizes, consider using "${chalk.bold( individualContent @@ -356,8 +356,8 @@ export async function checkIllegalComponents( const illegalList: [string, null | string][] = []; for (const component of components) { - if (!store.nextUIComponentsKeysSet.has(component)) { - const matchComponent = findMostMatchText(store.nextUIComponentsKeys, component); + if (!store.heroUIComponentsKeysSet.has(component)) { + const matchComponent = findMostMatchText(store.heroUIComponentsKeys, component); illegalList.push([component, matchComponent]); } diff --git a/src/helpers/debug.ts b/src/helpers/debug.ts index a0784ab..05f3297 100644 --- a/src/helpers/debug.ts +++ b/src/helpers/debug.ts @@ -23,7 +23,7 @@ export function debugAddedPkg(components: string[], packagePath: string) { const {dependencies, packageJson} = getPackageInfo(packagePath); for (const component of components) { - const compData = store.nextUIComponentsMap[component]; + const compData = store.heroUIComponentsMap[component]; if (!compData) continue; @@ -49,7 +49,7 @@ export function debugRemovedPkg(components: string[], packagePath: string) { const {dependencies, packageJson} = getPackageInfo(packagePath); for (const component of components) { - const compData = store.nextUIComponentsMap[component]; + const compData = store.heroUIComponentsMap[component]; if (!compData) continue; delete dependencies[compData.package]; diff --git a/src/helpers/fix.ts b/src/helpers/fix.ts index d313a56..958478e 100644 --- a/src/helpers/fix.ts +++ b/src/helpers/fix.ts @@ -25,21 +25,21 @@ export function fixProvider(appPath: string, options: FixProvider) { const {format = false, write = true} = options; let appContent = readFileSync(appPath, 'utf-8'); - appContent = `import {NextUIProvider} from "@nextui-org/react";\n${appContent}`; + appContent = `import {HeroUIProvider} from "@heroui/react";\n${appContent}`; - appContent = wrapWithNextUIProvider(appContent); + appContent = wrapWithHeroUIProvider(appContent); write && writeFileSync(appPath, appContent, 'utf-8'); format && execSync(`npx prettier --write ${appPath}`, {stdio: 'ignore'}); } -function wrapWithNextUIProvider(content: string) { +function wrapWithHeroUIProvider(content: string) { const returnRegex = /return\s*\(([\S\s]*?)\);/g; const wrappedCode = content.replace(returnRegex, (_, p1) => { return `return ( - + ${p1.trim()} - + );`; }); @@ -66,7 +66,7 @@ export function fixTailwind(type: CheckType, options: FixTailwind) { if (allPublic) continue; - contentMatch = contentMatch.filter((content) => !content.includes('@nextui-org/theme/dist/')); + contentMatch = contentMatch.filter((content) => !content.includes('@heroui/theme/dist/')); contentMatch.push(info); tailwindContent = replaceMatchArray( 'content', diff --git a/src/helpers/logger.ts b/src/helpers/logger.ts index 0501b17..7329e46 100644 --- a/src/helpers/logger.ts +++ b/src/helpers/logger.ts @@ -9,7 +9,7 @@ export const defaultColors = ['#F54180', '#338EF7'] as const; export const gradientString = _gradientString(...defaultColors); -const logPrefix = gradientString('NextUI CLI:'); +const logPrefix = gradientString('HeroUI CLI:'); export type PrefixLogType = Extract< keyof typeof Logger, diff --git a/src/helpers/output-info.ts b/src/helpers/output-info.ts index 05f9b0b..b6cdd31 100644 --- a/src/helpers/output-info.ts +++ b/src/helpers/output-info.ts @@ -4,10 +4,10 @@ import chalk from 'chalk'; import {boxRound} from 'src/constants/box'; import { - type NextUIComponent, - type NextUIComponents, - colorNextUIComponentKeys, - orderNextUIComponentKeys + type HeroUIComponent, + type HeroUIComponents, + colorHeroUIComponentKeys, + orderHeroUIComponentKeys } from 'src/constants/component'; import {Logger} from './logger'; @@ -35,7 +35,7 @@ export function outputComponents({ message = 'Current installed components:\n', warnError = true }: { - components: NextUIComponents; + components: HeroUIComponents; commandName?: CommandName; warnError?: boolean; message?: string; @@ -48,7 +48,7 @@ export function outputComponents({ return; } - const componentKeyLengthMap: Record = { + const componentKeyLengthMap: Record = { description: 0, docs: 0, name: 0, @@ -91,7 +91,7 @@ export function outputComponents({ let transformComponentsOutput = components.reduce((acc, component) => { let outputData = padStart; - for (const key of orderNextUIComponentKeys) { + for (const key of orderHeroUIComponentKeys) { let value = fillAnsiLength(component[key], componentKeyLengthMap[key]); /** ======================== Replace version to new version ======================== */ @@ -119,7 +119,7 @@ export function outputComponents({ } /** ======================== Change the color according to different status ======================== */ - if (component.status === 'stable' && colorNextUIComponentKeys.includes(key)) { + if (component.status === 'stable' && colorHeroUIComponentKeys.includes(key)) { value = chalk.greenBright(value); } else if (component.status === 'new') { value = chalk.magentaBright(value); @@ -142,7 +142,7 @@ export function outputComponents({ let boxHeaderSec = padStart; let boxHeaderTrd = rounded.vertical + padStart.replace(/.*/g, rounded.horizontal).slice(1); - for (const key of orderNextUIComponentKeys) { + for (const key of orderHeroUIComponentKeys) { boxHeader += `${rounded.horizontal.padEnd(componentKeyLengthMap[key] + 7, rounded.horizontal)}`; boxHeaderSec += chalk.redBright(PasCalCase(key).padEnd(componentKeyLengthMap[key])) + padEnd; boxHeaderTrd += `${rounded.horizontal.padEnd( @@ -157,7 +157,7 @@ export function outputComponents({ /** ======================== Generate box footer ======================== */ let boxFooter = rounded.bottomLeft + padStart.replace(/.*/g, rounded.horizontal).slice(1); - for (const key of orderNextUIComponentKeys) { + for (const key of orderHeroUIComponentKeys) { boxFooter += `${rounded.horizontal.padEnd(componentKeyLengthMap[key] + 7, rounded.horizontal)}`; } diff --git a/src/helpers/package.ts b/src/helpers/package.ts index 3e9219e..e4c7f98 100644 --- a/src/helpers/package.ts +++ b/src/helpers/package.ts @@ -2,8 +2,8 @@ import type {UpgradeOption} from './upgrade'; import {readFileSync} from 'node:fs'; -import {type NextUIComponents} from 'src/constants/component'; -import {NEXT_UI} from 'src/constants/required'; +import {type HeroUIComponents} from 'src/constants/component'; +import {HERO_UI} from 'src/constants/required'; import {store} from 'src/constants/store'; import {getCacheExecData} from 'src/scripts/cache/cache'; import {getLatestVersion} from 'src/scripts/helpers'; @@ -31,7 +31,7 @@ export function getPackageInfo(packagePath: string, transformVersion = true) { const allDependencies = {...devDependencies, ...dependencies}; const allDependenciesKeys = new Set(Object.keys(allDependencies)); - const currentComponents = (store.nextUIComponents as unknown as NextUIComponents) + const currentComponents = (store.heroUIComponents as unknown as HeroUIComponents) .map((component) => { let version = component.version; let versionMode = component.versionMode; @@ -49,8 +49,8 @@ export function getPackageInfo(packagePath: string, transformVersion = true) { versionMode }; }) - .filter((component) => allDependenciesKeys.has(component.package)) as NextUIComponents; - const isAllComponents = allDependenciesKeys.has(NEXT_UI); + .filter((component) => allDependenciesKeys.has(component.package)) as HeroUIComponents; + const isAllComponents = allDependenciesKeys.has(HERO_UI); return { allDependencies, @@ -65,8 +65,8 @@ export function getPackageInfo(packagePath: string, transformVersion = true) { export function transformComponentsToPackage(components: string[]) { return components.map((component) => { - const nextuiComponent = store.nextUIComponentsMap[component]; - const packageName = nextuiComponent?.package; + const herouiComponent = store.heroUIComponentsMap[component]; + const packageName = herouiComponent?.package; return packageName ? packageName : component; }); @@ -82,8 +82,8 @@ export async function transformPackageDetail( components: string[], allDependencies: Record, transformVersion = true -): Promise { - const result: NextUIComponents = []; +): Promise { + const result: HeroUIComponents = []; for (const component of components) { let {currentVersion} = getVersionAndMode(allDependencies, component); @@ -95,11 +95,11 @@ export async function transformPackageDetail( ((await getCacheExecData(`npm show ${component} description`)) || '') as string ).replace(/\n/, ''); const latestVersion = - store.nextUIComponentsPackageMap[component]?.version || (await getLatestVersion(component)); + store.heroUIComponentsPackageMap[component]?.version || (await getLatestVersion(component)); currentVersion = transformVersion ? `${currentVersion} new: ${latestVersion}` : currentVersion; - const detailPackageInfo: NextUIComponents[0] = { + const detailPackageInfo: HeroUIComponents[0] = { description: description || '', docs: docs || '', name: component, diff --git a/src/helpers/remove.ts b/src/helpers/remove.ts index fdc95c6..6c0a707 100644 --- a/src/helpers/remove.ts +++ b/src/helpers/remove.ts @@ -1,5 +1,5 @@ import type {Agent} from './detect'; -import type {NextUIComponents} from 'src/constants/component'; +import type {HeroUIComponents} from 'src/constants/component'; import {existsSync, readFileSync, writeFileSync} from 'node:fs'; @@ -24,13 +24,13 @@ export async function removeTailwind( type: CheckType, options: { tailwindPath?: string; - currentComponents: NextUIComponents; + currentComponents: HeroUIComponents; isPnpm: boolean; prettier: boolean; - isNextUIAll: boolean; + isHeroUIAll: boolean; } ) { - const {currentComponents, isNextUIAll, isPnpm, prettier, tailwindPath} = options; + const {currentComponents, isHeroUIAll, isPnpm, prettier, tailwindPath} = options; if (tailwindPath && !existsSync(tailwindPath)) { Logger.prefix('warn', `No tailwind.config.(j|t)s found remove action skipped`); @@ -44,42 +44,42 @@ export async function removeTailwind( const insIncludeAll = contentMatch.some((c) => c.includes(tailwindRequired.content)); - // Not installed NextUI components then remove the tailwind content about nextui - if (!currentComponents.length && !isNextUIAll) { - const index = pluginsMatch.findIndex((c) => c.includes('nextui')); + // Not installed HeroUI components then remove the tailwind content about heroui + if (!currentComponents.length && !isHeroUIAll) { + const index = pluginsMatch.findIndex((c) => c.includes('heroui')); index !== -1 && pluginsMatch.splice(index, 1); tailwindContent = replaceMatchArray('plugins', tailwindContent, pluginsMatch); - // Remove the import nextui content - tailwindContent = tailwindContent.replace(/(const|var|let|import)[\W\w]+?nextui.*?;\n/, ''); + // Remove the import heroui content + tailwindContent = tailwindContent.replace(/(const|var|let|import)[\W\w]+?heroui.*?;\n/, ''); } - // If there are already have all nextui content include then don't need to remove the content + // If there are already have all heroui content include then don't need to remove the content if (!insIncludeAll) { - // Remove the nextui content - while (contentMatch.some((c) => c.includes('nextui'))) { + // Remove the heroui content + while (contentMatch.some((c) => c.includes('heroui'))) { contentMatch.splice( - contentMatch.findIndex((c) => c.includes('nextui')), + contentMatch.findIndex((c) => c.includes('heroui')), 1 ); } tailwindContent = replaceMatchArray('content', tailwindContent, contentMatch); } - // if (!currentComponents.length && isNextUIAll) { - // const index = contentMatch.findIndex(c => c.includes('nextui')); + // if (!currentComponents.length && isHeroUIAll) { + // const index = contentMatch.findIndex(c => c.includes('heroui')); - // // Remove the nextui content + // // Remove the heroui content // index !== -1 && // contentMatch.splice( - // contentMatch.indexOf('./node_modules/@nextui-org/theme/dist/components'), + // contentMatch.indexOf('./node_modules/@heroui/theme/dist/components'), // 1 // ); // tailwindContent = replaceMatchArray('content', tailwindContent, contentMatch); - // } else if (!isNextUIAll && currentComponents.length) { + // } else if (!isHeroUIAll && currentComponents.length) { // const index = contentMatch.indexOf(tailwindRequired.content); - // // Remove the nextui content + // // Remove the heroui content // index !== -1 && contentMatch.splice(index, 1); // tailwindContent = replaceMatchArray('content', tailwindContent, contentMatch); // } diff --git a/src/helpers/type.ts b/src/helpers/type.ts index cf73fff..60aa6dc 100644 --- a/src/helpers/type.ts +++ b/src/helpers/type.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import type {NextUIComponentsMap, StoreKeys} from 'src/constants/store'; +import type {HeroUIComponentsMap, StoreKeys} from 'src/constants/store'; import type {Components} from 'src/scripts/helpers'; /** @@ -84,16 +84,16 @@ export type ChalkColor = export type ExtractStoreData = T extends 'latestVersion' | 'cliLatestVersion' ? string - : T extends 'nextUIComponents' + : T extends 'heroUIComponents' ? Components - : T extends 'nextUIComponentsKeys' | 'nextUIcomponentsPackages' + : T extends 'heroUIComponentsKeys' | 'heroUIcomponentsPackages' ? string[] - : T extends 'nextUIComponentsKeysSet' + : T extends 'heroUIComponentsKeysSet' ? Set - : T extends 'nextUIComponentsMap' - ? NextUIComponentsMap - : T extends 'nextUIComponentsPackageMap' - ? NextUIComponentsMap + : T extends 'heroUIComponentsMap' + ? HeroUIComponentsMap + : T extends 'heroUIComponentsPackageMap' + ? HeroUIComponentsMap : never; /** diff --git a/src/helpers/upgrade.ts b/src/helpers/upgrade.ts index 83f2955..8ab6730 100644 --- a/src/helpers/upgrade.ts +++ b/src/helpers/upgrade.ts @@ -2,7 +2,7 @@ import type {RequiredKey, SAFE_ANY} from './type'; import chalk from 'chalk'; -import {NEXT_UI, THEME_UI} from 'src/constants/required'; +import {HERO_UI, THEME_UI} from 'src/constants/required'; import {store} from 'src/constants/store'; import {getCacheExecData} from 'src/scripts/cache/cache'; import {type Dependencies, compareVersions, getLatestVersion} from 'src/scripts/helpers'; @@ -34,13 +34,13 @@ const DEFAULT_SPACE = ''.padEnd(7); const MISSING = 'Missing'; interface Upgrade { - isNextUIAll: boolean; + isHeroUIAll: boolean; allDependencies?: Record; upgradeOptionList?: UpgradeOption[]; all?: boolean; } -type ExtractUpgrade = T extends {isNextUIAll: infer U} +type ExtractUpgrade = T extends {isHeroUIAll: infer U} ? U extends true ? RequiredKey : RequiredKey @@ -52,11 +52,11 @@ type MissingDepSetType = { }; export async function upgrade(options: ExtractUpgrade) { - const {all, allDependencies, isNextUIAll, upgradeOptionList} = options as Required; + const {all, allDependencies, isHeroUIAll, upgradeOptionList} = options as Required; let result: UpgradeOption[] = []; const missingDepSet = new Set(); - const allOutputData = await getAllOutputData(all, isNextUIAll, allDependencies, missingDepSet); + const allOutputData = await getAllOutputData(all, isHeroUIAll, allDependencies, missingDepSet); const transformUpgradeOptionList = upgradeOptionList.map((c) => ({ ...c, @@ -259,11 +259,11 @@ function outputDependencies(outputList: UpgradeOption[], peerDepList: UpgradeOpt */ export async function getAllOutputData( all: boolean, - isNextUIAll: boolean, + isHeroUIAll: boolean, allDependencies: Record, missingDepSet: Set ) { - if (!all || !isNextUIAll) { + if (!all || !isHeroUIAll) { return { allOutputList: [], allPeerDepList: [] @@ -272,23 +272,23 @@ export async function getAllOutputData( const latestVersion = store.latestVersion; - const {currentVersion, versionMode} = getVersionAndMode(allDependencies, NEXT_UI); + const {currentVersion, versionMode} = getVersionAndMode(allDependencies, HERO_UI); const colorVersion = getColorVersion(currentVersion, latestVersion); const isLatest = compareVersions(currentVersion, latestVersion) >= 0; - const nextUIPeerDepList = await getPackagePeerDep(NEXT_UI, allDependencies, missingDepSet); - const nextUIThemePeerDepList = await getPackagePeerDep(THEME_UI, allDependencies, missingDepSet); + const heroUIPeerDepList = await getPackagePeerDep(HERO_UI, allDependencies, missingDepSet); + const heroUIThemePeerDepList = await getPackagePeerDep(THEME_UI, allDependencies, missingDepSet); const allOutputList = [ { isLatest, latestVersion: colorVersion, - package: NEXT_UI, + package: HERO_UI, version: currentVersion, versionMode } ]; - const allPeerDepList = [...nextUIPeerDepList, ...nextUIThemePeerDepList]; + const allPeerDepList = [...heroUIPeerDepList, ...heroUIThemePeerDepList]; const allOutputData = { allOutputList, allPeerDepList diff --git a/src/index.ts b/src/index.ts index 4f76ce6..1868ac3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,12 +24,12 @@ import {compareVersions, getComponents} from './scripts/helpers'; const commandList: CommandName[] = ['add', 'env', 'init', 'list', 'upgrade', 'doctor', 'remove']; -const nextui = new Command(); +const heroui = new Command(); -nextui - .name('nextui') +heroui + .name('heroui') .usage('[command]') - .description(getCommandDescAndLog(`\nNextUI CLI v${pkg.version}\n`, '')) + .description(getCommandDescAndLog(`\nHeroUI CLI v${pkg.version}\n`, '')) .version(pkg.version, '-v, --version', 'Output the current version') .helpOption('-h, --help', 'Display help for command') .allowUnknownOption() @@ -60,11 +60,11 @@ nextui } if (!isArgs) { - const helpInfo = (await getCacheExecData('nextui --help')) as string; + const helpInfo = (await getCacheExecData('heroui --help')) as string; let helpInfoArr = helpInfo.split('\n'); - helpInfoArr = helpInfoArr.filter((info) => info && !info.includes('NextUI CLI v')); + helpInfoArr = helpInfoArr.filter((info) => info && !info.includes('HeroUI CLI v')); // Add command name color helpInfoArr = helpInfoArr.map((info) => { const command = info.match(/(\w+)\s\[/)?.[1]; @@ -81,7 +81,7 @@ nextui process.exit(0); }); -nextui +heroui .command('init') .description('Initializes a new project') .argument('[projectName]', 'Name of the project to initialize') @@ -89,7 +89,7 @@ nextui .option('-p --package [string]', 'The package manager to use for the new project', 'npm') .action(initAction); -nextui +heroui .command('add') .description('Adds components to your project') .argument('[components...]', 'Names of components to add') @@ -102,7 +102,7 @@ nextui .option('-b --beta [boolean]', 'Add beta components', false) .action(addAction); -nextui +heroui .command('upgrade') .description('Upgrades project components to the latest versions') .argument('[components...]', 'Names of components to upgrade') @@ -112,7 +112,7 @@ nextui .option('-b --beta [boolean]', 'Upgrade beta components', false) .action(upgradeAction); -nextui +heroui .command('remove') .description('Removes components from the project') .argument('[components...]', 'Names of components to remove') @@ -122,19 +122,19 @@ nextui .option('--prettier [boolean]', 'Apply Prettier formatting to the added content') .action(removeAction); -nextui +heroui .command('list') .description('Lists all components, showing status, descriptions, and versions') .option('-p --packagePath [string]', 'Specify the path to the package.json file') .option('-r --remote', 'List all components available remotely') .action(listAction); -nextui +heroui .command('env') .description('Displays debugging information for the local environment') .option('-p --packagePath [string]', 'Specify the path to the package.json file') .action(envAction); -nextui +heroui .command('doctor') .description('Checks for issues in the project') .option('-p --packagePath [string]', 'Specify the path to the package.json file') @@ -145,7 +145,7 @@ nextui .option('-cp --checkPnpm [boolean]', 'Check for Pnpm', true) .action(doctorAction); -nextui.hook('preAction', async (command) => { +heroui.hook('preAction', async (command) => { const args = command.args?.[0]; const options = (command as SAFE_ANY).rawArgs.slice(2); const noCache = options.includes('--no-cache'); @@ -160,11 +160,11 @@ nextui.hook('preAction', async (command) => { if (args && commandList.includes(args as CommandName)) { // Before run the command init the components.json - const nextUIComponents = (await getComponents()).components; - const nextUIComponentsBeta = (await getComponents()).betaComponents; + const heroUIComponents = (await getComponents()).components; + const heroUIComponentsBeta = (await getComponents()).betaComponents; - initStoreComponentsData({beta: false, nextUIComponents}); - store.beta && initStoreComponentsData({beta: true, nextUIComponents: nextUIComponentsBeta}); + initStoreComponentsData({beta: false, heroUIComponents: heroUIComponents}); + store.beta && initStoreComponentsData({beta: true, heroUIComponents: heroUIComponentsBeta}); } const [cliLatestVersion, latestVersion] = await Promise.all([ @@ -176,7 +176,7 @@ nextui.hook('preAction', async (command) => { store.latestVersion = latestVersion; store.cliLatestVersion = cliLatestVersion; - // Add NextUI CLI version check preAction + // Add HeroUI CLI version check preAction const currentVersion = pkg.version; if (compareVersions(currentVersion, cliLatestVersion) === -1) { @@ -188,12 +188,12 @@ nextui.hook('preAction', async (command) => { `Available upgrade: v${currentVersion} -> ${chalk.greenBright( `v${cliLatestVersion}` )}\nRun \`${chalk.cyan( - 'npm install -g nextui-cli@latest' + 'npm install -g heroui-cli@latest' )}\` to upgrade\nChangelog: ${chalk.underline( - 'https://github.com/nextui-org/nextui-cli/releases' + 'https://github.com/frontio-ai/heroui-cli/releases' )}` )}`, - title: gradientString('NextUI CLI') + title: gradientString('HeroUI CLI') }); Logger.newLine(); } @@ -201,7 +201,7 @@ nextui.hook('preAction', async (command) => { outputDeprecatedInfo(); }); -nextui.parseAsync(process.argv).catch(async (reason) => { +heroui.parseAsync(process.argv).catch(async (reason) => { Logger.newLine(); Logger.error('Unexpected error. Please report it as a bug:'); Logger.log(reason); diff --git a/src/scripts/helpers.ts b/src/scripts/helpers.ts index d49d4ec..8750f71 100644 --- a/src/scripts/helpers.ts +++ b/src/scripts/helpers.ts @@ -129,8 +129,8 @@ export async function oraExecCmd(cmd: string, text?: string): Promise } export async function getLatestVersion(packageName: string): Promise { - if (store.nextUIComponentsPackageMap[packageName]) { - return store.nextUIComponentsPackageMap[packageName]!.version; + if (store.heroUIComponentsPackageMap[packageName]) { + return store.heroUIComponentsPackageMap[packageName]!.version; } const result = await getPackageVersion(packageName); @@ -139,7 +139,7 @@ export async function getLatestVersion(packageName: string): Promise { } const getUnpkgUrl = (version: string) => - `https://unpkg.com/@nextui-org/react@${version}/dist/components.json`; + `https://unpkg.com/@heroui/react@${version}/dist/components.json`; export async function autoUpdateComponents(latestVersion?: string, betaVersion?: string) { [latestVersion, betaVersion] = await Promise.all([ diff --git a/src/scripts/path.ts b/src/scripts/path.ts index 16a456b..400e863 100644 --- a/src/scripts/path.ts +++ b/src/scripts/path.ts @@ -11,6 +11,6 @@ const PROD_DIR = resolve(fileURLToPath(import.meta.url), '..'); const PROD = existsSync(join(PROD_DIR, 'components.json')); export const CACHE_DIR = PROD - ? resolve(`${PROD_DIR}/.nextui-cli-cache`) - : resolve(join(ROOT, '..'), 'node_modules/.nextui-cli-cache'); + ? resolve(`${PROD_DIR}/.heroui-cli-cache`) + : resolve(join(ROOT, '..'), 'node_modules/.heroui-cli-cache'); export const CACHE_PATH = resolve(`${CACHE_DIR}/data.json`); diff --git a/src/scripts/sync/index.ts b/src/scripts/sync/index.ts index 4a844fc..a77785f 100644 --- a/src/scripts/sync/index.ts +++ b/src/scripts/sync/index.ts @@ -4,11 +4,11 @@ import {resolver} from 'src/constants/path'; export function syncDocs() { const docs = readFileSync(resolver('README.md'), 'utf-8'); - const matchDocs = docs.match(/(?<=Usage: nextui \[command]\n\n)[\W\w]+(?=## Documentation)/)?.[0]; + const matchDocs = docs.match(/(?<=Usage: heroui \[command]\n\n)[\W\w]+(?=## Documentation)/)?.[0]; - const targetPath = resolver('nextui/apps/docs/content/docs/api-references/cli-api.mdx'); + const targetPath = resolver('heroui/apps/docs/content/docs/api-references/cli-api.mdx'); const targetDocs = readFileSync(targetPath, 'utf-8'); - const replaceTargetDocs = targetDocs.replace(/(?<=Usage: nextui \[command])[\W\w]+/, ''); + const replaceTargetDocs = targetDocs.replace(/(?<=Usage: heroui \[command])[\W\w]+/, ''); let writeDocs = `${replaceTargetDocs}\n\n${matchDocs?.replace(/\n$/, '')}`; writeDocs = writeDocs.replaceAll(/```bash/g, '```codeBlock bash'); @@ -19,7 +19,7 @@ export function syncDocs() { } function syncApiRoutes() { - const targetPath = resolver('nextui/apps/docs/config/routes.json'); + const targetPath = resolver('heroui/apps/docs/config/routes.json'); const targetDocs = JSON.parse(readFileSync(targetPath, 'utf-8')); targetDocs.routes.forEach((route) => {