Cheatsheet: All official add-ons source code
Some convenient scripts are provided to help develop the add-on.
## create a new minimal project in the `demo` directory
pnpm demo-create
## add your current add-on to the demo project
pnpm demo-add
## run the tests
pnpm testYour add-on should:
- export a function that returns a
defineAddonobject. - have a
package.jsonwith anexportsfield that points to the main entry point of the add-on.
Your add-on is bundled with tsdown into a single file in dist/. This bundles everything except sv (which is a peer dependency provided at runtime).
pnpm buildWhen you're ready to publish your add-on to npm:
pnpm login
pnpm publish
prepublishOnlywill automatically run the build before publishing.
Community add-ons must have sv as a peerDependency and should not have any dependencies. Everything else (including @sveltejs/sv-utils) is bundled at build time by tsdown.