create-astro 3.1.3 → 3.1.4

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.
Files changed (2) hide show
  1. package/dist/index.js +37 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -368,7 +368,7 @@ function printHelp({
368
368
  if (headline) {
369
369
  message.push(
370
370
  linebreak(),
371
- `${title(commandName)} ${color.green(`v${"3.1.3"}`)} ${headline}`
371
+ `${title(commandName)} ${color.green(`v${"3.1.4"}`)} ${headline}`
372
372
  );
373
373
  }
374
374
  if (usage) {
@@ -468,6 +468,7 @@ async function getContext(argv) {
468
468
  }
469
469
 
470
470
  // src/actions/dependencies.ts
471
+ import { color as color2 } from "@astrojs/cli-kit";
471
472
  import { execa } from "execa";
472
473
  async function dependencies(ctx) {
473
474
  let deps = ctx.install ?? ctx.yes;
@@ -488,10 +489,26 @@ async function dependencies(ctx) {
488
489
  await spinner({
489
490
  start: `Dependencies installing with ${ctx.pkgManager}...`,
490
491
  end: "Dependencies installed",
491
- while: () => install({ pkgManager: ctx.pkgManager, cwd: ctx.cwd }).catch((e) => {
492
- error("error", e);
493
- process.exit(1);
494
- })
492
+ while: () => {
493
+ return Promise.reject("Unknown error").catch((e) => {
494
+ error("error", e);
495
+ error(
496
+ "error",
497
+ `Dependencies failed to install, please run ${color2.bold(
498
+ ctx.pkgManager + " install"
499
+ )} to install them manually after setup.`
500
+ );
501
+ });
502
+ return install({ pkgManager: ctx.pkgManager, cwd: ctx.cwd }).catch((e) => {
503
+ error("error", e);
504
+ error(
505
+ "error",
506
+ `Dependencies failed to install, please run ${color2.bold(
507
+ ctx.pkgManager + " install"
508
+ )} to install them manually after setup.`
509
+ );
510
+ });
511
+ }
495
512
  });
496
513
  } else {
497
514
  await info(
@@ -512,7 +529,7 @@ async function install({ pkgManager, cwd }) {
512
529
  // src/actions/git.ts
513
530
  import fs from "node:fs";
514
531
  import path from "node:path";
515
- import { color as color2 } from "@astrojs/cli-kit";
532
+ import { color as color3 } from "@astrojs/cli-kit";
516
533
  import { execa as execa2 } from "execa";
517
534
  async function git(ctx) {
518
535
  if (fs.existsSync(path.join(ctx.cwd, ".git"))) {
@@ -544,7 +561,7 @@ async function git(ctx) {
544
561
  } else {
545
562
  await info(
546
563
  ctx.yes === false ? "git [skip]" : "Sounds good!",
547
- `You can always run ${color2.reset("git init")}${color2.dim(" manually.")}`
564
+ `You can always run ${color3.reset("git init")}${color3.dim(" manually.")}`
548
565
  );
549
566
  }
550
567
  }
@@ -591,7 +608,7 @@ function help() {
591
608
  }
592
609
 
593
610
  // src/actions/intro.ts
594
- import { color as color3, label as label2 } from "@astrojs/cli-kit";
611
+ import { color as color4, label as label2 } from "@astrojs/cli-kit";
595
612
  import { random } from "@astrojs/cli-kit/utils";
596
613
  async function intro(ctx) {
597
614
  if (!ctx.skipHouston) {
@@ -599,8 +616,8 @@ async function intro(ctx) {
599
616
  [
600
617
  "Welcome",
601
618
  "to",
602
- label2("astro", color3.bgGreen, color3.black),
603
- color3.green(`v${ctx.version}`) + ",",
619
+ label2("astro", color4.bgGreen, color4.black),
620
+ color4.green(`v${ctx.version}`) + ",",
604
621
  `${ctx.username}!`
605
622
  ],
606
623
  random(welcome)
@@ -624,7 +641,7 @@ async function next(ctx) {
624
641
  }
625
642
 
626
643
  // src/actions/project-name.ts
627
- import { color as color4, generateProjectName } from "@astrojs/cli-kit";
644
+ import { color as color5, generateProjectName } from "@astrojs/cli-kit";
628
645
  import path3 from "node:path";
629
646
 
630
647
  // src/actions/shared.ts
@@ -678,7 +695,7 @@ async function projectName(ctx) {
678
695
  await checkCwd(ctx.cwd);
679
696
  if (!ctx.cwd || !isEmpty(ctx.cwd)) {
680
697
  if (!isEmpty(ctx.cwd)) {
681
- await info("Hmm...", `${color4.reset(`"${ctx.cwd}"`)}${color4.dim(` is not empty!`)}`);
698
+ await info("Hmm...", `${color5.reset(`"${ctx.cwd}"`)}${color5.dim(` is not empty!`)}`);
682
699
  }
683
700
  const { name } = await ctx.prompt({
684
701
  name: "name",
@@ -716,13 +733,13 @@ async function checkCwd(cwd) {
716
733
  const empty = cwd && isEmpty(cwd);
717
734
  if (empty) {
718
735
  log("");
719
- await info("dir", `Using ${color4.reset(cwd)}${color4.dim(" as project directory")}`);
736
+ await info("dir", `Using ${color5.reset(cwd)}${color5.dim(" as project directory")}`);
720
737
  }
721
738
  return empty;
722
739
  }
723
740
 
724
741
  // src/actions/template.ts
725
- import { color as color5 } from "@astrojs/cli-kit";
742
+ import { color as color6 } from "@astrojs/cli-kit";
726
743
  import { downloadTemplate } from "giget";
727
744
  import fs3 from "node:fs";
728
745
  import path4 from "node:path";
@@ -742,7 +759,7 @@ async function template(ctx) {
742
759
  });
743
760
  ctx.template = tmpl;
744
761
  } else {
745
- await info("tmpl", `Using ${color5.reset(ctx.template)}${color5.dim(" as project template")}`);
762
+ await info("tmpl", `Using ${color6.reset(ctx.template)}${color6.dim(" as project template")}`);
746
763
  }
747
764
  if (ctx.dryRun) {
748
765
  await info("--dry-run", `Skipping template copying`);
@@ -795,13 +812,13 @@ async function copyTemplate(tmpl, ctx) {
795
812
  } catch (err) {
796
813
  fs3.rmdirSync(ctx.cwd);
797
814
  if (err.message.includes("404")) {
798
- throw new Error(`Template ${color5.reset(tmpl)} ${color5.dim("does not exist!")}`);
815
+ throw new Error(`Template ${color6.reset(tmpl)} ${color6.dim("does not exist!")}`);
799
816
  } else {
800
817
  throw new Error(err.message);
801
818
  }
802
819
  }
803
820
  if (fs3.readdirSync(ctx.cwd).length === 0) {
804
- throw new Error(`Template ${color5.reset(tmpl)} ${color5.dim("is empty!")}`);
821
+ throw new Error(`Template ${color6.reset(tmpl)} ${color6.dim("is empty!")}`);
805
822
  }
806
823
  const removeFiles = FILES_TO_REMOVE.map(async (file) => {
807
824
  const fileLoc = path4.resolve(path4.join(ctx.cwd, file));
@@ -820,7 +837,7 @@ async function copyTemplate(tmpl, ctx) {
820
837
  }
821
838
 
822
839
  // src/actions/typescript.ts
823
- import { color as color6 } from "@astrojs/cli-kit";
840
+ import { color as color7 } from "@astrojs/cli-kit";
824
841
  import fs4 from "node:fs";
825
842
  import { readFile } from "node:fs/promises";
826
843
  import path5 from "node:path";
@@ -947,13 +964,13 @@ async function typescript(ctx) {
947
964
  }
948
965
  error(
949
966
  "Error",
950
- `Unknown TypeScript option ${color6.reset(ts)}${color6.dim(
967
+ `Unknown TypeScript option ${color7.reset(ts)}${color7.dim(
951
968
  "! Expected strict | strictest | relaxed"
952
969
  )}`
953
970
  );
954
971
  ctx.exit(1);
955
972
  }
956
- await info("ts", `Using ${color6.reset(ts)}${color6.dim(" TypeScript configuration")}`);
973
+ await info("ts", `Using ${color7.reset(ts)}${color7.dim(" TypeScript configuration")}`);
957
974
  }
958
975
  if (ctx.dryRun) {
959
976
  await info("--dry-run", `Skipping TypeScript setup`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astro",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",