Skip to content

Commit 1ca9513

Browse files
committed
Draft A (done)
1 parent 01b074d commit 1ca9513

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

documentation/docs/20-commands/10-sv-create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Which project template to use:
1919
- `minimal` — barebones scaffolding for your new app
2020
- `demo` — showcase app with a word guessing game that works without JavaScript
2121
- `library` — template for a Svelte library, set up with `svelte-package`
22-
- `add-on` — template for a community add-on, ready to be tested & published
22+
- `addon` — template for a community add-on, ready to be tested & published
2323

2424
### `--types <option>`
2525

packages/cli/commands/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ async function createProject(cwd: ProjectPath, options: Options) {
182182
};
183183

184184
// TODO JYC: no add-ons for addon template
185-
if (options.addOns && options.template !== 'add-on') {
185+
if (options.addOns && options.template !== 'addon') {
186186
// `runAddCommand` includes installing dependencies
187187
const { nextSteps, packageManager: pm } = await runAddCommand(
188188
{

packages/create/shared/+addon/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Create the project with the following script:
2020
npm run create
2121
```
2222

23-
This will create a SvelteKit project in the `testing` directory.
23+
This will create a SvelteKit project in the `demo` directory.
2424

2525
To execute the add-on, run:
2626

packages/create/templates/addon/src/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ export default defineAddon({
3232
sv.file('src/routes/+page.svelte', (content) => {
3333
if (!options.demo) return content;
3434
const { script, generateCode, template } = parseSvelte(content, { typescript });
35-
imports.addDefault(script.ast, { from: '$lib/add-on/DemoComponent.svelte', as: 'DemoComponent' });
36-
return generateCode({ script: script.generateCode(), template: template.generateCode() + '\n\n<DemoComponent />' });
35+
imports.addDefault(script.ast, {
36+
from: '$lib/add-on/DemoComponent.svelte',
37+
as: 'DemoComponent'
38+
});
39+
return generateCode({
40+
script: script.generateCode(),
41+
template: template.generateCode() + '\n\n<DemoComponent />'
42+
});
3743
});
3844
}
3945
});

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
packages:
22
- 'packages/*'
33
- '!.test-tmp/**'
4-
- 'temp'
4+
- '!new-add-on/**'

0 commit comments

Comments
 (0)