create-astro 3.1.3 → 3.1.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/dist/index.js +28 -20
- 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.
|
|
371
|
+
`${title(commandName)} ${color.green(`v${"3.1.5"}`)} ${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,17 @@ async function dependencies(ctx) {
|
|
|
488
489
|
await spinner({
|
|
489
490
|
start: `Dependencies installing with ${ctx.pkgManager}...`,
|
|
490
491
|
end: "Dependencies installed",
|
|
491
|
-
while: () =>
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
492
|
+
while: () => {
|
|
493
|
+
return install({ pkgManager: ctx.pkgManager, cwd: ctx.cwd }).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
|
+
}
|
|
495
503
|
});
|
|
496
504
|
} else {
|
|
497
505
|
await info(
|
|
@@ -512,7 +520,7 @@ async function install({ pkgManager, cwd }) {
|
|
|
512
520
|
// src/actions/git.ts
|
|
513
521
|
import fs from "node:fs";
|
|
514
522
|
import path from "node:path";
|
|
515
|
-
import { color as
|
|
523
|
+
import { color as color3 } from "@astrojs/cli-kit";
|
|
516
524
|
import { execa as execa2 } from "execa";
|
|
517
525
|
async function git(ctx) {
|
|
518
526
|
if (fs.existsSync(path.join(ctx.cwd, ".git"))) {
|
|
@@ -544,7 +552,7 @@ async function git(ctx) {
|
|
|
544
552
|
} else {
|
|
545
553
|
await info(
|
|
546
554
|
ctx.yes === false ? "git [skip]" : "Sounds good!",
|
|
547
|
-
`You can always run ${
|
|
555
|
+
`You can always run ${color3.reset("git init")}${color3.dim(" manually.")}`
|
|
548
556
|
);
|
|
549
557
|
}
|
|
550
558
|
}
|
|
@@ -591,7 +599,7 @@ function help() {
|
|
|
591
599
|
}
|
|
592
600
|
|
|
593
601
|
// src/actions/intro.ts
|
|
594
|
-
import { color as
|
|
602
|
+
import { color as color4, label as label2 } from "@astrojs/cli-kit";
|
|
595
603
|
import { random } from "@astrojs/cli-kit/utils";
|
|
596
604
|
async function intro(ctx) {
|
|
597
605
|
if (!ctx.skipHouston) {
|
|
@@ -599,8 +607,8 @@ async function intro(ctx) {
|
|
|
599
607
|
[
|
|
600
608
|
"Welcome",
|
|
601
609
|
"to",
|
|
602
|
-
label2("astro",
|
|
603
|
-
|
|
610
|
+
label2("astro", color4.bgGreen, color4.black),
|
|
611
|
+
color4.green(`v${ctx.version}`) + ",",
|
|
604
612
|
`${ctx.username}!`
|
|
605
613
|
],
|
|
606
614
|
random(welcome)
|
|
@@ -624,7 +632,7 @@ async function next(ctx) {
|
|
|
624
632
|
}
|
|
625
633
|
|
|
626
634
|
// src/actions/project-name.ts
|
|
627
|
-
import { color as
|
|
635
|
+
import { color as color5, generateProjectName } from "@astrojs/cli-kit";
|
|
628
636
|
import path3 from "node:path";
|
|
629
637
|
|
|
630
638
|
// src/actions/shared.ts
|
|
@@ -678,7 +686,7 @@ async function projectName(ctx) {
|
|
|
678
686
|
await checkCwd(ctx.cwd);
|
|
679
687
|
if (!ctx.cwd || !isEmpty(ctx.cwd)) {
|
|
680
688
|
if (!isEmpty(ctx.cwd)) {
|
|
681
|
-
await info("Hmm...", `${
|
|
689
|
+
await info("Hmm...", `${color5.reset(`"${ctx.cwd}"`)}${color5.dim(` is not empty!`)}`);
|
|
682
690
|
}
|
|
683
691
|
const { name } = await ctx.prompt({
|
|
684
692
|
name: "name",
|
|
@@ -716,13 +724,13 @@ async function checkCwd(cwd) {
|
|
|
716
724
|
const empty = cwd && isEmpty(cwd);
|
|
717
725
|
if (empty) {
|
|
718
726
|
log("");
|
|
719
|
-
await info("dir", `Using ${
|
|
727
|
+
await info("dir", `Using ${color5.reset(cwd)}${color5.dim(" as project directory")}`);
|
|
720
728
|
}
|
|
721
729
|
return empty;
|
|
722
730
|
}
|
|
723
731
|
|
|
724
732
|
// src/actions/template.ts
|
|
725
|
-
import { color as
|
|
733
|
+
import { color as color6 } from "@astrojs/cli-kit";
|
|
726
734
|
import { downloadTemplate } from "giget";
|
|
727
735
|
import fs3 from "node:fs";
|
|
728
736
|
import path4 from "node:path";
|
|
@@ -742,7 +750,7 @@ async function template(ctx) {
|
|
|
742
750
|
});
|
|
743
751
|
ctx.template = tmpl;
|
|
744
752
|
} else {
|
|
745
|
-
await info("tmpl", `Using ${
|
|
753
|
+
await info("tmpl", `Using ${color6.reset(ctx.template)}${color6.dim(" as project template")}`);
|
|
746
754
|
}
|
|
747
755
|
if (ctx.dryRun) {
|
|
748
756
|
await info("--dry-run", `Skipping template copying`);
|
|
@@ -795,13 +803,13 @@ async function copyTemplate(tmpl, ctx) {
|
|
|
795
803
|
} catch (err) {
|
|
796
804
|
fs3.rmdirSync(ctx.cwd);
|
|
797
805
|
if (err.message.includes("404")) {
|
|
798
|
-
throw new Error(`Template ${
|
|
806
|
+
throw new Error(`Template ${color6.reset(tmpl)} ${color6.dim("does not exist!")}`);
|
|
799
807
|
} else {
|
|
800
808
|
throw new Error(err.message);
|
|
801
809
|
}
|
|
802
810
|
}
|
|
803
811
|
if (fs3.readdirSync(ctx.cwd).length === 0) {
|
|
804
|
-
throw new Error(`Template ${
|
|
812
|
+
throw new Error(`Template ${color6.reset(tmpl)} ${color6.dim("is empty!")}`);
|
|
805
813
|
}
|
|
806
814
|
const removeFiles = FILES_TO_REMOVE.map(async (file) => {
|
|
807
815
|
const fileLoc = path4.resolve(path4.join(ctx.cwd, file));
|
|
@@ -820,7 +828,7 @@ async function copyTemplate(tmpl, ctx) {
|
|
|
820
828
|
}
|
|
821
829
|
|
|
822
830
|
// src/actions/typescript.ts
|
|
823
|
-
import { color as
|
|
831
|
+
import { color as color7 } from "@astrojs/cli-kit";
|
|
824
832
|
import fs4 from "node:fs";
|
|
825
833
|
import { readFile } from "node:fs/promises";
|
|
826
834
|
import path5 from "node:path";
|
|
@@ -947,13 +955,13 @@ async function typescript(ctx) {
|
|
|
947
955
|
}
|
|
948
956
|
error(
|
|
949
957
|
"Error",
|
|
950
|
-
`Unknown TypeScript option ${
|
|
958
|
+
`Unknown TypeScript option ${color7.reset(ts)}${color7.dim(
|
|
951
959
|
"! Expected strict | strictest | relaxed"
|
|
952
960
|
)}`
|
|
953
961
|
);
|
|
954
962
|
ctx.exit(1);
|
|
955
963
|
}
|
|
956
|
-
await info("ts", `Using ${
|
|
964
|
+
await info("ts", `Using ${color7.reset(ts)}${color7.dim(" TypeScript configuration")}`);
|
|
957
965
|
}
|
|
958
966
|
if (ctx.dryRun) {
|
|
959
967
|
await info("--dry-run", `Skipping TypeScript setup`);
|