Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature(Nuxt): Add radix-vue and other main deps as dependencies #529

Open
2 tasks done
MuhammadM1998 opened this issue May 5, 2024 · 8 comments 路 May be fixed by #531
Open
2 tasks done

Feature(Nuxt): Add radix-vue and other main deps as dependencies #529

MuhammadM1998 opened this issue May 5, 2024 · 8 comments 路 May be fixed by #531
Assignees

Comments

@MuhammadM1998
Copy link
Contributor

Describe the feature

Hey 馃憢

There are primary dependencies that shadcn-vue relies on and automatically installed by the CLI

  • class-variance-authority
  • clsx
  • radix-vue
  • tailwindcss-animate
  • tailwind-merge

I think adding them as dependencies to the nuxt module makes sense. They would get installed with the module without cluttering the package.json. Similar to other nuxt modules which follows the pattern of a 'one-click-setup'.

I've created a branch locally and it works as expected. Happy to make a PR if this is accepted.

Additional information

  • I intend to submit a PR for this feature.
  • I have already implemented and/or tested this feature.
@sadeghbarati
Copy link
Collaborator

I like the idea, but we should release shadcn-nuxt on every radix-vue or other deps version bump?

https://github.com/HugoRCD/blanked

@MuhammadM1998
Copy link
Contributor Author

I think releasing a new version won't be necessary for those deps as long as you keep the ^ in package.json. For example if we have tailwind-merge: ^2.3.0 a dependency and then tailwind-merge v2.3.1, the package manager would pick this automatically and install the updated version. The release would be only required for major changes for those deps which is reasonable as you'd want to migrate them and ensure everything works correctly first.

@sadeghbarati
Copy link
Collaborator

Nice TIL

@MuhammadM1998
Copy link
Contributor Author

Can you elaborate on the module you linked? Do you want to add it as a dependency too? I see it has a lot of modules that are needed by the module such as tailwindcss and colormode. I'm not sure if it's a good idea though

@sadeghbarati
Copy link
Collaborator

Can you elaborate on the module you linked? Do you want to add it as a dependency too? I see it has a lot of modules that are needed by the module such as tailwindcss and colormode. I'm not sure if it's a good idea though

I think that link is got the same idea as yours I just share it, thought it might be helpful

@MuhammadM1998
Copy link
Contributor Author

Oh I got it wrong then 馃槄 Yeah it's similar to it. Also similar to nuxt/tailwindcss that has tailwindcss as a dependency for example. It's actually a pattern I see in a lot of nuxt modules. If this sounds good I'd like to get assigned this please

@sadeghbarati
Copy link
Collaborator

@MuhammadM1998 one question, what is if I want to use class-variance-authority types like

import { type VariantProps } from 'class-variance-authority'

I should install it again (in devDependencies) even though cva is part of dependencies in shadcn-nuxt module right?

@MuhammadM1998
Copy link
Contributor Author

MuhammadM1998 commented May 6, 2024

@sadeghbarati You don't need to add it again that import would just work. Actually 'class-variance-authority' has clsx as a dependency which is re-added as a dependency when you init the CLI. If you remove the clsx from depedencies things will continue to work normally (unless of course the version in the dependencies has a different major version from the on in cva's dependencies as there would be breaking changes, but this is not the case here)

So this

"dependencies": {
  "class-variance-authority": "^0.7.0",
  "clsx": "^2.1.1",
},

Can be simplified to this if the clsx (which is currently 2.0.0) version in cva's suits your needs

"dependencies": {
  "class-variance-authority": "^0.7.0",
 }

and the following import would still work

import { type ClassValue, clsx } from 'clsx'

If you want to use a different version than the one in cva's dependencies. You'd specify it as in overrides

"dependencies": {
  "class-variance-authority": "^0.7.0",
 },
"pnpm": {
  "overrides": {
    "clsx": "^3" // This would get installed instead of `2.0.0` specified by 'class-variance-authority'
  }
}

@MuhammadM1998 MuhammadM1998 changed the title [Feature]: Add radix-vue and other main deps as dependencies in nuxt module Feature(Nuxt): Add radix-vue and other main deps as dependencies May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants