Skip to content

Commit 8d9be07

Browse files
committed
feat: update migrate radix command
1 parent 540cd03 commit 8d9be07

39 files changed

Lines changed: 373 additions & 51 deletions

apps/v4/content/docs/(root)/cli.mdx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,47 @@ npx shadcn@latest migrate rtl "src/components/ui/**"
289289
```
290290

291291
If no path is provided, the migration will transform all files in your `ui` directory (from `components.json`).
292+
293+
---
294+
295+
### migrate radix
296+
297+
The `radix` migration updates your imports from individual `@radix-ui/react-*` packages to the unified `radix-ui` package.
298+
299+
```bash
300+
npx shadcn@latest migrate radix
301+
```
302+
303+
This will:
304+
305+
1. Transform imports from `@radix-ui/react-*` to `radix-ui`
306+
2. Add the `radix-ui` package to your `package.json`
307+
308+
**Before**
309+
310+
```tsx
311+
import * as DialogPrimitive from "@radix-ui/react-dialog"
312+
import * as SelectPrimitive from "@radix-ui/react-select"
313+
```
314+
315+
**After**
316+
317+
```tsx
318+
import { Dialog as DialogPrimitive, Select as SelectPrimitive } from "radix-ui"
319+
```
320+
321+
**Migrate specific files**
322+
323+
You can migrate specific files or use glob patterns:
324+
325+
```bash
326+
# Migrate a specific file.
327+
npx shadcn@latest migrate radix src/components/ui/dialog.tsx
328+
329+
# Migrate files matching a glob pattern.
330+
npx shadcn@latest migrate radix "src/components/ui/**"
331+
```
332+
333+
If no path is provided, the migration will transform all files in your `ui` directory (from `components.json`).
334+
335+
Once complete, you can remove any unused `@radix-ui/react-*` packages from your `package.json`.

apps/v4/public/r/styles/new-york-v4/accordion.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
33
"name": "accordion",
4+
"dependencies": [
5+
"radix-ui"
6+
],
47
"files": [
58
{
69
"path": "registry/new-york-v4/ui/accordion.tsx",

apps/v4/public/r/styles/new-york-v4/alert-dialog.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
33
"name": "alert-dialog",
4+
"dependencies": [
5+
"radix-ui"
6+
],
47
"registryDependencies": [
58
"button"
69
],

apps/v4/public/r/styles/new-york-v4/aspect-ratio.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
33
"name": "aspect-ratio",
4+
"dependencies": [
5+
"radix-ui"
6+
],
47
"files": [
58
{
69
"path": "registry/new-york-v4/ui/aspect-ratio.tsx",

apps/v4/public/r/styles/new-york-v4/avatar.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
33
"name": "avatar",
4+
"dependencies": [
5+
"radix-ui"
6+
],
47
"files": [
58
{
69
"path": "registry/new-york-v4/ui/avatar.tsx",

apps/v4/public/r/styles/new-york-v4/badge.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
33
"name": "badge",
4+
"dependencies": [
5+
"radix-ui"
6+
],
47
"files": [
58
{
69
"path": "registry/new-york-v4/ui/badge.tsx",

apps/v4/public/r/styles/new-york-v4/breadcrumb.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
33
"name": "breadcrumb",
4+
"dependencies": [
5+
"radix-ui"
6+
],
47
"files": [
58
{
69
"path": "registry/new-york-v4/ui/breadcrumb.tsx",

apps/v4/public/r/styles/new-york-v4/button.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
33
"name": "button",
4+
"dependencies": [
5+
"radix-ui"
6+
],
47
"files": [
58
{
69
"path": "registry/new-york-v4/ui/button.tsx",

apps/v4/public/r/styles/new-york-v4/checkbox.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
33
"name": "checkbox",
4+
"dependencies": [
5+
"radix-ui"
6+
],
47
"files": [
58
{
69
"path": "registry/new-york-v4/ui/checkbox.tsx",

apps/v4/public/r/styles/new-york-v4/collapsible.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
33
"name": "collapsible",
4+
"dependencies": [
5+
"radix-ui"
6+
],
47
"files": [
58
{
69
"path": "registry/new-york-v4/ui/collapsible.tsx",

0 commit comments

Comments
 (0)