create-astro 3.1.1 → 3.1.3
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 +15 -6
- package/package.json +3 -3
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.3"}`)} ${headline}`
|
|
372
372
|
);
|
|
373
373
|
}
|
|
374
374
|
if (usage) {
|
|
@@ -690,6 +690,8 @@ async function projectName(ctx) {
|
|
|
690
690
|
if (!isEmpty(value)) {
|
|
691
691
|
return `Directory is not empty!`;
|
|
692
692
|
}
|
|
693
|
+
if (value.match(/[^\x20-\x7E]/g) !== null)
|
|
694
|
+
return `Invalid non-printable character present!`;
|
|
693
695
|
return true;
|
|
694
696
|
}
|
|
695
697
|
});
|
|
@@ -749,8 +751,13 @@ async function template(ctx) {
|
|
|
749
751
|
start: "Template copying...",
|
|
750
752
|
end: "Template copied",
|
|
751
753
|
while: () => copyTemplate(ctx.template, ctx).catch((e) => {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
+
if (e instanceof Error) {
|
|
755
|
+
error("error", e.message);
|
|
756
|
+
process.exit(1);
|
|
757
|
+
} else {
|
|
758
|
+
error("error", "Unable to clone template.");
|
|
759
|
+
process.exit(1);
|
|
760
|
+
}
|
|
754
761
|
})
|
|
755
762
|
});
|
|
756
763
|
} else {
|
|
@@ -788,11 +795,13 @@ async function copyTemplate(tmpl, ctx) {
|
|
|
788
795
|
} catch (err) {
|
|
789
796
|
fs3.rmdirSync(ctx.cwd);
|
|
790
797
|
if (err.message.includes("404")) {
|
|
791
|
-
|
|
798
|
+
throw new Error(`Template ${color5.reset(tmpl)} ${color5.dim("does not exist!")}`);
|
|
792
799
|
} else {
|
|
793
|
-
|
|
800
|
+
throw new Error(err.message);
|
|
794
801
|
}
|
|
795
|
-
|
|
802
|
+
}
|
|
803
|
+
if (fs3.readdirSync(ctx.cwd).length === 0) {
|
|
804
|
+
throw new Error(`Template ${color5.reset(tmpl)} ${color5.dim("is empty!")}`);
|
|
796
805
|
}
|
|
797
806
|
const removeFiles = FILES_TO_REMOVE.map(async (file) => {
|
|
798
807
|
const fileLoc = path4.resolve(path4.join(ctx.cwd, file));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astro",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "withastro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/which-pm-runs": "^1.0.0",
|
|
36
36
|
"arg": "^5.0.2",
|
|
37
|
-
"astro-scripts": "0.0.14",
|
|
38
37
|
"strip-ansi": "^7.0.1",
|
|
39
38
|
"strip-json-comments": "^5.0.0",
|
|
40
|
-
"which-pm-runs": "^1.1.0"
|
|
39
|
+
"which-pm-runs": "^1.1.0",
|
|
40
|
+
"astro-scripts": "0.0.14"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=16.12.0"
|