Skip to content

feat(cli): Community add-ons no longer require scoped package names - #1216

Open
sacrosanctic wants to merge 1 commit into
sveltejs:version-1from
sacrosanctic:cute-peacock
Open

feat(cli): Community add-ons no longer require scoped package names#1216
sacrosanctic wants to merge 1 commit into
sveltejs:version-1from
sacrosanctic:cute-peacock

Conversation

@sacrosanctic

@sacrosanctic sacrosanctic commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

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

  • Update snapshots (if applicable)
  • Add a changeset (if applicable)
  • Allow maintainers to edit this PR
  • I care about what I'm doing, no matter the tool I use (Notepad, Sublime, VSCode, AI...)

@pkg-svelte-dev

pkg-svelte-dev Bot commented Aug 1, 2026

Copy link
Copy Markdown

Install the latest version of sv from 98d15b5:

pnpm add https://pkg.svelte.dev/sv/c/98d15b5f8b411ebd8cd268365c2bcc18acda0de8

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/cli/pr/1216

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 98d15b5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
sv Minor

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

@sacrosanctic
sacrosanctic marked this pull request as ready for review August 3, 2026 14:06
Comment thread packages/sv/src/cli/tests/cli.ts Outdated
Comment on lines 65 to 69
{
projectName: 'my-addon',
template: 'addon',
args: []
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validation of package name is not really belonging to this PR (tests as well)

@jycouet

jycouet commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Here we would need to adjust docs & a changeset (patch) as it's a significative change.

@sacrosanctic sacrosanctic changed the title feat(cli): Organization no longer required feat(cli): Community add-ons no longer require scoped package names Aug 4, 2026
@sacrosanctic

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('@')) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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-name arg 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)

@manuel3108
manuel3108 changed the base branch from main to version-1 August 7, 2026 08:52
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 this pull request may close these issues.

npx sv create --template addon shouldn't require an organization

2 participants