t3-oss / create-t3-turbo

Clean and simple starter repo using the T3 Stack along with Expo React Native
https://turbo.t3.gg
MIT License
4.27k stars 350 forks source link

bug: ui-add doesn't set the import paths properly when adding a component #1035

Open j-fdion opened 1 month ago

j-fdion commented 1 month ago

Provide environment information

System: OS: Windows 10 10.0.19045 CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor Memory: 17.53 GB / 31.92 GB Binaries: Node: 22.1.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD pnpm: 9.1.1 - ~\AppData\Local\pnpm\pnpm.EXE Watchman: 20210110.135312.0 - c:\programdata\chocolatey\bin\watchman.EXE

Describe the bug

When using pnpm ui-add the added component doesn't have a correct import path.

`"use client";

import * as React from "react"; import { type DialogProps } from "@radix-ui/react-dialog"; import { MagnifyingGlassIcon } from "@radix-ui/react-icons"; import { Command as CommandPrimitive } from "cmdk"; import { Dialog, DialogContent } from "src//dialog";

import { cn } from "@acme/ui";`

The import should be ./dialog and not src//dialog

Link to reproduction

https://github.com/t3-oss/create-t3-turbo

To reproduce

use pnpm ui-add and select the Command component

Additional information

No response

juliusmarminge commented 1 month ago

What component did you add?

juliusmarminge commented 1 month ago

shadcn cli generally isnt the best at handling monorepos but i thought we got the last issues sorted :/

j-fdion commented 1 month ago

What component did you add?

The command component (needs Dialog, imported as import { Dialog, DialogContent } from "src//dialog";, but it does it with every component which has dependency inside the /src directory such as Toaster (needs Toast, imported as import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, } from "src//toast";