shadcn-vue
shadcn-vue copied to clipboard
Added muti-layer support and app folder detection, resolving the double registration bug.
Linkled Issue
https://github.com/unovue/shadcn-vue/issues/1416
โ Type of change
- [ ] ๐ Documentation (updates to the documentation, readme or JSdoc annotations)
- [x] ๐ Bug fix (a non-breaking change that fixes an issue)
- [x] ๐ Enhancement (improving an existing functionality like performance)
- [ ] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
This update leverages getLayerDirectories to build a candidate list of potential folders in layer priority order and then uses findPath to select the first that exists, falling back to the root path. Candidates are generated using resolvePath so that aliases and absolute paths still work, but now all configs can use a path relative to where the app root is. The scan also logs for better transparency.
Using the correct base path for resolution resolves the double registration issue that some people are reporting, as the exclusion path is correct.
- Bump version from 2.2.0 to 2.2.1-pre.1 in package.json
- Update @nuxt/kit dependency to ^3.19.2
- Update @nuxt/schema and @nuxt/test-utils dependencies to ^3.19.0 and ^3.19.2 respectively
- Add peer dependency for @nuxt/kit
- Refactor module.ts to improve component directory resolution and logging
- Introduce findPath for better handling of potential component directories
- Add a new tarball for the updated module version
๐ธ Screenshots (if appropriate)
Here's the log output
โ Setting up shadcn-nuxt module { COMPONENT_DIR_PATH: './shadcn/ui', shadcn-nuxt 2:54:42 PM
ROOT_DIR_PATH: '/path/to/project/packages/ui' }
โน Checking { potentialPaths: shadcn-nuxt 2:54:42 PM
[ '/path/to/project/packages/ui/app/shadcn/ui',
'/path/to/project/packages/shell/app/shadcn/ui',
'/path/to/project/packages/nuxt-gravity/app/shadcn/ui' ] }
[shadcn-nuxt 2:54:42 PM] โน Decided on { componentsPath: '/path/to/project/packages/ui/app/shadcn/ui' }
๐ Checklist
- [x] I have linked an issue or discussion.
- [N/A] I have updated the documentation accordingly.
Hi @bahulneel, can you create a StackBlitz playground for this PR, for testing your package changes, upload/drag your
shadcn-nuxt tarball file into the StackBlitz, for creating tarball file use
pnpm pack
And also create a minimal example for the Nuxt layer features in it
Thanks