radix-vue / shadcn-vue

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

Tailwind prefix #619

Open zernonia opened 1 week ago

zernonia commented 1 week ago

๐Ÿ”— Linked issue

โ“ Type of change

๐Ÿ“š Description

๐Ÿ“ธ Screenshots (if appropriate)

๐Ÿ“ Checklist

zernonia commented 1 week ago

@sadeghbarati there was some problem back then when I'm implementing the tw prefix, but I just had a look today and seems like the snapshot and everything looks good. Can you help review and check if it's all good? ๐Ÿ˜

sadeghbarati commented 1 week ago

image

Just switch to your branch build the CLI and upload it to Stackblitz, seems not working yet, which is why I don't like test files ๐Ÿ˜†

https://stackblitz.com/edit/vitejs-vite-dzqk4g

zernonia commented 1 week ago

Can you check again @sadeghbarati ? ๐Ÿ˜

sadeghbarati commented 1 week ago

@zernonia fix: cater for cn function did fixed the cn prefix

I see prefix applied to all imports in all ui .ts files https://stackblitz.com/edit/vitejs-vite-dzqk4g

image

zernonia commented 1 week ago

Ahh nice catch @sadeghbarati ! Fixing!!!!

sadeghbarati commented 1 week ago

I think we should setup pkg.pr.new for shadcn-vue cli and module packages too, Stackblitz upload limit will prevent me to test future PRs

zernonia commented 1 week ago

Yeah we can do that.. that would really help to test out the PR ๐Ÿ˜

github-actions[bot] commented 1 week ago

Deploying with Cloudflare Pages

Name Result
Last commit: b88fe615
Status: โœ… Deploy successful!
Preview URL: https://473d1d70.shadcn-vue.pages.dev
Branch Preview URL: https://refs-pull-619-merge.shadcn-vue.pages.dev
zernonia commented 1 week ago

Yup not as easy as I thought hahaha.. usingStringLiteral is not powerful enough.. will convert to draft for now

zernonia commented 1 week ago

@sadeghbarati I found this goldmind! https://vue-metamorph.dev/

It simplified the transformation soooooo much!!! I've refactor the transformer entirely to use vue-metamorph! Do help test it out ya!

sadeghbarati commented 1 week ago

I hit the upload limit ๐Ÿ˜ญ

I think vue-metamorph should be in dependencies

image


These tests are in TypeScript project

Button index.ts

All UI ts files import are still prefixed

image

Button.vue

image


auto-form, chart-area|bar|donut|line

image

sadeghbarati commented 1 week ago

Now I understand why Codemod Team is having hard time working on Vue Codemods

sadeghbarati commented 1 week ago

Tested JavaScript projects too, seems like detypes is not working well with vue-metamorph

Button index.js

image

zernonia commented 1 week ago

@sadeghbarati Do you mind checking again? This time the transformation for prefix is much stricter to paritcular attributes and function only.

Also made a patch for vue-eslint-parser that vue-metamorph is using underneath. The undefined issue should be gone now

sadeghbarati commented 1 week ago

@zernonia Everything is fine just

sadeghbarati commented 1 week ago

in JavaScript projects, found a strange thing, happening in AccordionTrigger and SelectItem and maybe other components as well

image

cn placement is not formatted and also an additional ] is added to the end of the cn function

sadeghbarati commented 1 week ago

in JavaScript projects, found a strange thing, happening in AccordionTrigger and SelectItem and maybe other components as well

image

cn placement is not formatted and also an additional ] is added to the end of the cn function

Looks like this is detypes bug not vue-metamorph

Related Discussion https://github.com/radix-vue/shadcn-vue/discussions/632