-
-
Notifications
You must be signed in to change notification settings - Fork 483
fix: display correct path for utils file during init #2314
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: c10e8f8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: huntabyte <[email protected]>
Co-authored-by: huntabyte <[email protected]>
|
@copilot fix the failing windows tests. |
Co-authored-by: huntabyte <[email protected]>
Fixed in commit 8aa3e7e. The test was failing on Windows because it expected paths with forward slashes, but Windows uses backslashes. I've updated the test to use the |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
Fix: CLI logs wrong path for utils file during init
Fixes the issue where the CLI incorrectly logs the default path for the utils file even when it's installed at a custom location.
Problem
When initializing shadcn-svelte with a custom path for the utils file (e.g.,
$lib/features/shared/components/_shadcn/utilsinstead of the default$lib/utils), the CLI displays that utils was installed at the default path even though it was actually placed in the correct custom location.Example from the issue:
$lib/features/shared/components/_shadcn/utilssrc/lib/features/shared/components/_shadcn/utils.ts✔ utils installed at src/lib/utilsRoot Cause
The display logic in
packages/cli/src/utils/add-registry-items.tscalculates the displayed path differently from the actual file path:resolveItemFilePath()which has special handling for "utils" item (lines 186-190 inregistry/index.ts)getItemAliasDir()+ item name, which doesn't account for the special utils handlingSolution
Modified the display logic to track and use the actual file path that was written:
firstFilePathvariableChanges
Modified Files:
packages/cli/src/utils/add-registry-items.ts- Added 11 lines to track and display actual file pathpackages/cli/test/utils/add-registry-items.test.ts- Added 57 lines with new test case, fixed Windows path compatibilityCode Changes:
Testing
toPosixPathhelperImpact
Before & After
Before the fix:
(Even when installed at
src/lib/features/shared/components/_shadcn/utils.ts)After the fix:
(Shows the actual path where the file was installed)
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.