Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@heroui/codemod

heroui-inc935MIT1.3.0TypeScript support: included

HeroUI Codemod provides transformations to help migrate your codebase from NextUI to HeroUI

UI, CLI, Tool, HeroUI, NextUI, HeroUI, Integration, Modify Codebase

readme

nextui

@heroui/codemod


The CLI provides a comprehensive suite of tools to migrate your codebase from NextUI to HeroUI.

Quick Start

Note: The heroui CLI requires Node.js 18.17.x or later

Note: If running in monorepo, you need to run the command in the root of your monorepo

You can start using @heroui/codemod in one of the following ways:

Npx

npx @heroui/codemod@latest

Global Installation

npm install -g @heroui/codemod

Usage

Usage: @heroui/codemod [command]

A CLI tool for migrating your codebase to heroui

Arguments:
  codemod                Specify which codemod to run
                         Codemods: import-heroui, package-json-package-name, heroui-provider, tailwindcss-heroui, css-variables, npmrc

Options:
  -v, --version          Output the current version
  -d, --debug            Enable debug mode
  -h, --help             Display help for command
  -f, --format           Format the affected files with Prettier

Commands:
  migrate [projectPath] Migrate your codebase to use heroui

Codemod Arguments

import-heroui

Updates all import statements from @nextui-org/* packages to their @heroui/* equivalents.

heroui-codemod import-heroui

Example:

  1. import { Button } from "@nextui-org/button" to import { Button } from "@heroui/button"

package-json-package-name

Updates all package names in package.json from @nextui-org/* to @heroui/*.

heroui-codemod package-json-package-name

Example:

  1. @nextui-org/button: x.xx.xxx to @heroui/button: x.xx.xxx

heroui-provider

Migrate NextUIProvider to HeroProvider.

heroui-codemod heroui-provider

Example:

  1. import { NextUIProvider } from "@nextui-org/react" to import { HeroProvider } from "@heroui/react"

  2. <NextUIProvider>...</NextUIProvider> to <HeroProvider>...</HeroProvider>

tailwindcss-heroui

Migrate all the tailwind.config.(j|t)s file to use the @heroui package.

heroui-codemod tailwindcss-heroui

Example:

  1. const {nextui} = require('@nextui-org/theme') to const {heroui} = require('@heroui/theme')

  2. plugins: [nextui({...})] to plugins: [heroui({...})]

  3. content: ['./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}'] to content: ['./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}']

  4. var(--nextui-primary-500) to var(--heroui-primary-500)

css-variables

Migrate all the css variables in the file starting with --nextui- to --heroui-.

heroui-codemod css-variables

Example:

  1. className="text-[var(--nextui-primary-500)]" to className="text-[var(--heroui-primary-500)]"

npmrc (Pnpm only)

Migrate the .npmrc file to use the @heroui package.

heroui-codemod npmrc

Example:

  1. public-hoist-pattern[]=*@nextui-org/theme* to public-hoist-pattern[]=*@heroui/theme*

Migrate Command

Migrate your entire codebase from NextUI to heroui. You can choose which codemods to run during the migration process.

heroui-codemod migrate [projectPath] [--format]

Example:

heroui-codemod migrate ./my-nextui-app

Output:

heroui Codemod v0.0.1

┌   Starting to migrate nextui to heroui
│
◇  1. Migrating "package.json"
│
◇  Do you want to migrate package.json?
│  Yes
│
◇  Migrated package.json
│
◇  2. Migrating import "nextui" to "heroui"
│
◇  Do you want to migrate import nextui to heroui?
│  Yes
│
◇  Migrated import nextui to heroui
│
◇  3. Migrating "NextUIProvider" to "HeroUIProvider"
│
◇  Do you want to migrate NextUIProvider to HeroUIProvider?
│  Yes
│
◇  Migrated NextUIProvider to HeroUIProvider
│
◇  4. Migrating "tailwindcss"
│
◇  Do you want to migrate tailwindcss?
│  Yes
│
◇  Migrated tailwindcss
│
◇  5. Migrating "css variables"
│
◇  Do you want to migrate css variables?
│  Yes
│
◇  Migrated css variables
│
◇  6. Migrating "npmrc" (Pnpm only)
│
◇  Do you want to migrate npmrc (Pnpm only) ?
│  Yes
│
◇  Migrated npmrc
│
└  ✅ Migration completed!

Community

We're excited to see the community adopt NextUI CLI, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!

Contributing

Contributions are always welcome!

See CONTRIBUTING.md for ways to get started.

Please adhere to this project's CODE_OF_CONDUCT.

License

MIT

changelog

0.6.0 (2025-01-18)

Bug Fixes

0.5.4 (2025-01-16)

0.5.3 (2025-01-16)

0.5.2 (2025-01-16)

Bug Fixes

Features

  • add deprecated info in nextui-cli (#132) (0d68eb9)
  • add format effected files (#134) (a27371b)
  • add reinstall prompt and retry fetch version (#137) (f36839e)
  • add remaining files replace prompt and dot files detected and end note (#135) (d29c05a)
  • codemod: change package version to latest (#131) (b3bf4a8)
  • init heroui codemod package (#124) (2ddf426)

0.5.1 (2024-12-23)

Bug Fixes

  • add action will upgrade to required min peerDep version (#125) (9e0a96a)
  • catch pnpm error and give user choose fix or exit (#123) (a4b18b3)

0.5.0 (2024-12-08)

Bug Fixes

  • upgrade: missing packages use min required and peerDep shoud use latest version (#121) (a81e24b)

Features

  • prompt to choose agent when it cant be detected and some optimizations (#122) (c7efffe)

0.4.2 (2024-12-07)

Bug Fixes

0.4.1 (2024-12-06)

Bug Fixes

0.4.0 (2024-11-29)

Bug Fixes

Features

  • cli support beta components (#109) (b9ce3ac)
  • upgrade command -w option support devDep detect n output optimization (#101) (5573805)

0.3.5 (2024-11-05)

Bug Fixes

Features

  • upgrade command -w option support devDep detect n output optimization (#101) (5573805)

0.3.4 (2024-07-28)

Bug Fixes

  • add debug mode and tailwindcss content mess repair (#95) (57601eb)
  • fixing lint:fix script (#93) (54414d5)

Features

0.3.3 (2024-07-23)

Bug Fixes

Features

  • change to use pnpm 9 (#92) (d0552ac)
  • upgrade: add -w write option to upgrade command (#82) (39804e0)

0.3.2 (2024-06-14)

Bug Fixes

  • add command error in tailwind (#80) (455d6e0)
  • upgrade command select option cannot select @heroui/react pkg (#78) (93e5cdc)

Features

  • init command add invalid options check (#79) (1573e48)
  • optimize upgrade select options package name display (#76) (5c3c3f7)
  • upgrade command add setup pnpm (#77) (1beb52c)

0.3.1 (2024-06-01)

Bug Fixes

0.3.0 (2024-05-27)

Bug Fixes

  • add initCache in updateComponents script (#69) (b79e334)

Features

0.2.1 (2024-05-03)

Features

  • add upgrade version output (#58) (fe30335)
  • init: add package manager and use clack prompt instead (#59) (2a6d593)
  • optimize warn output (#57) (507bd6c)

0.2.0 (2024-04-26)

Bug Fixes

  • ci and compare vesion optimize cache (#26) (ea1ef59)
  • doctor: tailwind config error about content nextui plugin detech (#33) (5cfe1f8), closes #28 #27
  • output component lose alignment (#54) (b84f009)
  • upgrade: add bun commands (#34) (406138c)

Features

  • add bug report & feature request template (#24) (38e4c7c)
  • add eslint rule about use build-in import node module (#48) (2971a49)
  • add project name prompt to init-action (#25) (3166252)
  • add warn attention in add and remove command (#38) (5aa7d23)
  • docs: add logo, project title, and badges (#35) (06ac57e)
  • init command add guide (#36) (d4fd41a)
  • optimize getPackageManagerInfo type (#52) (10a6f56)
  • optimize output (#41) (f598bdc)
  • optimize removeDep type (#53) (faa34d8)
  • optimize runtime speed and add fetching state (#31) (ce57f30)
  • upgrade command add peerDep upgrade (#30) (d5931e8), closes #42

0.1.5 (2024-04-16)

Bug Fixes

Features