sv 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,19 +1,21 @@
1
1
  # sv - the Svelte CLI
2
2
 
3
- A command line interface (CLI) for creating and maintaining [Svelte](https://svelte.dev) applications. Just run...
3
+ A command line interface (CLI) for creating and maintaining [Svelte](https://svelte.dev) applications. Just run:
4
4
 
5
5
  ```bash
6
6
  npx sv
7
7
  ```
8
8
 
9
- ...and follow the prompts.
10
-
11
9
  ## Acknowledgements
12
10
 
13
11
  Thank you to [Christopher Brown](https://github.com/chbrown) who originally owned the `sv` name on npm for graciously allowing it to be used for this package. You can find the original `sv` package at [`@chbrown/sv`](https://www.npmjs.com/package/@chbrown/sv).
14
12
 
15
13
  This project was formed by merging the `create-svelte` and `svelte-add` CLIs. Thank you to [J](https://github.com/babichjacob) for starting the community-led `svelte-add` project and to the [`svelte-add` contributors](https://github.com/svelte-add/svelte-add/graphs/contributors).
16
14
 
15
+ ## Changelog
16
+
17
+ [Changelog](./CHANGELOG.md)
18
+
17
19
  ## License
18
20
 
19
21
  [MIT](../../LICENSE)
package/dist/bin.js CHANGED
@@ -25,7 +25,7 @@ import require$$0$3 from 'events';
25
25
  import { t as templates, c as create$2 } from './index-A89HFWzv.js';
26
26
 
27
27
  var name = "sv";
28
- var version = "0.5.3";
28
+ var version = "0.5.5";
29
29
  var type = "module";
30
30
  var description = "A CLI for creating and updating SvelteKit projects";
31
31
  var license = "MIT";
@@ -45201,56 +45201,59 @@ function __extends(d, b) {
45201
45201
  }
45202
45202
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45203
45203
  }
45204
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
45205
+ var e = new Error(message);
45206
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
45207
+ };
45208
+ var whitespace = /\s/;
45209
+ var number = /-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/;
45210
+ function spaces(n) {
45211
+ var result2 = "";
45212
+ while (n--)
45213
+ result2 += " ";
45214
+ return result2;
45215
+ }
45216
+ function rangeContains(range, index2) {
45217
+ return range.start <= index2 && index2 < range.end;
45218
+ }
45204
45219
  function getLocator$2(source, options2) {
45205
45220
  if (options2 === void 0) {
45206
45221
  options2 = {};
45207
45222
  }
45208
- var offsetLine = options2.offsetLine || 0;
45209
- var offsetColumn = options2.offsetColumn || 0;
45210
- var originalLines = source.split("\n");
45223
+ var _a2 = options2.offsetLine, offsetLine = _a2 === void 0 ? 0 : _a2, _b = options2.offsetColumn, offsetColumn = _b === void 0 ? 0 : _b;
45211
45224
  var start = 0;
45212
- var lineRanges = originalLines.map(function(line, i2) {
45225
+ var ranges = source.split("\n").map(function(line, i2) {
45213
45226
  var end = start + line.length + 1;
45214
45227
  var range = { start, end, line: i2 };
45215
45228
  start = end;
45216
45229
  return range;
45217
45230
  });
45218
45231
  var i = 0;
45219
- function rangeContains(range, index2) {
45220
- return range.start <= index2 && index2 < range.end;
45221
- }
45222
- function getLocation(range, index2) {
45223
- return { line: offsetLine + range.line, column: offsetColumn + index2 - range.start, character: index2 };
45224
- }
45225
- function locate2(search, startIndex) {
45232
+ function locator(search, index2) {
45226
45233
  if (typeof search === "string") {
45227
- search = source.indexOf(search, startIndex || 0);
45234
+ search = source.indexOf(search, index2 !== null && index2 !== void 0 ? index2 : 0);
45228
45235
  }
45229
- var range = lineRanges[i];
45236
+ if (search === -1)
45237
+ return void 0;
45238
+ var range = ranges[i];
45230
45239
  var d = search >= range.end ? 1 : -1;
45231
45240
  while (range) {
45232
- if (rangeContains(range, search))
45233
- return getLocation(range, search);
45241
+ if (rangeContains(range, search)) {
45242
+ return {
45243
+ line: offsetLine + range.line,
45244
+ column: offsetColumn + search - range.start,
45245
+ character: search
45246
+ };
45247
+ }
45234
45248
  i += d;
45235
- range = lineRanges[i];
45249
+ range = ranges[i];
45236
45250
  }
45237
45251
  }
45238
- return locate2;
45252
+ return locator;
45239
45253
  }
45240
45254
  function locate(source, search, options2) {
45241
- if (typeof options2 === "number") {
45242
- throw new Error("locate takes a { startIndex, offsetLine, offsetColumn } object as the third argument");
45243
- }
45244
45255
  return getLocator$2(source, options2)(search, options2 && options2.startIndex);
45245
45256
  }
45246
- var whitespace = /\s/;
45247
- var number = /-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/;
45248
- function spaces(n) {
45249
- var result2 = "";
45250
- while (n--)
45251
- result2 += " ";
45252
- return result2;
45253
- }
45254
45257
  function parse(str, opts) {
45255
45258
  var parser2 = new Parser3(str, opts);
45256
45259
  return parser2.value;
@@ -45535,7 +45538,7 @@ function stringifyValue(value, indentation, indentString, newlines) {
45535
45538
  return stringifyValue(element, indentation + indentString, indentString);
45536
45539
  });
45537
45540
  {
45538
- return "[\n".concat(indentation + indentString) + elements.join(",\n".concat(indentation + indentString)) + "\n".concat(indentation, "]");
45541
+ return "[".concat(indentation + indentString) + elements.join(",".concat(indentation + indentString)) + "".concat(indentation, "]");
45539
45542
  }
45540
45543
  } else if (type === "object") {
45541
45544
  var keys = Object.keys(value);
@@ -48690,6 +48693,17 @@ function addEslintConfigPrettier({ content }) {
48690
48693
  }
48691
48694
  return generateCode();
48692
48695
  }
48696
+ function addToDemoPage({ content }, path) {
48697
+ const { template, generateCode } = parseSvelte(content);
48698
+ for (const node of template.ast.childNodes) {
48699
+ if (node.type === "tag" && node.attribs["href"] === `/demo/${path}`) {
48700
+ return content;
48701
+ }
48702
+ }
48703
+ const newLine = template.source ? "\n" : "";
48704
+ const src = template.source + `${newLine}<a href="/demo/${path}">${path}</a>`;
48705
+ return generateCode({ template: src });
48706
+ }
48693
48707
 
48694
48708
  var eslint = defineAdder({
48695
48709
  id: "eslint",
@@ -50478,11 +50492,16 @@ ${sessionType}`);
50478
50492
  // DEMO
50479
50493
  // login/register
50480
50494
  {
50481
- name: ({ kit: kit2, typescript }) => `${kit2.routesDirectory}/demo/login/+page.server.${typescript ? "ts" : "js"}`,
50495
+ name: ({ kit: kit2 }) => `${kit2?.routesDirectory}/demo/+page.svelte`,
50496
+ condition: ({ options: options2 }) => options2.demo,
50497
+ content: (editor) => addToDemoPage(editor, "lucia")
50498
+ },
50499
+ {
50500
+ name: ({ kit: kit2, typescript }) => `${kit2.routesDirectory}/demo/lucia/login/+page.server.${typescript ? "ts" : "js"}`,
50482
50501
  condition: ({ options: options2 }) => options2.demo,
50483
50502
  content({ content, typescript, kit: kit2 }) {
50484
50503
  if (content) {
50485
- const filePath = `${kit2.routesDirectory}/demo/login/+page.server.${typescript ? "ts" : "js"}`;
50504
+ const filePath = `${kit2.routesDirectory}/demo/lucia/login/+page.server.${typescript ? "ts" : "js"}`;
50486
50505
  log.warn(`Existing ${picocolors.yellow(filePath)} file. Could not update.`);
50487
50506
  return content;
50488
50507
  }
@@ -50500,7 +50519,7 @@ ${sessionType}`);
50500
50519
  `)}
50501
50520
  export const load${ts(": PageServerLoad")} = async (event) => {
50502
50521
  if (event.locals.user) {
50503
- return redirect(302, '/demo');
50522
+ return redirect(302, '/demo/lucia');
50504
50523
  }
50505
50524
  return {};
50506
50525
  };
@@ -50547,7 +50566,7 @@ ${sessionType}`);
50547
50566
  secure: !dev
50548
50567
  });
50549
50568
 
50550
- return redirect(302, '/demo');
50569
+ return redirect(302, '/demo/lucia');
50551
50570
  },
50552
50571
  register: async (event) => {
50553
50572
  const formData = await event.request.formData();
@@ -50584,7 +50603,7 @@ ${sessionType}`);
50584
50603
  } catch (e) {
50585
50604
  return fail(500, { message: 'An error has occurred' });
50586
50605
  }
50587
- return redirect(302, '/demo');
50606
+ return redirect(302, '/demo/lucia');
50588
50607
  },
50589
50608
  };
50590
50609
 
@@ -50614,11 +50633,11 @@ ${sessionType}`);
50614
50633
  }
50615
50634
  },
50616
50635
  {
50617
- name: ({ kit: kit2 }) => `${kit2.routesDirectory}/demo/login/+page.svelte`,
50636
+ name: ({ kit: kit2 }) => `${kit2.routesDirectory}/demo/lucia/login/+page.svelte`,
50618
50637
  condition: ({ options: options2 }) => options2.demo,
50619
50638
  content({ content, dependencyVersion, typescript, kit: kit2 }) {
50620
50639
  if (content) {
50621
- const filePath = `${kit2.routesDirectory}/demo/login/+page.svelte`;
50640
+ const filePath = `${kit2.routesDirectory}/demo/lucia/login/+page.svelte`;
50622
50641
  log.warn(`Existing ${picocolors.yellow(filePath)} file. Could not update.`);
50623
50642
  return content;
50624
50643
  }
@@ -50630,11 +50649,11 @@ ${sessionType}`);
50630
50649
  },
50631
50650
  // logout
50632
50651
  {
50633
- name: ({ kit: kit2, typescript }) => `${kit2.routesDirectory}/demo/+page.server.${typescript ? "ts" : "js"}`,
50652
+ name: ({ kit: kit2, typescript }) => `${kit2.routesDirectory}/demo/lucia/+page.server.${typescript ? "ts" : "js"}`,
50634
50653
  condition: ({ options: options2 }) => options2.demo,
50635
50654
  content({ content, typescript, kit: kit2 }) {
50636
50655
  if (content) {
50637
- const filePath = `${kit2.routesDirectory}/demo/+page.server.${typescript ? "ts" : "js"}`;
50656
+ const filePath = `${kit2.routesDirectory}/demo/lucia/+page.server.${typescript ? "ts" : "js"}`;
50638
50657
  log.warn(`Existing ${picocolors.yellow(filePath)} file. Could not update.`);
50639
50658
  return content;
50640
50659
  }
@@ -50646,7 +50665,7 @@ ${sessionType}`);
50646
50665
  `)}
50647
50666
  export const load${ts(": PageServerLoad")} = async (event) => {
50648
50667
  if (!event.locals.user) {
50649
- return redirect(302, '/demo/login');
50668
+ return redirect(302, '/demo/lucia/login');
50650
50669
  }
50651
50670
  return { user: event.locals.user };
50652
50671
  };
@@ -50659,18 +50678,18 @@ ${sessionType}`);
50659
50678
  await auth.invalidateSession(event.locals.session.id);
50660
50679
  event.cookies.delete(auth.sessionCookieName, { path: '/' });
50661
50680
 
50662
- return redirect(302, '/demo/login');
50681
+ return redirect(302, '/demo/lucia/login');
50663
50682
  },
50664
50683
  };
50665
50684
  `;
50666
50685
  }
50667
50686
  },
50668
50687
  {
50669
- name: ({ kit: kit2 }) => `${kit2.routesDirectory}/demo/+page.svelte`,
50688
+ name: ({ kit: kit2 }) => `${kit2.routesDirectory}/demo/lucia/+page.svelte`,
50670
50689
  condition: ({ options: options2 }) => options2.demo,
50671
50690
  content({ content, dependencyVersion, typescript, kit: kit2 }) {
50672
50691
  if (content) {
50673
- const filePath = `${kit2.routesDirectory}/demo/+page.svelte`;
50692
+ const filePath = `${kit2.routesDirectory}/demo/lucia/+page.svelte`;
50674
50693
  log.warn(`Existing ${picocolors.yellow(filePath)} file. Could not update.`);
50675
50694
  return content;
50676
50695
  }
@@ -50684,7 +50703,7 @@ ${sessionType}`);
50684
50703
  nextSteps: ({ highlighter, options: options2 }) => {
50685
50704
  const steps = [`Run ${highlighter.command("npm run db:push")} to update your database schema`];
50686
50705
  if (options2.demo) {
50687
- steps.push(`Visit ${highlighter.route("/demo")} route to view the demo`);
50706
+ steps.push(`Visit ${highlighter.route("/demo/lucia")} route to view the demo`);
50688
50707
  }
50689
50708
  return steps;
50690
50709
  }
@@ -50835,7 +50854,7 @@ const DEFAULT_INLANG_PROJECT = {
50835
50854
  };
50836
50855
  const options$1 = defineAdderOptions({
50837
50856
  availableLanguageTags: {
50838
- question: `Which language tags would you like to support? ${picocolors.gray("(e.g. en,de-ch)")}`,
50857
+ question: `Which languages would you like to support? ${picocolors.gray("(e.g. en,de-ch)")}`,
50839
50858
  type: "string",
50840
50859
  default: "en",
50841
50860
  validate(input) {
@@ -50855,7 +50874,7 @@ const options$1 = defineAdderOptions({
50855
50874
  },
50856
50875
  demo: {
50857
50876
  type: "boolean",
50858
- default: false,
50877
+ default: true,
50859
50878
  question: "Do you want to include a demo?"
50860
50879
  }
50861
50880
  });
@@ -51005,9 +51024,14 @@ var paraglide = defineAdder({
51005
51024
  return generateCode();
51006
51025
  }
51007
51026
  },
51027
+ {
51028
+ name: ({ kit: kit2 }) => `${kit2?.routesDirectory}/demo/+page.svelte`,
51029
+ condition: ({ options: options2 }) => options2.demo,
51030
+ content: (editor) => addToDemoPage(editor, "paraglide")
51031
+ },
51008
51032
  {
51009
51033
  // add usage example
51010
- name: ({ kit: kit2 }) => `${kit2?.routesDirectory}/+page.svelte`,
51034
+ name: ({ kit: kit2 }) => `${kit2?.routesDirectory}/demo/paraglide/+page.svelte`,
51011
51035
  condition: ({ options: options2 }) => options2.demo,
51012
51036
  content({ content, options: options2, typescript }) {
51013
51037
  const { script, template, generateCode } = parseSvelte(content, { typescript });
@@ -51066,10 +51090,16 @@ ${links}
51066
51090
  fs$3.writeFileSync(fullFilePath, JSON.stringify(jsonData, null, 2) + "\n");
51067
51091
  }
51068
51092
  },
51069
- nextSteps: ({ highlighter }) => [
51070
- `Edit your messages in ${highlighter.path("messages/en.json")}`,
51071
- "Consider installing the Sherlock IDE Extension"
51072
- ]
51093
+ nextSteps: ({ highlighter }) => {
51094
+ const steps = [
51095
+ `Edit your messages in ${highlighter.path("messages/en.json")}`,
51096
+ "Consider installing the Sherlock IDE Extension"
51097
+ ];
51098
+ if (options$1.demo) {
51099
+ steps.push(`Visit ${highlighter.route("/demo/paraglide")} route to view the demo`);
51100
+ }
51101
+ return steps;
51102
+ }
51073
51103
  });
51074
51104
  const isValidLanguageTag = (languageTag) => (
51075
51105
  // Regex vendored in from https://github.com/opral/monorepo/blob/94c2298cc1da5378b908e4c160b0fa71a45caadb/inlang/source-code/versioned-interfaces/language-tag/src/interface.ts#L16
@@ -51358,11 +51388,43 @@ function addImports(ast, imports) {
51358
51388
  return nodes;
51359
51389
  }
51360
51390
 
51391
+ const plugins = [
51392
+ {
51393
+ id: "typography",
51394
+ package: "@tailwindcss/typography",
51395
+ version: "^0.5.15",
51396
+ identifier: "typography"
51397
+ },
51398
+ {
51399
+ id: "forms",
51400
+ package: "@tailwindcss/forms",
51401
+ version: "^0.5.9",
51402
+ identifier: "forms"
51403
+ },
51404
+ {
51405
+ id: "container-queries",
51406
+ package: "@tailwindcss/container-queries",
51407
+ version: "^0.1.1",
51408
+ identifier: "containerQueries"
51409
+ },
51410
+ {
51411
+ id: "aspect-ratio",
51412
+ package: "@tailwindcss/aspect-ratio",
51413
+ version: "^0.4.2",
51414
+ identifier: "aspectRatio"
51415
+ }
51416
+ ];
51417
+ const pluginPackages = plugins.map((x) => ({
51418
+ name: x.package,
51419
+ version: x.version,
51420
+ dev: true,
51421
+ condition: ({ options: options2 }) => options2.plugins.includes(x.id)
51422
+ }));
51361
51423
  const options = defineAdderOptions({
51362
51424
  plugins: {
51363
51425
  type: "multiselect",
51364
51426
  question: "Which plugins would you like to add?",
51365
- options: [{ value: "typography", label: "Typography" }],
51427
+ options: plugins.map((p) => ({ value: p.id, label: p.id, hint: p.package })),
51366
51428
  default: []
51367
51429
  }
51368
51430
  });
@@ -51375,18 +51437,13 @@ var tailwindcss = defineAdder({
51375
51437
  packages: [
51376
51438
  { name: "tailwindcss", version: "^3.4.9", dev: true },
51377
51439
  { name: "autoprefixer", version: "^10.4.20", dev: true },
51378
- {
51379
- name: "@tailwindcss/typography",
51380
- version: "^0.5.14",
51381
- dev: true,
51382
- condition: ({ options: options2 }) => options2.plugins.includes("typography")
51383
- },
51384
51440
  {
51385
51441
  name: "prettier-plugin-tailwindcss",
51386
51442
  version: "^0.6.5",
51387
51443
  dev: true,
51388
51444
  condition: ({ dependencyVersion }) => Boolean(dependencyVersion("prettier"))
51389
- }
51445
+ },
51446
+ ...pluginPackages
51390
51447
  ],
51391
51448
  files: [
51392
51449
  {
@@ -51399,17 +51456,23 @@ var tailwindcss = defineAdder({
51399
51456
  imports.addNamed(ast, "tailwindcss", { Config: "Config" }, true);
51400
51457
  root = common.typeAnnotateExpression(rootExport, "Config");
51401
51458
  }
51402
- const { astNode: exportDeclaration } = exports.defaultExport(ast, root ?? rootExport);
51403
- if (!typescript)
51459
+ const { astNode: exportDeclaration, value: node } = exports.defaultExport(
51460
+ ast,
51461
+ root ?? rootExport
51462
+ );
51463
+ const config = node.type === "TSAsExpression" ? node.expression : node;
51464
+ if (!typescript) {
51404
51465
  common.addJsDocTypeComment(exportDeclaration, "import('tailwindcss').Config");
51405
- const contentArray = object.property(rootExport, "content", array.createEmpty());
51466
+ }
51467
+ const contentArray = object.property(config, "content", array.createEmpty());
51406
51468
  array.push(contentArray, "./src/**/*.{html,js,svelte,ts}");
51407
- const themeObject = object.property(rootExport, "theme", object.createEmpty());
51469
+ const themeObject = object.property(config, "theme", object.createEmpty());
51408
51470
  object.property(themeObject, "extend", object.createEmpty());
51409
- const pluginsArray = object.property(rootExport, "plugins", array.createEmpty());
51410
- if (options2.plugins.includes("typography")) {
51411
- const requireCall = _function.call("require", ["@tailwindcss/typography"]);
51412
- array.push(pluginsArray, requireCall);
51471
+ const pluginsArray = object.property(config, "plugins", array.createEmpty());
51472
+ for (const plugin of plugins) {
51473
+ if (!options2.plugins.includes(plugin.id)) continue;
51474
+ imports.addDefault(ast, plugin.package, plugin.identifier);
51475
+ array.push(pluginsArray, { type: "Identifier", name: plugin.identifier });
51413
51476
  }
51414
51477
  return generateCode();
51415
51478
  }
@@ -51474,8 +51537,8 @@ var tailwindcss = defineAdder({
51474
51537
  const { data, generateCode } = parseJson(content);
51475
51538
  const PLUGIN_NAME = "prettier-plugin-tailwindcss";
51476
51539
  data.plugins ?? (data.plugins = []);
51477
- const plugins = data.plugins;
51478
- if (!plugins.includes(PLUGIN_NAME)) plugins.push(PLUGIN_NAME);
51540
+ const plugins2 = data.plugins;
51541
+ if (!plugins2.includes(PLUGIN_NAME)) plugins2.push(PLUGIN_NAME);
51479
51542
  return generateCode();
51480
51543
  },
51481
51544
  condition: ({ dependencyVersion }) => Boolean(dependencyVersion("prettier"))
@@ -51620,7 +51683,7 @@ async function runCommand(action) {
51620
51683
  } catch (e) {
51621
51684
  cancel("Operation failed.");
51622
51685
  if (e instanceof Error) {
51623
- console.error(e.message);
51686
+ console.error(e.stack ?? e);
51624
51687
  }
51625
51688
  }
51626
51689
  }
@@ -51633,27 +51696,24 @@ async function formatFiles(cwd, paths) {
51633
51696
  });
51634
51697
  }
51635
51698
  async function suggestInstallingDependencies(cwd) {
51636
- const detectedPm = detectSync({ cwd });
51637
- let selectedPm = detectedPm?.agent ?? null;
51638
- const agents = AGENTS.filter((agent) => !agent.includes("@"));
51639
- const options = agents.map((pm) => ({ value: pm, label: pm }));
51699
+ const detected = detectSync({ cwd });
51700
+ const agent = detected?.agent ?? getUserAgent() ?? null;
51701
+ const agents = AGENTS.filter((agent2) => !agent2.includes("@"));
51702
+ const options = agents.map((pm2) => ({ value: pm2, label: pm2 }));
51640
51703
  options.unshift({ label: "None", value: null });
51641
- if (!selectedPm) {
51642
- const pm = await select({
51643
- message: "Which package manager do you want to install dependencies with?",
51644
- options,
51645
- initialValue: getUserAgent()
51646
- });
51647
- if (isCancel(pm)) {
51648
- cancel("Operation cancelled.");
51649
- process$1$1.exit(1);
51650
- }
51651
- selectedPm = pm;
51704
+ const pm = await select({
51705
+ message: "Which package manager do you want to install dependencies with?",
51706
+ options,
51707
+ initialValue: agent
51708
+ });
51709
+ if (isCancel(pm)) {
51710
+ cancel("Operation cancelled.");
51711
+ process$1$1.exit(1);
51652
51712
  }
51653
- if (!selectedPm || !COMMANDS[selectedPm]) {
51713
+ if (!pm) {
51654
51714
  return "skipped";
51655
51715
  }
51656
- const { command, args } = constructCommand(COMMANDS[selectedPm].install, []);
51716
+ const { command, args } = constructCommand(COMMANDS[pm].install, []);
51657
51717
  const loadingSpinner = spinner();
51658
51718
  loadingSpinner.start("Installing dependencies...");
51659
51719
  await installDependencies(command, args, cwd);
@@ -51711,13 +51771,17 @@ function getGlobalPreconditions(cwd, projectType, adders) {
51711
51771
  if (projectType === "svelte" && !supportedEnvironments.svelte) return true;
51712
51772
  return false;
51713
51773
  });
51714
- if (addersForInvalidEnvironment.length == 0) {
51774
+ if (addersForInvalidEnvironment.length === 0) {
51715
51775
  return { success: true, message: void 0 };
51716
51776
  }
51717
- const messages = addersForInvalidEnvironment.map(
51718
- (a) => `"${a.id}" does not support "${projectType}"`
51719
- );
51720
- return { success: false, message: messages.join(" / ") };
51777
+ const messages = addersForInvalidEnvironment.map((a) => {
51778
+ if (projectType === "kit") {
51779
+ return `'${a.id}' does not support SvelteKit`;
51780
+ } else {
51781
+ return `'${a.id}' requires SvelteKit`;
51782
+ }
51783
+ });
51784
+ throw new Error(messages.join("\n"));
51721
51785
  }
51722
51786
  }
51723
51787
  ]
@@ -55178,7 +55242,7 @@ const addersOptions = getAdderOptionFlags();
55178
55242
  const communityDetails = [];
55179
55243
  const defaultPkgPath = up();
55180
55244
  const defaultCwd = defaultPkgPath ? path$3.dirname(defaultPkgPath) : void 0;
55181
- const add = new Command("add").description("applies specified adders into a project").argument("[adder...]", "adders to install").option("-C, --cwd <path>", "path to working directory", defaultCwd).option("--no-install", "skips installing dependencies").option("--no-preconditions", "skips validating preconditions").configureHelp(helpConfig).action((adderArgs, opts) => {
55245
+ const add = new Command("add").description("applies specified integrations into a project").argument("[integration...]", "integrations to install").option("-C, --cwd <path>", "path to working directory", defaultCwd).option("--no-install", "skips installing dependencies").option("--no-preconditions", "skips validating preconditions").configureHelp(helpConfig).action((adderArgs, opts) => {
55182
55246
  if (opts.cwd === void 0) {
55183
55247
  console.error(
55184
55248
  "Invalid workspace: Please verify that you are inside of a Svelte project. You can also specify the working directory with `--cwd <path>`"
@@ -55202,7 +55266,8 @@ const add = new Command("add").description("applies specified adders into a proj
55202
55266
  }
55203
55267
  const selectedAdders = transformAliases(specifiedAdders);
55204
55268
  runCommand(async () => {
55205
- await runAddCommand(options, selectedAdders);
55269
+ const { nextSteps } = await runAddCommand(options, selectedAdders);
55270
+ if (nextSteps) box(nextSteps, "Next steps");
55206
55271
  });
55207
55272
  });
55208
55273
  for (const option of addersOptions) {
@@ -55379,7 +55444,7 @@ Available options: ${communityAdderIds.join(", ")}`
55379
55444
  );
55380
55445
  if (installed) continue;
55381
55446
  const install = await confirm({
55382
- message: `The ${pc.bold(pc.cyan(adder.id))} adder requires ${pc.bold(pc.cyan(depId))} to also be installed. ${pc.green("Install it?")}`
55447
+ message: `The ${pc.bold(pc.cyan(adder.id))} integration requires ${pc.bold(pc.cyan(depId))} to also be setup. ${pc.green("Include it?")}`
55383
55448
  });
55384
55449
  if (install !== true) {
55385
55450
  cancel("Operation cancelled.");
@@ -55486,7 +55551,7 @@ Available options: ${communityAdderIds.join(", ")}`
55486
55551
  }
55487
55552
  }
55488
55553
  const highlighter = getHighlighter();
55489
- const nextStepsMsg = selectedAdders.filter(({ adder }) => adder.nextSteps).map(({ adder }) => {
55554
+ const nextSteps = selectedAdders.filter(({ adder }) => adder.nextSteps).map(({ adder }) => {
55490
55555
  let adderMessage = "";
55491
55556
  if (selectedAdders.length > 1) {
55492
55557
  adderMessage = `${pc.green(adder.id)}:
@@ -55499,8 +55564,8 @@ Available options: ${communityAdderIds.join(", ")}`
55499
55564
  });
55500
55565
  adderMessage += `- ${adderNextSteps.join("\n- ")}`;
55501
55566
  return adderMessage;
55502
- }).join("\n\n");
55503
- if (nextStepsMsg) box(nextStepsMsg, "Next steps");
55567
+ }).join("\n\n") || void 0;
55568
+ return { nextSteps };
55504
55569
  }
55505
55570
  async function runAdders({
55506
55571
  cwd,
@@ -55573,7 +55638,7 @@ function getAdderOptionFlags() {
55573
55638
  const preset = defaults.join(", ") || "none";
55574
55639
  const option = new Option(
55575
55640
  `--${id} [options...]`,
55576
- `${id} adder options ${pc.dim(`(preset: ${preset})`)}
55641
+ `${id} integration options ${pc.dim(`(preset: ${preset})`)}
55577
55642
  ${choices}`
55578
55643
  ).preset(preset).argParser((value, prev) => {
55579
55644
  prev ?? (prev = []);
@@ -55634,15 +55699,15 @@ const templateOption = new Option("--template <type>", "template to scaffold").c
55634
55699
  const ProjectPathSchema = string();
55635
55700
  const OptionsSchema = strictObject({
55636
55701
  checkTypes: optional(picklist(langs)),
55637
- adders: boolean(),
55702
+ integrations: boolean(),
55638
55703
  install: boolean(),
55639
55704
  template: optional(picklist(templateChoices))
55640
55705
  });
55641
- const create = new Command("create").description("scaffolds a new SvelteKit project").argument("[path]", "where the project will be created", process$1$1.cwd()).addOption(langOption).addOption(templateOption).option("--no-adders", "skips interactive adder installer").option("--no-install", "skips installing dependencies").configureHelp(helpConfig).action((projectPath, opts) => {
55706
+ const create = new Command("create").description("scaffolds a new SvelteKit project").argument("[path]", "where the project will be created", process$1$1.cwd()).addOption(langOption).addOption(templateOption).option("--no-integrations", "skips interactive integration installer").option("--no-install", "skips installing dependencies").configureHelp(helpConfig).action((projectPath, opts) => {
55642
55707
  const cwd = parse$8(ProjectPathSchema, projectPath);
55643
55708
  const options = parse$8(OptionsSchema, opts);
55644
55709
  runCommand(async () => {
55645
- const { directory } = await createProject(cwd, options);
55710
+ const { directory, integrationNextSteps } = await createProject(cwd, options);
55646
55711
  const highlight = (str) => pc.bold(pc.cyan(str));
55647
55712
  let i = 1;
55648
55713
  const initialSteps = [];
@@ -55664,6 +55729,7 @@ const create = new Command("create").description("scaffolds a new SvelteKit proj
55664
55729
  `Stuck? Visit us at ${pc.cyan("https://svelte.dev/chat")}`
55665
55730
  ];
55666
55731
  box(steps.join("\n"), "Project next steps");
55732
+ if (integrationNextSteps) box(integrationNextSteps, "Integration next steps");
55667
55733
  });
55668
55734
  });
55669
55735
  async function createProject(cwd, options) {
@@ -55719,27 +55785,25 @@ async function createProject(cwd, options) {
55719
55785
  }
55720
55786
  }
55721
55787
  );
55722
- const initSpinner = spinner();
55723
- initSpinner.start("Initializing template");
55724
55788
  const projectPath = path$3.resolve(directory);
55725
55789
  create$2(projectPath, {
55726
55790
  name: path$3.basename(projectPath),
55727
55791
  template,
55728
55792
  types: language
55729
55793
  });
55730
- initSpinner.stop("Project created");
55731
- if (options.adders) {
55732
- await runAddCommand(
55794
+ log$1.success("Project created");
55795
+ let integrationNextSteps;
55796
+ if (options.integrations) {
55797
+ const { nextSteps } = await runAddCommand(
55733
55798
  { cwd: projectPath, install: false, preconditions: true, community: [] },
55734
55799
  []
55735
55800
  );
55801
+ integrationNextSteps = nextSteps;
55736
55802
  }
55737
55803
  if (options.install) {
55738
55804
  await suggestInstallingDependencies(projectPath);
55739
55805
  }
55740
- return {
55741
- directory: projectPath
55742
- };
55806
+ return { directory: projectPath, integrationNextSteps };
55743
55807
  }
55744
55808
 
55745
55809
  const migrate = new Command("migrate").description("a CLI for migrating Svelte(Kit) codebases").argument("<migration>", "migration to run").option("-C, --cwd <path>", "path to working directory", process$1$1.cwd()).configureHelp({
@@ -55788,7 +55852,7 @@ function runCheck(cwd, args) {
55788
55852
  }
55789
55853
  }
55790
55854
 
55791
- program.name(pkg.name).version(pkg.version, "-v").configureHelp(helpConfig);
55855
+ program.name(pkg.name).version(pkg.version, "-v, --version").configureHelp(helpConfig);
55792
55856
  program.addCommand(create).addCommand(add).addCommand(migrate).addCommand(check);
55793
55857
  program.parse();
55794
55858
  //# sourceMappingURL=bin.js.map