create-astro 3.1.1 → 3.1.2
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 +13 -6
- 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.2"}`)} ${headline}`
|
|
372
372
|
);
|
|
373
373
|
}
|
|
374
374
|
if (usage) {
|
|
@@ -749,8 +749,13 @@ async function template(ctx) {
|
|
|
749
749
|
start: "Template copying...",
|
|
750
750
|
end: "Template copied",
|
|
751
751
|
while: () => copyTemplate(ctx.template, ctx).catch((e) => {
|
|
752
|
-
|
|
753
|
-
|
|
752
|
+
if (e instanceof Error) {
|
|
753
|
+
error("error", e.message);
|
|
754
|
+
process.exit(1);
|
|
755
|
+
} else {
|
|
756
|
+
error("error", "Unable to clone template.");
|
|
757
|
+
process.exit(1);
|
|
758
|
+
}
|
|
754
759
|
})
|
|
755
760
|
});
|
|
756
761
|
} else {
|
|
@@ -788,11 +793,13 @@ async function copyTemplate(tmpl, ctx) {
|
|
|
788
793
|
} catch (err) {
|
|
789
794
|
fs3.rmdirSync(ctx.cwd);
|
|
790
795
|
if (err.message.includes("404")) {
|
|
791
|
-
|
|
796
|
+
throw new Error(`Template ${color5.reset(tmpl)} ${color5.dim("does not exist!")}`);
|
|
792
797
|
} else {
|
|
793
|
-
|
|
798
|
+
throw new Error(err.message);
|
|
794
799
|
}
|
|
795
|
-
|
|
800
|
+
}
|
|
801
|
+
if (fs3.readdirSync(ctx.cwd).length === 0) {
|
|
802
|
+
throw new Error(`Template ${color5.reset(tmpl)} ${color5.dim("is empty!")}`);
|
|
796
803
|
}
|
|
797
804
|
const removeFiles = FILES_TO_REMOVE.map(async (file) => {
|
|
798
805
|
const fileLoc = path4.resolve(path4.join(ctx.cwd, file));
|