Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions community-adder-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"type": "module",
"exports": "./src/index.js",
"keywords": [
"sv-adder",
"sv-add",
"sv-integration",
"svelte-add-on",
"sv"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion community-adders/unocss.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CommunityAdder } from '../packages/adders/_config/community.ts';

export default {
id: 'unocss-svelte-integration'
id: 'unocss-svelte-add-on'
} satisfies CommunityAdder;
2 changes: 1 addition & 1 deletion community-adders/unplugin-icons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CommunityAdder } from '../packages/adders/_config/community.ts';

export default {
id: 'unplugin-icons-svelte-integration'
id: 'unplugin-icons-svelte-add-on'
} satisfies CommunityAdder;
4 changes: 1 addition & 3 deletions documentation/docs/20-commands/10-sv-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ Whether and how to add typechecking to the project:

Prevent typechecking from being added. Not recommended!

### `--no-integrations`

<!-- TODO should be renamed to `--no-addons` -->
### `--no-add-ons`

Run the command without the interactive add-ons prompt

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
- fix: improve formatting on new script files ([#96](https://github.com/sveltejs/cli/pull/96))


- fix: dont check preconditions if no integration selected ([#125](https://github.com/sveltejs/cli/pull/125))
- fix: dont check preconditions if no add-on selected ([#125](https://github.com/sveltejs/cli/pull/125))


- feat: improved homescreen for adding or creating projects ([#112](https://github.com/sveltejs/cli/pull/112))
Expand All @@ -127,4 +127,4 @@
### Patch Changes


- feat: paraglide integration ([#67](https://github.com/sveltejs/cli/pull/67))
- feat: paraglide add-on ([#67](https://github.com/sveltejs/cli/pull/67))
10 changes: 5 additions & 5 deletions packages/cli/commands/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const defaultPkgPath = pkg.up();
const defaultCwd = defaultPkgPath ? path.dirname(defaultPkgPath) : undefined;

export const add = new Command('add')
.description('applies specified integrations into a project')
.argument('[integration...]', 'integrations to install')
.description('applies specified add-ons into a project')
.argument('[add-on...]', 'add-ons to install')
.option('-C, --cwd <path>', 'path to working directory', defaultCwd)
.option('--no-install', 'skip installing dependencies')
.option('--no-preconditions', 'skip validating preconditions')
Expand Down Expand Up @@ -317,7 +317,7 @@ export async function runAddCommand(

// prompt to install the dependent
const install = await p.confirm({
message: `The ${pc.bold(pc.cyan(adder.id))} integration requires ${pc.bold(pc.cyan(depId))} to also be setup. ${pc.green('Include it?')}`
message: `The ${pc.bold(pc.cyan(adder.id))} add-on requires ${pc.bold(pc.cyan(depId))} to also be setup. ${pc.green('Include it?')}`
});
if (install !== true) {
p.cancel('Operation cancelled.');
Expand Down Expand Up @@ -430,7 +430,7 @@ export async function runAddCommand(

// apply adders
const filesToFormat = await runAdders({ cwd: options.cwd, packageManager, official, community });
p.log.success('Successfully setup integrations');
p.log.success('Successfully setup add-ons');

// install dependencies
if (packageManager && options.install) {
Expand Down Expand Up @@ -589,7 +589,7 @@ function getAdderOptionFlags(): Option[] {
const preset = defaults.join(', ') || 'none';
const option = new Option(
`--${id} [options...]`,
`${id} integration options ${pc.dim(`(preset: ${preset})`)}\n${choices}`
`${id} add-on options ${pc.dim(`(preset: ${preset})`)}\n${choices}`
)
// presets are applied when `--adder` is specified with no options
.preset(preset)
Expand Down
20 changes: 10 additions & 10 deletions packages/cli/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const OptionsSchema = v.strictObject({
v.optional(v.union([v.picklist(langs), v.boolean()])),
v.transform((lang) => langMap[String(lang)])
),
integrations: v.boolean(),
addOns: v.boolean(),
install: v.boolean(),
template: v.optional(v.picklist(templateChoices))
});
Expand All @@ -45,14 +45,14 @@ export const create = new Command('create')
.addOption(templateOption)
.addOption(langOption)
.option('--no-types')
.option('--no-integrations', 'skip interactive integration installer')
.option('--no-add-ons', 'skips interactive add-on installer')
.option('--no-install', 'skip installing dependencies')
.configureHelp(common.helpConfig)
.action((projectPath, opts) => {
const cwd = v.parse(ProjectPathSchema, projectPath);
const options = v.parse(OptionsSchema, opts);
common.runCommand(async () => {
const { directory, integrationNextSteps, packageManager } = await createProject(cwd, options);
const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options);
const highlight = (str: string) => pc.bold(pc.cyan(str));

let i = 1;
Expand Down Expand Up @@ -81,7 +81,7 @@ export const create = new Command('create')
];

p.box(steps.join('\n'), 'Project next steps');
if (integrationNextSteps) p.box(integrationNextSteps, 'Integration next steps');
if (addOnNextSteps) p.box(addOnNextSteps, 'Add-on next steps');
});
});

Expand Down Expand Up @@ -152,30 +152,30 @@ async function createProject(cwd: string, options: Options) {
p.log.success('Project created');

let packageManager: AgentName | undefined | null;
let integrationNextSteps: string | undefined;
let addOnNextSteps: string | undefined;
const installDeps = async () => {
packageManager = await common.packageManagerPrompt(projectPath);
if (packageManager) await common.installDependencies(packageManager, projectPath);
};

if (options.integrations) {
if (options.addOns) {
// `runAddCommand` includes installing dependencies
const { nextSteps, packageManager: pm } = await runAddCommand(
{ cwd: projectPath, install: options.install, preconditions: true, community: [] },
[]
);
packageManager = pm;
integrationNextSteps = nextSteps;
addOnNextSteps = nextSteps;
} else if (options.install) {
// `--no-integrations` was set, so we'll prompt to install deps manually
// `--no-add-ons` was set, so we'll prompt to install deps manually
await installDeps();
}

// no integrations were selected (which means the install prompt was skipped in `runAddCommand`),
// no add-ons were selected (which means the install prompt was skipped in `runAddCommand`),
// so we'll prompt to install
if (packageManager === null && options.install) {
await installDeps();
}

return { directory: projectPath, integrationNextSteps, packageManager };
return { directory: projectPath, addOnNextSteps, packageManager };
}