feat(cli): Community add-ons no longer require scoped package names - #1216
feat(cli): Community add-ons no longer require scoped package names#1216sacrosanctic wants to merge 1 commit into
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/sv/c/98d15b5f8b411ebd8cd268365c2bcc18acda0de8Open in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
🦋 Changeset detectedLatest commit: 98d15b5 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 |
| { | ||
| projectName: 'my-addon', | ||
| template: 'addon', | ||
| args: [] | ||
| } |
There was a problem hiding this comment.
Do we need a test for this? (Right now, CI is failing probably because snapshots are missing).
I think that having 1 test for addon is ok (if it's only the name update)
| @@ -0,0 +1,32 @@ | |||
| // https://npmx.dev/package/validate-npm-package-name#user-content-naming-rules | |||
| export const validateProjectName = (value: string | undefined): string | undefined => { | |||
There was a problem hiding this comment.
This validation of package name is not really belonging to this PR (tests as well)
|
Here we would need to adjust docs & a changeset (patch) as it's a significative change. |
This comment was marked as outdated.
This comment was marked as outdated.
| const parentDirName = path.basename(path.dirname(projectPath)); | ||
| let projectName = parentDirName.startsWith('@') ? `${parentDirName}/${basename}` : basename; | ||
|
|
||
| if (template === 'addon' && !projectName.startsWith('@')) { |
There was a problem hiding this comment.
@jycouet The issue with the tests is that previously, prompt was skipped if the project path is valid, defined by @my-org/sv' which produces .test-output/cli/@my-org/sv. Now the range of valid names have expanded and so I removed this change.
2 directions to go:
- add a
--addon-namearg so it can be defined in the test (plus users can use it for promptless) - add validation based on path (a little clunky, me thinks)
d312d4b to
98d15b5
Compare
Closes #1101
Description
It currently accepts
@<org>,<pkg>, and@<org>/<pkg>. Also went a little overboard with the name validation. We can pare it down.Checklist