create-astro 4.1.0 → 4.2.0
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Context } from './context.js';
|
|
2
|
-
export declare function projectName(ctx: Pick<Context, 'cwd' | 'prompt' | 'projectName' | 'exit'>): Promise<void>;
|
|
2
|
+
export declare function projectName(ctx: Pick<Context, 'cwd' | 'yes' | 'dryRun' | 'prompt' | 'projectName' | 'exit'>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Context } from './context.js';
|
|
2
|
-
export declare function template(ctx: Pick<Context, 'template' | 'prompt' | 'dryRun' | 'exit'>): Promise<void>;
|
|
2
|
+
export declare function template(ctx: Pick<Context, 'template' | 'prompt' | 'yes' | 'dryRun' | 'exit'>): Promise<void>;
|
|
3
3
|
export declare function getTemplateTarget(tmpl: string, ref?: string): string;
|
|
4
4
|
export default function copyTemplate(tmpl: string, ctx: Context): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -384,7 +384,7 @@ function printHelp({
|
|
|
384
384
|
if (headline) {
|
|
385
385
|
message.push(
|
|
386
386
|
linebreak(),
|
|
387
|
-
`${title(commandName)} ${color.green(`v${"4.
|
|
387
|
+
`${title(commandName)} ${color.green(`v${"4.2.0"}`)} ${headline}`
|
|
388
388
|
);
|
|
389
389
|
}
|
|
390
390
|
if (usage) {
|
|
@@ -723,6 +723,12 @@ async function projectName(ctx) {
|
|
|
723
723
|
if (!isEmpty(ctx.cwd)) {
|
|
724
724
|
await info("Hmm...", `${color5.reset(`"${ctx.cwd}"`)}${color5.dim(` is not empty!`)}`);
|
|
725
725
|
}
|
|
726
|
+
if (ctx.yes) {
|
|
727
|
+
ctx.projectName = generateProjectName();
|
|
728
|
+
ctx.cwd = `./${ctx.projectName}`;
|
|
729
|
+
await info("dir", `Project created at ./${ctx.projectName}`);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
726
732
|
const { name } = await ctx.prompt({
|
|
727
733
|
name: "name",
|
|
728
734
|
type: "text",
|
|
@@ -740,6 +746,10 @@ async function projectName(ctx) {
|
|
|
740
746
|
});
|
|
741
747
|
ctx.cwd = name.trim();
|
|
742
748
|
ctx.projectName = toValidName(name);
|
|
749
|
+
if (ctx.dryRun) {
|
|
750
|
+
await info("--dry-run", "Skipping project naming");
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
743
753
|
} else {
|
|
744
754
|
let name = ctx.cwd;
|
|
745
755
|
if (name === "." || name === "./") {
|
|
@@ -770,7 +780,10 @@ import { downloadTemplate } from "giget";
|
|
|
770
780
|
import fs4 from "node:fs";
|
|
771
781
|
import path5 from "node:path";
|
|
772
782
|
async function template(ctx) {
|
|
773
|
-
if (
|
|
783
|
+
if (ctx.yes) {
|
|
784
|
+
ctx.template = "basics";
|
|
785
|
+
await info("tmpl", `Using ${color6.reset(ctx.template)}${color6.dim(" as project template")}`);
|
|
786
|
+
} else if (!ctx.template) {
|
|
774
787
|
const { template: tmpl } = await ctx.prompt({
|
|
775
788
|
name: "template",
|
|
776
789
|
type: "select",
|