Skip to content

Commit d9d876a

Browse files
committed
fix: update import paths to use relative paths instead of absolute paths
1 parent 8ebc678 commit d9d876a

File tree

12 files changed

+63
-21
lines changed

12 files changed

+63
-21
lines changed

fix-imports.cjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
const fs = require('fs');
3+
const path = require('path');
4+
5+
const dir = path.join(process.cwd(), 'packages/components/src/ui');
6+
7+
try {
8+
const files = fs.readdirSync(dir);
9+
10+
files.forEach(file => {
11+
if (!file.endsWith('.tsx')) return;
12+
13+
const filePath = path.join(dir, file);
14+
let content = fs.readFileSync(filePath, 'utf8');
15+
16+
// Check if file contains the incorrect import
17+
if (content.includes('registry/')) {
18+
console.log(`Fixing imports in ${file}...`);
19+
20+
// Replace @/registry/default/ui/ with ./
21+
content = content.replace(/@\/registry\/default\/ui\//g, './');
22+
23+
// Replace @/registry/new-york/ui/ with ./
24+
content = content.replace(/@\/registry\/new-york\/ui\//g, './');
25+
26+
// Replace @/registry/default/hooks/ with ../hooks/
27+
content = content.replace(/@\/registry\/default\/hooks\//g, '../hooks/');
28+
29+
// Replace @/registry/default/lib/ with ../lib/
30+
content = content.replace(/@\/registry\/default\/lib\//g, '../lib/');
31+
32+
fs.writeFileSync(filePath, content, 'utf8');
33+
}
34+
});
35+
36+
console.log('Finished fixing imports.');
37+
} catch (err) {
38+
console.error('Error processing files:', err);
39+
process.exit(1);
40+
}

packages/components/src/renderers/complex/resizable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { renderChildren } from '../../lib/utils';
1919
ComponentRegistry.register('resizable',
2020
({ schema, className, ...props }: { schema: ResizableSchema; className?: string; [key: string]: any }) => (
2121
<ResizablePanelGroup
22-
direction={schema.direction || 'horizontal'}
22+
orientation={(schema.direction || 'horizontal') as "horizontal" | "vertical"}
2323
className={className}
2424
{...props}
2525
style={{ minHeight: schema.minHeight || '200px' }}

packages/components/src/ui/alert-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as React from "react"
1212
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
1313

1414
import { cn } from "../lib/utils"
15-
import { buttonVariants } from "@/registry/default/ui/button"
15+
import { buttonVariants } from "./button"
1616

1717
const AlertDialog = AlertDialogPrimitive.Root
1818

packages/components/src/ui/button.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const buttonVariants = cva(
3232
sm: "h-9 rounded-md px-3",
3333
lg: "h-11 rounded-md px-8",
3434
icon: "h-10 w-10",
35+
"icon-sm": "h-8 w-8",
36+
"icon-lg": "h-12 w-12",
3537
},
3638
},
3739
defaultVariants: {

packages/components/src/ui/calendar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import { DayButton, DayPicker, getDefaultClassNames } from "react-day-picker"
1818

1919
import { cn } from "../lib/utils"
20-
import { Button, buttonVariants } from "@/registry/new-york/ui/button"
20+
import { Button, buttonVariants } from "./button"
2121

2222
function Calendar({
2323
className,

packages/components/src/ui/carousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import useEmblaCarousel, {
1515
import { ArrowLeft, ArrowRight } from "lucide-react"
1616

1717
import { cn } from "../lib/utils"
18-
import { Button } from "@/registry/default/ui/button"
18+
import { Button } from "./button"
1919

2020
type CarouselApi = UseEmblaCarouselType[1]
2121
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>

packages/components/src/ui/command.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Command as CommandPrimitive } from "cmdk"
1414
import { Search } from "lucide-react"
1515

1616
import { cn } from "../lib/utils"
17-
import { Dialog, DialogContent } from "@/registry/default/ui/dialog"
17+
import { Dialog, DialogContent } from "./dialog"
1818

1919
const Command = React.forwardRef<
2020
React.ElementRef<typeof CommandPrimitive>,

packages/components/src/ui/form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
} from "react-hook-form"
2222

2323
import { cn } from "../lib/utils"
24-
import { Label } from "@/registry/default/ui/label"
24+
import { Label } from "./label"
2525

2626
const Form = FormProvider
2727

packages/components/src/ui/pagination.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as React from "react"
1010
import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
1111

1212
import { cn } from "../lib/utils"
13-
import { ButtonProps, buttonVariants } from "@/registry/default/ui/button"
13+
import { ButtonProps, buttonVariants } from "./button"
1414

1515
const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
1616
<nav

packages/components/src/ui/resizable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { cn } from "../lib/utils"
1616
const ResizablePanelGroup = ({
1717
className,
1818
...props
19-
}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
20-
<ResizablePrimitive.PanelGroup
19+
}: React.ComponentProps<typeof ResizablePrimitive.Group>) => (
20+
<ResizablePrimitive.Group
2121
className={cn(
2222
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
2323
className
@@ -32,10 +32,10 @@ const ResizableHandle = ({
3232
withHandle,
3333
className,
3434
...props
35-
}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
35+
}: React.ComponentProps<typeof ResizablePrimitive.Separator> & {
3636
withHandle?: boolean
3737
}) => (
38-
<ResizablePrimitive.PanelResizeHandle
38+
<ResizablePrimitive.Separator
3939
className={cn(
4040
"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
4141
className
@@ -47,7 +47,7 @@ const ResizableHandle = ({
4747
<GripVertical className="h-2.5 w-2.5" />
4848
</div>
4949
)}
50-
</ResizablePrimitive.PanelResizeHandle>
50+
</ResizablePrimitive.Separator>
5151
)
5252

5353
export { ResizablePanelGroup, ResizablePanel, ResizableHandle }

0 commit comments

Comments
 (0)