sv 0.12.7 → 0.13.0

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/dist/bin.mjs CHANGED
@@ -1,19 +1,18 @@
1
1
  #!/usr/bin/env node
2
- import { f as program, l as from, r as detectPackageManager, u as Command } from "./package-manager-BYzDyeam.mjs";
3
- import { a as helpConfig, i as forwardExitCode, n as add, o as name, r as create, s as version } from "./engine-v9g2eGJ2.mjs";
2
+ import { f as program, l as from, r as detectPackageManager, u as Command } from "./package-manager-BU-MLhop.mjs";
3
+ import { a as helpConfig, i as forwardExitCode, n as add, o as name, r as create, s as version } from "./engine-DOKagHfI.mjs";
4
4
  import { color, resolveCommand } from "@sveltejs/sv-utils";
5
5
  import process from "node:process";
6
6
  import { execSync } from "node:child_process";
7
-
8
7
  //#region src/cli/check.ts
9
- const check = new Command("check").description("a CLI for checking your Svelte code").allowUnknownOption(true).allowExcessArguments(true).option("-C, --cwd <path>", "path to working directory", process.cwd()).helpOption(false).action(async (options, check$1) => {
10
- const cwd$1 = options.cwd;
11
- const args = check$1.args;
12
- await runCheck(cwd$1, args);
8
+ const check = new Command("check").description("a CLI for checking your Svelte code").allowUnknownOption(true).allowExcessArguments(true).option("-C, --cwd <path>", "path to working directory", process.cwd()).helpOption(false).action(async (options, check) => {
9
+ const cwd = options.cwd;
10
+ const args = check.args;
11
+ await runCheck(cwd, args);
13
12
  });
14
- async function runCheck(cwd$1, args) {
15
- const pm = await detectPackageManager(cwd$1);
16
- if (!from(cwd$1, "svelte-check", true)) {
13
+ async function runCheck(cwd, args) {
14
+ const pm = await detectPackageManager(cwd);
15
+ if (!from(cwd, "svelte-check", true)) {
17
16
  const cmd = resolveCommand(pm, "add", ["-D", "svelte-check"]);
18
17
  console.error(`'svelte-check' is not installed locally. Install it with: ${color.command(`${cmd.command} ${cmd.args.join(" ")}`)}`);
19
18
  process.exit(1);
@@ -26,7 +25,7 @@ async function runCheck(cwd$1, args) {
26
25
  const cmd = resolveCommand(pm, "execute-local", ["svelte-check", ...args]);
27
26
  execSync(`${cmd.command} ${cmd.args.join(" ")}`, {
28
27
  stdio: "inherit",
29
- cwd: cwd$1
28
+ cwd
30
29
  });
31
30
  } catch (error) {
32
31
  forwardExitCode(error);
@@ -34,33 +33,31 @@ async function runCheck(cwd$1, args) {
34
33
  if (args.includes("--help")) check.help();
35
34
  }
36
35
  }
37
-
38
36
  //#endregion
39
37
  //#region src/cli/migrate.ts
40
38
  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.cwd()).action(async (migration, options) => {
41
39
  await runMigrate(options.cwd, [migration]);
42
40
  });
43
- async function runMigrate(cwd$1, args) {
44
- const pm = await detectPackageManager(cwd$1);
41
+ async function runMigrate(cwd, args) {
42
+ const pm = await detectPackageManager(cwd);
45
43
  try {
46
44
  const cmdArgs = ["svelte-migrate@latest", ...args];
47
45
  if (pm === "npm") cmdArgs.unshift("--yes");
48
46
  const cmd = resolveCommand(pm, "execute", cmdArgs);
49
47
  execSync(`${cmd.command} ${cmd.args.join(" ")}`, {
50
48
  stdio: "inherit",
51
- cwd: cwd$1
49
+ cwd
52
50
  });
53
51
  } catch (error) {
54
52
  forwardExitCode(error);
55
53
  }
56
54
  }
57
-
58
55
  //#endregion
59
56
  //#region bin.ts
60
57
  console.log();
61
58
  program.name(name).version(version, "-v, --version").configureHelp(helpConfig);
62
59
  program.addCommand(create).addCommand(add).addCommand(migrate).addCommand(check);
60
+ if (process.argv.includes("--help") || process.argv.includes("-h")) program.addHelpText("after", () => "\n" + create.helpInformation());
63
61
  program.parse();
64
-
65
62
  //#endregion
66
- export { };
63
+ export {};