create-astro 4.5.2 โ 4.7.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,4 +1,4 @@
|
|
|
1
|
-
import { prompt } from '@astrojs/cli-kit';
|
|
1
|
+
import { prompt, type Task } from '@astrojs/cli-kit';
|
|
2
2
|
export interface Context {
|
|
3
3
|
help: boolean;
|
|
4
4
|
prompt: typeof prompt;
|
|
@@ -20,5 +20,6 @@ export interface Context {
|
|
|
20
20
|
stdout?: typeof process.stdout;
|
|
21
21
|
exit(code: number): never;
|
|
22
22
|
hat?: string;
|
|
23
|
+
tasks: Task[];
|
|
23
24
|
}
|
|
24
25
|
export declare function getContext(argv: string[]): Promise<Context>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Context } from './context.js';
|
|
2
|
-
export declare function dependencies(ctx: Pick<Context, 'install' | 'yes' | 'prompt' | 'packageManager' | 'cwd' | 'dryRun'>): Promise<void>;
|
|
2
|
+
export declare function dependencies(ctx: Pick<Context, 'install' | 'yes' | 'prompt' | 'packageManager' | 'cwd' | 'dryRun' | 'tasks'>): Promise<void>;
|
package/dist/actions/git.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Context } from './context.js';
|
|
2
|
-
export declare function git(ctx: Pick<Context, 'cwd' | 'git' | 'yes' | 'prompt' | 'dryRun'>): Promise<void>;
|
|
2
|
+
export declare function git(ctx: Pick<Context, 'cwd' | 'git' | 'yes' | 'prompt' | 'dryRun' | 'tasks'>): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Context } from './context.js';
|
|
2
|
-
export declare function template(ctx: Pick<Context, 'template' | 'prompt' | 'yes' | 'dryRun' | 'exit'>): Promise<void>;
|
|
2
|
+
export declare function template(ctx: Pick<Context, 'template' | 'prompt' | 'yes' | 'dryRun' | 'exit' | 'tasks'>): 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>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from './context.js';
|
|
2
|
-
type PickedTypeScriptContext = Pick<Context, 'typescript' | 'yes' | 'prompt' | 'dryRun' | 'cwd' | 'exit' | 'packageManager' | 'install'>;
|
|
2
|
+
type PickedTypeScriptContext = Pick<Context, 'typescript' | 'yes' | 'prompt' | 'dryRun' | 'cwd' | 'exit' | 'packageManager' | 'install' | 'tasks'>;
|
|
3
3
|
export declare function typescript(ctx: PickedTypeScriptContext): Promise<void>;
|
|
4
4
|
export declare function setupTypeScript(value: string, ctx: PickedTypeScriptContext): Promise<void>;
|
|
5
5
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -244,29 +244,32 @@ function setStdout(writable) {
|
|
|
244
244
|
async function say(messages, { clear = false, hat = "" } = {}) {
|
|
245
245
|
return houston(messages, { clear, hat, stdout });
|
|
246
246
|
}
|
|
247
|
-
async function spinner(args) {
|
|
248
|
-
await load(args, { stdout });
|
|
249
|
-
}
|
|
250
247
|
var title = (text2) => align(label(text2), "end", 7) + " ";
|
|
251
248
|
var welcome = [
|
|
252
|
-
`Let's claim your corner of the internet.`,
|
|
253
|
-
`I'll be your assistant today.`,
|
|
254
|
-
`Let's build something awesome!`,
|
|
255
|
-
`Let's build something great!`,
|
|
256
|
-
`Let's build something fast!`,
|
|
257
|
-
`Let's build the web we want.`,
|
|
258
|
-
`Let's make the web weird!`,
|
|
259
|
-
`Let's make the web a better place!`,
|
|
260
|
-
`Let's create a new project!`,
|
|
261
|
-
`Let's create something unique!`,
|
|
262
|
-
`Time to build a new website.`,
|
|
263
|
-
`Time to build a faster website.`,
|
|
264
|
-
`Time to build a sweet new website.`,
|
|
265
|
-
`We're glad to have you on board.`,
|
|
266
|
-
`Keeping the internet weird since 2021.`,
|
|
267
|
-
`Initiating launch sequence...`,
|
|
268
|
-
`Initiating launch sequence... right... now!`,
|
|
269
|
-
`Awaiting further instructions
|
|
249
|
+
// `Let's claim your corner of the internet.`,
|
|
250
|
+
// `I'll be your assistant today.`,
|
|
251
|
+
// `Let's build something awesome!`,
|
|
252
|
+
// `Let's build something great!`,
|
|
253
|
+
// `Let's build something fast!`,
|
|
254
|
+
// `Let's build the web we want.`,
|
|
255
|
+
// `Let's make the web weird!`,
|
|
256
|
+
// `Let's make the web a better place!`,
|
|
257
|
+
// `Let's create a new project!`,
|
|
258
|
+
// `Let's create something unique!`,
|
|
259
|
+
// `Time to build a new website.`,
|
|
260
|
+
// `Time to build a faster website.`,
|
|
261
|
+
// `Time to build a sweet new website.`,
|
|
262
|
+
// `We're glad to have you on board.`,
|
|
263
|
+
// `Keeping the internet weird since 2021.`,
|
|
264
|
+
// `Initiating launch sequence...`,
|
|
265
|
+
// `Initiating launch sequence... right... now!`,
|
|
266
|
+
// `Awaiting further instructions.`,
|
|
267
|
+
`Ho, ho, ho! 'Tis the season to code and create.`,
|
|
268
|
+
`Jingle all the way through your web creation journey!`,
|
|
269
|
+
`Let's unwrap the magic of the web together!`,
|
|
270
|
+
`Bells are ringing, and so are your creative ideas!`,
|
|
271
|
+
`It's starting to look a lot like Christmas on the internet.`,
|
|
272
|
+
`It's time to decorate the web with your festive ideas!`
|
|
270
273
|
];
|
|
271
274
|
var getName = () => new Promise((resolve) => {
|
|
272
275
|
exec("git config user.name", { encoding: "utf-8" }, (_1, gitName) => {
|
|
@@ -384,7 +387,7 @@ function printHelp({
|
|
|
384
387
|
if (headline) {
|
|
385
388
|
message.push(
|
|
386
389
|
linebreak(),
|
|
387
|
-
`${title(commandName)} ${color.green(`v${"4.
|
|
390
|
+
`${title(commandName)} ${color.green(`v${"4.7.0"}`)} ${headline}`
|
|
388
391
|
);
|
|
389
392
|
}
|
|
390
393
|
if (usage) {
|
|
@@ -470,7 +473,8 @@ async function getContext(argv) {
|
|
|
470
473
|
projectName: projectName2,
|
|
471
474
|
template: template2,
|
|
472
475
|
ref: ref ?? "latest",
|
|
473
|
-
hat:
|
|
476
|
+
hat: random(["\u2744\uFE0F", "\u{1F384}", "\u{1F381}"]),
|
|
477
|
+
// fancy ? random(['๐ฉ', '๐ฉ', '๐ฉ', '๐ฉ', '๐', '๐', '๐งข', '๐ฆ']) : undefined,
|
|
474
478
|
yes,
|
|
475
479
|
install: install2 ?? (noInstall ? false : void 0),
|
|
476
480
|
git: git2 ?? (noGit ? false : void 0),
|
|
@@ -478,7 +482,8 @@ async function getContext(argv) {
|
|
|
478
482
|
cwd,
|
|
479
483
|
exit(code) {
|
|
480
484
|
process.exit(code);
|
|
481
|
-
}
|
|
485
|
+
},
|
|
486
|
+
tasks: []
|
|
482
487
|
};
|
|
483
488
|
return context;
|
|
484
489
|
}
|
|
@@ -510,8 +515,9 @@ async function dependencies(ctx) {
|
|
|
510
515
|
if (ctx.dryRun) {
|
|
511
516
|
await info("--dry-run", `Skipping dependency installation`);
|
|
512
517
|
} else if (deps) {
|
|
513
|
-
|
|
514
|
-
|
|
518
|
+
ctx.tasks.push({
|
|
519
|
+
pending: "Dependencies",
|
|
520
|
+
start: `Dependencies installing with ${ctx.packageManager}...`,
|
|
515
521
|
end: "Dependencies installed",
|
|
516
522
|
onError: (e) => {
|
|
517
523
|
error("error", e);
|
|
@@ -566,7 +572,8 @@ async function git(ctx) {
|
|
|
566
572
|
if (ctx.dryRun) {
|
|
567
573
|
await info("--dry-run", `Skipping Git initialization`);
|
|
568
574
|
} else if (_git) {
|
|
569
|
-
|
|
575
|
+
ctx.tasks.push({
|
|
576
|
+
pending: "Git",
|
|
570
577
|
start: "Git initializing...",
|
|
571
578
|
end: "Git initialized",
|
|
572
579
|
while: () => init({ cwd: ctx.cwd }).catch((e) => {
|
|
@@ -801,7 +808,8 @@ async function template(ctx) {
|
|
|
801
808
|
if (ctx.dryRun) {
|
|
802
809
|
await info("--dry-run", `Skipping template copying`);
|
|
803
810
|
} else if (ctx.template) {
|
|
804
|
-
|
|
811
|
+
ctx.tasks.push({
|
|
812
|
+
pending: "Template",
|
|
805
813
|
start: "Template copying...",
|
|
806
814
|
end: "Template copied",
|
|
807
815
|
while: () => copyTemplate(ctx.template, ctx).catch((e) => {
|
|
@@ -1026,7 +1034,8 @@ async function typescript(ctx) {
|
|
|
1026
1034
|
if (ts === "relaxed" || ts === "default") {
|
|
1027
1035
|
ts = "base";
|
|
1028
1036
|
}
|
|
1029
|
-
|
|
1037
|
+
ctx.tasks.push({
|
|
1038
|
+
pending: "TypeScript",
|
|
1030
1039
|
start: "TypeScript customizing...",
|
|
1031
1040
|
end: "TypeScript customized",
|
|
1032
1041
|
while: () => setupTypeScript(ts, ctx).catch((e) => {
|
|
@@ -1150,6 +1159,7 @@ function parseGitURI(input) {
|
|
|
1150
1159
|
}
|
|
1151
1160
|
|
|
1152
1161
|
// src/index.ts
|
|
1162
|
+
import { tasks } from "@astrojs/cli-kit";
|
|
1153
1163
|
var exit = () => process.exit(0);
|
|
1154
1164
|
process.on("SIGINT", exit);
|
|
1155
1165
|
process.on("SIGTERM", exit);
|
|
@@ -1169,12 +1179,18 @@ async function main() {
|
|
|
1169
1179
|
dependencies,
|
|
1170
1180
|
typescript,
|
|
1171
1181
|
// Steps which write to files need to go above git
|
|
1172
|
-
git
|
|
1173
|
-
next
|
|
1182
|
+
git
|
|
1174
1183
|
];
|
|
1175
1184
|
for (const step of steps) {
|
|
1176
1185
|
await step(ctx);
|
|
1177
1186
|
}
|
|
1187
|
+
console.log("");
|
|
1188
|
+
const labels = {
|
|
1189
|
+
start: "Project initializing...",
|
|
1190
|
+
end: "Project initialized!"
|
|
1191
|
+
};
|
|
1192
|
+
await tasks(labels, ctx.tasks);
|
|
1193
|
+
await next(ctx);
|
|
1178
1194
|
process.exit(0);
|
|
1179
1195
|
}
|
|
1180
1196
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astro",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "withastro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"//a": "MOST PACKAGES SHOULD GO IN DEV_DEPENDENCIES! THEY WILL BE BUNDLED.",
|
|
26
26
|
"//b": "DEPENDENCIES IS FOR UNBUNDLED PACKAGES",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@astrojs/cli-kit": "^0.
|
|
28
|
+
"@astrojs/cli-kit": "^0.4.0",
|
|
29
29
|
"giget": "1.1.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|