diff --git a/.changeset/config.json b/.changeset/config.json index 581533f27..f2091dd84 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -6,6 +6,5 @@ "linked": [], "access": "public", "baseBranch": "main", - "updateInternalDependencies": "patch", - "ignore": ["community-addon-template"] + "updateInternalDependencies": "patch" } 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 3c2f5ee50..000000000 --- a/community-addon-template/src/index.js +++ /dev/null @@ -1,33 +0,0 @@ -import { defineAddon, defineAddonOptions, js, svelte, parseSvelte } from 'sv/core'; - -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 { ast, generateCode } = parseSvelte(content); - const scriptAst = svelte.ensureScript(ast, { langTs: typescript }); - js.imports.addDefault(scriptAst, { from: '../addon-template-demo.txt?raw', as: 'demo' }); - return generateCode(); - }); - } -}); diff --git a/community-addon-template/tests/custom-addon.test.ts b/community-addon-template/tests/custom-addon.test.ts deleted file mode 100644 index 8cc944167..000000000 --- a/community-addon-template/tests/custom-addon.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import path from 'node:path'; -import { expect } from '@playwright/test'; -import { fixture, setupTest } from './setup/suite.js'; -import addon from '../src/index.js'; - -const id = addon.id; -const { test, addonTestCases, prepareServer } = setupTest( - { [id]: addon }, - { kinds: [{ type: 'default', options: { [id]: { demo: true } } }] } -); - -test.concurrent.for(addonTestCases)( - 'community-addon $variant', - async (addonTestCase, { page, ...ctx }) => { - const cwd = ctx.cwd(addonTestCase); - - // ...add files - if (addonTestCase.variant.startsWith('kit')) { - const target = path.resolve(cwd, 'src', 'routes', '+page.svelte'); - fixture({ name: '+page.svelte', target }); - } else { - const target = path.resolve(cwd, 'src', 'App.svelte'); - fixture({ name: 'App.svelte', target }); - } - - const { close } = await prepareServer({ cwd, page }); - // kill server process when we're done - ctx.onTestFinished(async () => await close()); - - // expectations - const textContent = await page.getByTestId('demo').textContent(); - expect(textContent).toContain('This is a text file made by the Community Addon Template demo!'); - } -); diff --git a/community-addon-template/tests/fixtures/+page.svelte b/community-addon-template/tests/fixtures/+page.svelte deleted file mode 100644 index 59a30f613..000000000 --- a/community-addon-template/tests/fixtures/+page.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - -{demo} diff --git a/community-addon-template/tests/fixtures/App.svelte b/community-addon-template/tests/fixtures/App.svelte deleted file mode 100644 index 13271b83e..000000000 --- a/community-addon-template/tests/fixtures/App.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - -{demo} diff --git a/community-addons/unocss.ts b/community-addons/unocss.ts deleted file mode 100644 index 2fcf820cd..000000000 --- a/community-addons/unocss.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CommunityAddon } from '../packages/addons/_config/community.ts'; - -export default { - id: 'unocss-svelte-add-on' -} satisfies CommunityAddon; diff --git a/community-addons/unplugin-icons.ts b/community-addons/unplugin-icons.ts deleted file mode 100644 index 2593656fb..000000000 --- a/community-addons/unplugin-icons.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CommunityAddon } from '../packages/addons/_config/community.ts'; - -export default { - id: 'unplugin-icons-svelte-add-on' -} satisfies CommunityAddon; diff --git a/documentation/docs/20-commands/10-sv-create.md b/documentation/docs/20-commands/10-sv-create.md index 2ac49088c..24ca665a0 100644 --- a/documentation/docs/20-commands/10-sv-create.md +++ b/documentation/docs/20-commands/10-sv-create.md @@ -29,6 +29,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