unovue / shadcn-vue

Vue port of shadcn-ui
https://www.shadcn-vue.com/
MIT License
4.89k stars 280 forks source link

[Bug]: Fail to add some components in cli mode without using typscript #133

Closed Attax closed 11 months ago

Attax commented 1 year ago

Environment

Developement/Production OS: MacOS Ventura 13.2.1
Node version: 20.4.0
Package manager: npm@9.7.2
Radix Vue version: ^1.0.0-beta.0
Shadcn Vue version: 0.6.0 and 0.6.1
Vue version: ^3.3.4
Vite Version:^4.4.11
CSS framework: tailwindcss@^3.3.3
Client OS: MacOS Ventura 13.2.1
Browser: Chrome 90.0.4430.212

Link to minimal reproduction

https://github.com/Attax/shadcn-demo

Steps to reproduce

git clone the repo,

npm install 
npx shadcn-vue@latest add 

Choose some components that you want like "Accordion", "Alert-dialog","Calendar","Checkbox","Dialog" and others that I haven't tested, and you will find it will be failed.

Describe the bug

The Error Message Looks like this:

 Installing accordion.../Users/xxx/Documents/workspaces/shadcn-demo/app.vue.ts: Unexpected token (11:48)

   9 | const props = defineProps<AccordionRootProps>()
  10 | const emits = defineEmits<AccordionRootEmits>()
> 11 | /* @detype: remove-after-this */AccordionRoot;{ ...props, ...useEmitAsProps(emits) }
⠋ Installing components.../Users/xxx/Documents/workspaces/shadcn-demo/app.vue.ts: Unexpected token (8:50)

  6 | /* @detype: empty-line=2 */
  7 | const emitsAsProps = useEmitAsProps(emits)
> 8 | /* @detype: remove-after-this */AlertDialogRoot;{ ...props, ...emitsAsProps }
    |                                                   ^
Installing calendar...Command failed with exit code 1: npm install v-calendar
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: namesdoor-dash@0.0.0
npm ERR! Found: vue@3.3.6
npm ERR! node_modules/vue
npm ERR!   vue@"^3.3.4" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^2.5.18" from v-calendar@2.4.2
npm ERR! node_modules/v-calendar
npm ERR!   v-calendar@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/xxx/.npm/_logs/2023-10-22T12_32_45_377Z-eresolve-report.txt
Installing components.../Users/xxx/Documents/workspaces/shadcn-demo/app.vue.ts: Unexpected token (11:47)

   9 | /* @detype: empty-line=2 */
  10 | const emitsAsProps = useEmitAsProps(emits)
> 11 | /* @detype: remove-after-this */CheckboxRoot;{ ...props, ...emitsAsProps };
     |                                                ^
  12 |       cn('peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
  13 |          $attrs.class ?? '');CheckboxIndicator;CheckIcon
Installing dialog.../Users/xxx/Documents/workspaces/shadcn-demo/app.vue.ts: Unexpected token (23:9)

  21 |           props.class,
  22 |         )
> 23 |       ;{ ...props, ...emitsAsProps };DialogClose;Cross2Icon
     |          ^

Expected behavior

No response

Conext & Screenshots (if applicable)

No response

zernonia commented 1 year ago

This should be related to https://github.com/radix-vue/shadcn-vue/issues/62

zernonia commented 11 months ago

Fixed in https://github.com/radix-vue/shadcn-vue/issues/62

Attax commented 11 months ago

Fixed in #62

Thanks a lot! I'll try this later today!