create-astro 4.6.0 → 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,9 +244,6 @@ 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
249
|
// `Let's claim your corner of the internet.`,
|
|
@@ -390,7 +387,7 @@ function printHelp({
|
|
|
390
387
|
if (headline) {
|
|
391
388
|
message.push(
|
|
392
389
|
linebreak(),
|
|
393
|
-
`${title(commandName)} ${color.green(`v${"4.
|
|
390
|
+
`${title(commandName)} ${color.green(`v${"4.7.0"}`)} ${headline}`
|
|
394
391
|
);
|
|
395
392
|
}
|
|
396
393
|
if (usage) {
|
|
@@ -485,7 +482,8 @@ async function getContext(argv) {
|
|
|
485
482
|
cwd,
|
|
486
483
|
exit(code) {
|
|
487
484
|
process.exit(code);
|
|
488
|
-
}
|
|
485
|
+
},
|
|
486
|
+
tasks: []
|
|
489
487
|
};
|
|
490
488
|
return context;
|
|
491
489
|
}
|
|
@@ -517,8 +515,9 @@ async function dependencies(ctx) {
|
|
|
517
515
|
if (ctx.dryRun) {
|
|
518
516
|
await info("--dry-run", `Skipping dependency installation`);
|
|
519
517
|
} else if (deps) {
|
|
520
|
-
|
|
521
|
-
|
|
518
|
+
ctx.tasks.push({
|
|
519
|
+
pending: "Dependencies",
|
|
520
|
+
start: `Dependencies installing with ${ctx.packageManager}...`,
|
|
522
521
|
end: "Dependencies installed",
|
|
523
522
|
onError: (e) => {
|
|
524
523
|
error("error", e);
|
|
@@ -573,7 +572,8 @@ async function git(ctx) {
|
|
|
573
572
|
if (ctx.dryRun) {
|
|
574
573
|
await info("--dry-run", `Skipping Git initialization`);
|
|
575
574
|
} else if (_git) {
|
|
576
|
-
|
|
575
|
+
ctx.tasks.push({
|
|
576
|
+
pending: "Git",
|
|
577
577
|
start: "Git initializing...",
|
|
578
578
|
end: "Git initialized",
|
|
579
579
|
while: () => init({ cwd: ctx.cwd }).catch((e) => {
|
|
@@ -808,7 +808,8 @@ async function template(ctx) {
|
|
|
808
808
|
if (ctx.dryRun) {
|
|
809
809
|
await info("--dry-run", `Skipping template copying`);
|
|
810
810
|
} else if (ctx.template) {
|
|
811
|
-
|
|
811
|
+
ctx.tasks.push({
|
|
812
|
+
pending: "Template",
|
|
812
813
|
start: "Template copying...",
|
|
813
814
|
end: "Template copied",
|
|
814
815
|
while: () => copyTemplate(ctx.template, ctx).catch((e) => {
|
|
@@ -1033,7 +1034,8 @@ async function typescript(ctx) {
|
|
|
1033
1034
|
if (ts === "relaxed" || ts === "default") {
|
|
1034
1035
|
ts = "base";
|
|
1035
1036
|
}
|
|
1036
|
-
|
|
1037
|
+
ctx.tasks.push({
|
|
1038
|
+
pending: "TypeScript",
|
|
1037
1039
|
start: "TypeScript customizing...",
|
|
1038
1040
|
end: "TypeScript customized",
|
|
1039
1041
|
while: () => setupTypeScript(ts, ctx).catch((e) => {
|
|
@@ -1157,6 +1159,7 @@ function parseGitURI(input) {
|
|
|
1157
1159
|
}
|
|
1158
1160
|
|
|
1159
1161
|
// src/index.ts
|
|
1162
|
+
import { tasks } from "@astrojs/cli-kit";
|
|
1160
1163
|
var exit = () => process.exit(0);
|
|
1161
1164
|
process.on("SIGINT", exit);
|
|
1162
1165
|
process.on("SIGTERM", exit);
|
|
@@ -1176,12 +1179,18 @@ async function main() {
|
|
|
1176
1179
|
dependencies,
|
|
1177
1180
|
typescript,
|
|
1178
1181
|
// Steps which write to files need to go above git
|
|
1179
|
-
git
|
|
1180
|
-
next
|
|
1182
|
+
git
|
|
1181
1183
|
];
|
|
1182
1184
|
for (const step of steps) {
|
|
1183
1185
|
await step(ctx);
|
|
1184
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);
|
|
1185
1194
|
process.exit(0);
|
|
1186
1195
|
}
|
|
1187
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": {
|