create-seedcord 0.1.0-next.0 → 0.1.1

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
@@ -19,6 +19,8 @@ yarn create seedcord my-bot
19
19
 
20
20
  It asks where the project goes, how Discord reaches your bot, what the bot should react to, your bot token, and an accent color. Then it writes the project, installs, formats, generates your command types, and makes the first commit.
21
21
 
22
+ On Windows, run it from Windows Terminal. The prompts fall back to ASCII in `cmd.exe`, so the boxes draw as `T`, `|`, and `o`.
23
+
22
24
  ## Flags
23
25
 
24
26
  Every question has a flag. Pass them all to skip all questions. `--help` prints the list.
package/dist/index.mjs CHANGED
@@ -1922,7 +1922,7 @@ const chalk = createChalk();
1922
1922
  const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1923
1923
 
1924
1924
  //#endregion
1925
- //#region ../../packages/errors/dist/SeedcordError-Ce7zH47D.mjs
1925
+ //#region ../../packages/errors/dist/SeedcordError-B5hcAoT3.mjs
1926
1926
  /**
1927
1927
  * All Seedcord error codes.
1928
1928
  */
@@ -2127,7 +2127,7 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
2127
2127
  SeedcordErrorCode[SeedcordErrorCode["CliBuildFailed"] = 3117] = "CliBuildFailed";
2128
2128
  /** Unable to write the generated bootstrap file. */
2129
2129
  SeedcordErrorCode[SeedcordErrorCode["CliBootstrapWriteFailed"] = 3118] = "CliBootstrapWriteFailed";
2130
- /** Config tsconfig must be a string when provided. */
2130
+ /** Config hmr typecheck tsconfig must be a string when provided. */
2131
2131
  SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidTsconfig"] = 3119] = "CliConfigInvalidTsconfig";
2132
2132
  /** Config hmr options must be an object when provided. */
2133
2133
  SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmr"] = 3120] = "CliConfigInvalidHmr";
@@ -2161,6 +2161,10 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
2161
2161
  SeedcordErrorCode[SeedcordErrorCode["CliTunnelNotVerified"] = 3134] = "CliTunnelNotVerified";
2162
2162
  /** The tunnel URL never answered its health probe. */
2163
2163
  SeedcordErrorCode[SeedcordErrorCode["CliTunnelUnreachable"] = 3135] = "CliTunnelUnreachable";
2164
+ /** Config hmr typecheck flag must be a boolean or object when provided. */
2165
+ SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmrTypecheck"] = 3136] = "CliConfigInvalidHmrTypecheck";
2166
+ /** Config idleAnimation flag must be a boolean when provided. */
2167
+ SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidIdleAnimation"] = 3137] = "CliConfigInvalidIdleAnimation";
2164
2168
  /** A create prompt was cancelled (Ctrl-C), and nothing has been written yet. */
2165
2169
  SeedcordErrorCode[SeedcordErrorCode["CreateCancelled"] = 3201] = "CreateCancelled";
2166
2170
  /** A flag supplied an answer for a question the earlier answers skip. */
@@ -2277,10 +2281,12 @@ const messages = {
2277
2281
  [3116]: (hint) => `Unable to resolve a tsconfig for builds (${hint}). Provide build.tsconfig or add tsconfig.build.json / tsconfig.json.`,
2278
2282
  [3117]: (diagnostics) => `TypeScript build failed:\n${diagnostics}`,
2279
2283
  [3118]: (targetPath, reason) => `Failed to write bootstrap file at ${targetPath}: ${reason}`,
2280
- [3119]: () => "Config `tsconfig` must be a string when provided.",
2284
+ [3119]: () => "Config `hmr.typecheck.tsconfig` must be a string when provided.",
2281
2285
  [3120]: () => "Config `hmr` must be an object when provided.",
2282
2286
  [3121]: () => "Config `hmr.restart` must be an array of strings when provided.",
2283
2287
  [3131]: () => "Config `hmr.rollback` must be a boolean when provided.",
2288
+ [3136]: () => "Config `hmr.typecheck` must be a boolean or an object when provided.",
2289
+ [3137]: () => "Config `idleAnimation` must be a boolean when provided.",
2284
2290
  [3122]: (route, firstFile, secondFile) => `Two commands resolve to the same slash route \`${route}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
2285
2291
  [3123]: (dir, reason) => `Could not read the commands directory ${dir} during codegen. ${reason}`,
2286
2292
  [3124]: (kind, name, firstFile, secondFile) => `Two ${kind} context-menu commands share the name \`${name}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
@@ -2429,7 +2435,7 @@ function validateDiscordToken(raw) {
2429
2435
 
2430
2436
  //#endregion
2431
2437
  //#region src/cli/banner.ts
2432
- function banner(version = "0.1.0-next.0") {
2438
+ function banner(version = "0.1.1") {
2433
2439
  const wordmark = `${paint.flesh.bold("seed")}${paint.rind.bold("cord")}`;
2434
2440
  if (version === void 0) return wordmark;
2435
2441
  return `${wordmark}${paint.pith(` • v${version}`)}`;
@@ -3668,14 +3674,35 @@ function failureLines(captured) {
3668
3674
  const named = captured.filter((line) => NAMES_THE_CAUSE.test(line));
3669
3675
  return named.length > 0 ? named.slice(0, KEPT_LINES) : captured.slice(-12);
3670
3676
  }
3677
+ const SHIMS = /* @__PURE__ */ new Set([
3678
+ "npm",
3679
+ "npx",
3680
+ "pnpm",
3681
+ "yarn",
3682
+ "bun",
3683
+ "deno"
3684
+ ]);
3685
+ function spawnSpec(command, args, platform) {
3686
+ const shell = platform === "win32" && SHIMS.has(command);
3687
+ if (!shell) return {
3688
+ command,
3689
+ args,
3690
+ shell
3691
+ };
3692
+ return {
3693
+ command: [command, ...args].join(" "),
3694
+ args: [],
3695
+ shell
3696
+ };
3697
+ }
3671
3698
  async function execRunner(...[command, args, cwd]) {
3672
3699
  const spoken = [command, ...args].join(" ");
3673
3700
  const width = lineWidth();
3674
- const shell = process$1.platform === "win32";
3701
+ const spec = spawnSpec(command, args, process$1.platform);
3675
3702
  return new Promise((resolve, reject) => {
3676
- const child = spawn(command, args, {
3703
+ const child = spawn(spec.command, spec.args, {
3677
3704
  cwd,
3678
- shell
3705
+ shell: spec.shell
3679
3706
  });
3680
3707
  const captured = [];
3681
3708
  const take = (chunk) => {
@@ -11066,6 +11093,25 @@ async function writeTree(target, files) {
11066
11093
  await writeFile(destination, file.contents, "utf8");
11067
11094
  }
11068
11095
  }
11096
+ async function runGitSteps(input, run) {
11097
+ try {
11098
+ await input.steps.run({
11099
+ running: "Setting up git",
11100
+ done: "Committed"
11101
+ }, async () => {
11102
+ await run("git", ["init"], input.target);
11103
+ await run("git", ["add", "."], input.target);
11104
+ await run("git", [
11105
+ "commit",
11106
+ "-m",
11107
+ "chore: create seedcord bot"
11108
+ ], input.target);
11109
+ });
11110
+ return null;
11111
+ } catch (error) {
11112
+ return `${Error.isError(error) ? error.message : String(error)} The project is complete and uncommitted.`;
11113
+ }
11114
+ }
11069
11115
  async function runInstallSteps(input, run, isGateway) {
11070
11116
  const { agent, steps, target } = input;
11071
11117
  const deps = addCommand(agent, runtimePackages(isGateway), false);
@@ -11116,23 +11162,12 @@ async function scaffold(input, run) {
11116
11162
  steps.skip("Code formatted");
11117
11163
  steps.skip("Types generated");
11118
11164
  }
11119
- if (plan.init) await steps.run({
11120
- running: "Setting up git",
11121
- done: "Committed"
11122
- }, async () => {
11123
- await run("git", ["init"], input.target);
11124
- await run("git", ["add", "."], input.target);
11125
- await run("git", [
11126
- "commit",
11127
- "-m",
11128
- "chore: create seedcord bot"
11129
- ], input.target);
11130
- });
11165
+ let gitNotice = plan.notice;
11166
+ if (plan.init) gitNotice = await runGitSteps(input, run) ?? gitNotice;
11131
11167
  else steps.skip("Committed");
11132
11168
  return {
11133
11169
  installed: input.install,
11134
- committed: plan.init,
11135
- gitNotice: plan.notice
11170
+ gitNotice
11136
11171
  };
11137
11172
  } catch (error) {
11138
11173
  await rm(input.target, {