diff --git a/.changeset/config.json b/.changeset/config.json index 9c12e3e30..8114d8685 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -7,5 +7,5 @@ "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch", - "ignore": [ "@sveltejs/*", "community-addon-template" ] + "ignore": [ "@sveltejs/*" ] } diff --git a/.gitignore b/.gitignore index c55b88816..bb6c2737e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ temp/ package-lock.json yarn.lock vite.config.js.timestamp-* -.test-output +.test-output \ No newline at end of file diff --git a/community-addon-template/.gitignore b/community-addon-template/.gitignore deleted file mode 100644 index a9e1699a5..000000000 --- a/community-addon-template/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -temp -.outputs -.test-output diff --git a/community-addon-template/src/index.js b/community-addon-template/src/index.js deleted file mode 100644 index 61dc312ea..000000000 --- a/community-addon-template/src/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import { defineAddon, defineAddonOptions } from '@sveltejs/cli-core'; -import { imports } from '@sveltejs/cli-core/js'; -import { parseSvelte } from '@sveltejs/cli-core/parsers'; - -export const options = defineAddonOptions() - .add('demo', { - question: 'Do you want to use a demo?', - type: 'boolean', - default: false - }) - .build(); - -export default defineAddon({ - id: 'community-addon', - options, - setup: ({ kit, unsupported }) => { - if (!kit) unsupported('Requires SvelteKit'); - }, - run: ({ sv, options, typescript }) => { - sv.file('addon-template-demo.txt', (content) => { - if (options.demo) { - return 'This is a text file made by the Community Addon Template demo!'; - } - return content; - }); - - sv.file('src/DemoComponent.svelte', (content) => { - if (!options.demo) return content; - const { script, generateCode } = parseSvelte(content, { typescript }); - imports.addDefault(script.ast, { from: '../addon-template-demo.txt?raw', as: 'demo' }); - return generateCode({ script: script.generateCode(), template: '{demo}' }); - }); - } -}); diff --git a/documentation/docs/20-commands/10-sv-create.md b/documentation/docs/20-commands/10-sv-create.md index fc4a4b932..12c9ece18 100644 --- a/documentation/docs/20-commands/10-sv-create.md +++ b/documentation/docs/20-commands/10-sv-create.md @@ -19,6 +19,7 @@ Which project template to use: - `minimal` — barebones scaffolding for your new app - `demo` — showcase app with a word guessing game that works without JavaScript - `library` — template for a Svelte library, set up with `svelte-package` +- `addon` — template for a community add-on, ready to be tested & published ### `--types