Skip to content

feat: community add-on experimental#1020

Open
jycouet wants to merge 21 commits intomainfrom
feat/community-add-ons
Open

feat: community add-on experimental#1020
jycouet wants to merge 21 commits intomainfrom
feat/community-add-ons

Conversation

@jycouet
Copy link
Copy Markdown
Contributor

@jycouet jycouet commented Mar 31, 2026

Closes #184

Description

  • Adding community add-ons in an experimental phase!
  • updated docs

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...)

@svelte-docs-bot
Copy link
Copy Markdown

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 31, 2026

Open in StackBlitz

npx https://pkg.pr.new/svelte-migrate@1020
npx https://pkg.pr.new/sv@1020
npx https://pkg.pr.new/@sveltejs/sv-utils@1020

commit: 6837ecc

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: 6837ecc

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

This PR includes changesets to release 2 packages
Name Type
sv Minor
@sveltejs/sv-utils 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

@jycouet jycouet changed the title feat: community add-ons experimental feat: community add-on experimental Mar 31, 2026
@@ -2,5 +2,261 @@
title: [create your own]
Copy link
Copy Markdown
Member

@teemingc teemingc Mar 31, 2026

Choose a reason for hiding this comment

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

Love it

Image

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.

cc @sacrosanctic 🧡

jycouet and others added 4 commits March 31, 2026 20:53
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
jycouet and others added 4 commits March 31, 2026 21:03
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
@sacrosanctic
Copy link
Copy Markdown
Contributor

Current

  • API
    • sv-utils

Proposal 1

  • API
    • defineAddon
    • defineAddonOptions
    • transforms
    • parse

Proposal 2

  • API
    • sv
    • sv-utils

> [!NOTE]
> Svelte maintainers have not reviewed community add-ons for malicious code!

Community add-ons are npm packages published by the community. Look out for add-ons from your favourite libraries and tools. _(soon)_ many developers are building `sv` add-ons to make their integrations a one-liner. You can find them [on npm](https://www.npmx.dev/search?q=keyword:sv-add) by searching for the keyword: `sv-add`.
Copy link
Copy Markdown
Contributor

@sacrosanctic sacrosanctic Apr 1, 2026

Choose a reason for hiding this comment

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

I have never opened a sentence with a bracket before. How does capitalization rule work? Is that even allowed? 😅

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.

Is that even allowed

You know, in France, we take the right 😅

I was thinking it's a nice "didascalie"


### Naming convention

If you name your package `@your-org/sv`, users can install it by typing just the org handle:
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.

Suggested change
If you name your package `@your-org/sv`, users can install it by typing just the org handle:
Name your add-on as either a sub-package `@your-org/sv` or as a dedicated package `@your-org`. Your users can install it by typing the org handle:

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.

I think that the previous sentence was better.

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.

We can mention it can't be the root package here.


```sh
# npm package: @your-org/sv
npx sv add @your-org
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.

Suggested change
npx sv add @your-org
npx sv add @your-org
# npm package: @your-org
npx sv add @your-org

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.

If you publish your sv addon as @your-org (I do'nt know if it's possible). sv will not pick it up.

you can publish:

# you can publish
@my-org/sv # and you have a shorcut to do "npx sv add @my-org"

# you can publish 
@my-org/my-super-cool-stuff # can users will be able to add "npx sv add @my-org/my-super-cool-stuff"

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.

I misunderstood how it works.

> [!NOTE]
> Unscoped packages are not supported yet

### Export options
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 section and naming convention could be combined.

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.

I didn't get it

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.

There's 2 sections, "naming convention" and "export options". They feel very similar to me and couldn't refactored together.


`sv` first tries to import `your-package/sv`, then falls back to the default export. This means you have two options:

1. **Default export** (recommended for dedicated add-on packages):
Copy link
Copy Markdown
Contributor

@sacrosanctic sacrosanctic Apr 1, 2026

Choose a reason for hiding this comment

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

Suggested change
1. **Default export** (recommended for dedicated add-on packages):
1. **Default export** (for dedicated add-on packages):

Who's an example that would do this?

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.

I didn't get it

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.

I thought you could publish to root. You meant having a dedicated repo that publishes to @your-org/sv

Comment on lines +224 to +225
npm login
npm publish
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.

I don't publish, but is there a command we can add here to slightly nudge people to use trusted publishing (and related security features).

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.

I think it's a bit "out of scope" atm, we already tell a lot. No?

I mean, with pnpm we can also do a few things differently. we can setup changeset, we can setup OICD, we can setup pkg, ...

I think that we show already a lot, so showing the "raw npm" way is already good enough IMO


See the [official add-on source code](https://github.com/sveltejs/cli/tree/main/packages/sv/src/addons) for some real world examples.

## Architecture
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.

combine with project structure

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.

You think so?
I link it to be a bit separate... but maybe it's too much down atm?

But why not merging under the project structure?

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.

incase i messed it up again, im talking about architecture+project structure

@jycouet
Copy link
Copy Markdown
Contributor Author

jycouet commented Apr 1, 2026

Current

  • API
    • sv-utils

Proposal 1

  • API
    • defineAddon
    • defineAddonOptions
    • transforms
    • parse

Proposal 2

  • API
    • sv
    • sv-utils

I think that proposal 2 would be great 👍

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.

Community add-on support

3 participants