shadcn-vue icon indicating copy to clipboard operation
shadcn-vue copied to clipboard

chore(nuxt-module): add critical packages to module's dependencies

Open MuhammadM1998 opened this issue 1 year ago • 6 comments
trafficstars

Resolves https://github.com/radix-vue/shadcn-vue/issues/529

This adds the following packages as dependencies so that the user don't need to install them.

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

This means a cleaner package.json, I've updated the playground accordingly

"dependencies": {
-  "class-variance-authority": "^0.7.0",
-  "clsx": "^2.1.1",
-  "radix-vue": "^1.7.3",
-  "tailwindcss-animate": "^1.0.7"
-  "tailwindcss-merge": "^2.0.3",
  "shadcn-nuxt": "^0.8.0"
}

Note that clsx is already a dependency in class-variance-authority and we're using the same major version v2 so it can also be safely removed

Tested locally in the playground & a separate project and it works as expected. run pnpm why radix-vue and you'll see a similar dependency tree Screenshot 2024-05-06 111853

MuhammadM1998 avatar May 06 '24 08:05 MuhammadM1998

Since it has same changes from this PR https://github.com/radix-vue/shadcn-vue/pull/528 but with +3 new commits please add some text like

[!NOTE] This PR depends on https://github.com/radix-vue/shadcn-vue/pull/528 to get merged first

sadeghbarati avatar May 06 '24 08:05 sadeghbarati

@sadeghbarati Didn't realize it until I made the PR sorry for that😅 I modified it to include only the changes for this PR

MuhammadM1998 avatar May 06 '24 08:05 MuhammadM1998

@MuhammadM1998, another point regarding the shadcn-vue CLI init command, when we execute it in Nuxt projects, it still installs those dependencies. Therefore, ensure to update the cli package too

sadeghbarati avatar May 06 '24 11:05 sadeghbarati

Oh you're right will push changes later today

MuhammadM1998 avatar May 06 '24 11:05 MuhammadM1998

@sadeghbarati Refactored the CLI to check if shadcn-nuxt is installed and checks its version to ensure that it handles the dependencies for backward compat.

MuhammadM1998 avatar May 06 '24 16:05 MuhammadM1998

Let's wait for Zernonia's opinion cause he is the author of this module 💯

sadeghbarati avatar May 06 '24 16:05 sadeghbarati

Thanks for the PR @MuhammadM1998 ..

One question tho, if user decide to use other version of Radix Vue, how can they install a different version of it?

zernonia avatar May 21 '24 06:05 zernonia

@zernonia Thanks! Users can use overrides to use a different version.

"dependencies": {
  "shadcn-nuxt": "^3.0.0", // Has radix-vue v1.7.3 as a dependency
},
"overrides": {
  "radix-vue": "^2.0.0", // This version is what will be installed
}

MuhammadM1998 avatar May 21 '24 07:05 MuhammadM1998

@MuhammadM1998 Let's remove radix-vue from shadcn-nuxt module deps?

Most of the users are unaware of overrides module features in packageManagers

sadeghbarati avatar May 21 '24 09:05 sadeghbarati

Also, let's consider checking this Nuxt PR too: https://github.com/nuxt/nuxt/pull/27155

If it gets merged we don't need @oxc-parser/wasm anymore I think

sadeghbarati avatar May 21 '24 09:05 sadeghbarati

@MuhammadM1998 Let's remove radix-vue from shadcn-nuxt module deps?

Most of the users are unaware of overrides module features in packageManagers

Normally a user won't need to use overrides. A case where a user would need that is that shadcn-nuxt bumped radix-vue to 1.7.8 for example and it caused problems for the user so then he'd use overrides to install radix-vue 1.7.7. That's a slim chance as you see. I'm okay with removing it from dependencies (maybe move it to peerDeps?) but imo its better this way. I'll wait for you decision. Feel free to push changes too!

MuhammadM1998 avatar May 21 '24 09:05 MuhammadM1998

@MuhammadM1998 Let's merge it for now for further PRs 🙏

sadeghbarati avatar May 24 '24 13:05 sadeghbarati