create-astro 4.7.0 โ 4.7.1
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/actions/context.d.ts +2 -0
- package/dist/actions/intro.d.ts +1 -1
- package/dist/actions/next-steps.d.ts +1 -1
- package/dist/data/seasonal.d.ts +9 -0
- package/dist/index.js +115 -35
- package/dist/messages.d.ts +2 -2
- package/package.json +2 -2
|
@@ -19,7 +19,9 @@ export interface Context {
|
|
|
19
19
|
stdin?: typeof process.stdin;
|
|
20
20
|
stdout?: typeof process.stdout;
|
|
21
21
|
exit(code: number): never;
|
|
22
|
+
welcome?: string;
|
|
22
23
|
hat?: string;
|
|
24
|
+
tie?: string;
|
|
23
25
|
tasks: Task[];
|
|
24
26
|
}
|
|
25
27
|
export declare function getContext(argv: string[]): Promise<Context>;
|
package/dist/actions/intro.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Context } from './context.js';
|
|
2
|
-
export declare function intro(ctx: Pick<Context, 'hat' | '
|
|
2
|
+
export declare function intro(ctx: Pick<Context, 'skipHouston' | 'welcome' | 'hat' | 'tie' | 'version' | 'username' | 'fancy'>): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Context } from './context.js';
|
|
2
|
-
export declare function next(ctx: Pick<Context, 'hat' | 'cwd' | 'packageManager' | 'skipHouston'>): Promise<void>;
|
|
2
|
+
export declare function next(ctx: Pick<Context, 'hat' | 'tie' | 'cwd' | 'packageManager' | 'skipHouston'>): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -241,36 +241,10 @@ var stdout = process.stdout;
|
|
|
241
241
|
function setStdout(writable) {
|
|
242
242
|
stdout = writable;
|
|
243
243
|
}
|
|
244
|
-
async function say(messages, { clear = false, hat = "" } = {}) {
|
|
245
|
-
return houston(messages, { clear, hat, stdout });
|
|
244
|
+
async function say(messages, { clear = false, hat = "", tie = "" } = {}) {
|
|
245
|
+
return houston(messages, { clear, hat, tie, stdout });
|
|
246
246
|
}
|
|
247
247
|
var title = (text2) => align(label(text2), "end", 7) + " ";
|
|
248
|
-
var welcome = [
|
|
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!`
|
|
273
|
-
];
|
|
274
248
|
var getName = () => new Promise((resolve) => {
|
|
275
249
|
exec("git config user.name", { encoding: "utf-8" }, (_1, gitName) => {
|
|
276
250
|
if (gitName.trim()) {
|
|
@@ -387,7 +361,7 @@ function printHelp({
|
|
|
387
361
|
if (headline) {
|
|
388
362
|
message.push(
|
|
389
363
|
linebreak(),
|
|
390
|
-
`${title(commandName)} ${color.green(`v${"4.7.
|
|
364
|
+
`${title(commandName)} ${color.green(`v${"4.7.1"}`)} ${headline}`
|
|
391
365
|
);
|
|
392
366
|
}
|
|
393
367
|
if (usage) {
|
|
@@ -410,6 +384,110 @@ function printHelp({
|
|
|
410
384
|
log(message.join("\n") + "\n");
|
|
411
385
|
}
|
|
412
386
|
|
|
387
|
+
// src/data/seasonal.ts
|
|
388
|
+
function getSeasonalHouston({ fancy }) {
|
|
389
|
+
const season = getSeason();
|
|
390
|
+
switch (season) {
|
|
391
|
+
case "new-year": {
|
|
392
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
393
|
+
return {
|
|
394
|
+
hats: rarity(0.5, ["\u{1F3A9}"]),
|
|
395
|
+
ties: rarity(0.25, ["\u{1F38A}", "\u{1F380}", "\u{1F389}"]),
|
|
396
|
+
messages: [
|
|
397
|
+
`New year, new Astro site!`,
|
|
398
|
+
`Kicking ${year} off with Astro?! What an honor!`,
|
|
399
|
+
`Happy ${year}! Let's make something cool.`,
|
|
400
|
+
`${year} is your year! Let's build something awesome.`,
|
|
401
|
+
`${year} is the year of Astro!`,
|
|
402
|
+
`${year} is clearly off to a great start!`,
|
|
403
|
+
`Thanks for starting ${year} with Astro!`
|
|
404
|
+
]
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
case "spooky":
|
|
408
|
+
return {
|
|
409
|
+
hats: rarity(0.5, ["\u{1F383}", "\u{1F47B}", "\u2620\uFE0F", "\u{1F480}", "\u{1F577}\uFE0F", "\u{1F52E}"]),
|
|
410
|
+
ties: rarity(0.25, ["\u{1F9B4}", "\u{1F36C}", "\u{1F36B}"]),
|
|
411
|
+
messages: [
|
|
412
|
+
`I'm afraid I can't help you... Just kidding!`,
|
|
413
|
+
`Boo! Just kidding. Let's make a website!`,
|
|
414
|
+
`Let's haunt the internet. OooOooOOoo!`,
|
|
415
|
+
`No tricks here. Seeing you is always treat!`,
|
|
416
|
+
`Spiders aren't the only ones building the web!`,
|
|
417
|
+
`Let's conjure up some web magic!`,
|
|
418
|
+
`Let's harness the power of Astro to build a frightful new site!`,
|
|
419
|
+
`We're conjuring up a spooktacular website!`,
|
|
420
|
+
`Prepare for a web of spooky wonders to be woven.`,
|
|
421
|
+
`Chills and thrills await you on your new project!`
|
|
422
|
+
]
|
|
423
|
+
};
|
|
424
|
+
case "holiday":
|
|
425
|
+
return {
|
|
426
|
+
hats: rarity(0.75, ["\u{1F381}", "\u{1F384}", "\u{1F332}"]),
|
|
427
|
+
ties: rarity(0.75, ["\u{1F9E3}"]),
|
|
428
|
+
messages: [
|
|
429
|
+
`'Tis the season to code and create.`,
|
|
430
|
+
`Jingle all the way through your web creation journey!`,
|
|
431
|
+
`Bells are ringing, and so are your creative ideas!`,
|
|
432
|
+
`Let's make the internet our own winter wonderland!`,
|
|
433
|
+
`It's time to decorate a brand new website!`,
|
|
434
|
+
`Let's unwrap the magic of the web together!`,
|
|
435
|
+
`Hope you're enjoying the holiday season!`,
|
|
436
|
+
`I'm dreaming of a brand new website!`,
|
|
437
|
+
`No better holiday gift than a new site!`,
|
|
438
|
+
`Your creativity is the gift that keeps on giving!`
|
|
439
|
+
]
|
|
440
|
+
};
|
|
441
|
+
default:
|
|
442
|
+
return {
|
|
443
|
+
hats: fancy ? ["\u{1F3A9}", "\u{1F3A9}", "\u{1F3A9}", "\u{1F3A9}", "\u{1F393}", "\u{1F451}", "\u{1F9E2}", "\u{1F366}"] : void 0,
|
|
444
|
+
ties: fancy ? rarity(0.33, ["\u{1F380}", "\u{1F9E3}"]) : void 0,
|
|
445
|
+
messages: [
|
|
446
|
+
`Let's claim your corner of the internet.`,
|
|
447
|
+
`I'll be your assistant today.`,
|
|
448
|
+
`Let's build something awesome!`,
|
|
449
|
+
`Let's build something great!`,
|
|
450
|
+
`Let's build something fast!`,
|
|
451
|
+
`Let's build the web we want.`,
|
|
452
|
+
`Let's make the web weird!`,
|
|
453
|
+
`Let's make the web a better place!`,
|
|
454
|
+
`Let's create a new project!`,
|
|
455
|
+
`Let's create something unique!`,
|
|
456
|
+
`Time to build a new website.`,
|
|
457
|
+
`Time to build a faster website.`,
|
|
458
|
+
`Time to build a sweet new website.`,
|
|
459
|
+
`We're glad to have you on board.`,
|
|
460
|
+
`Keeping the internet weird since 2021.`,
|
|
461
|
+
`Initiating launch sequence...`,
|
|
462
|
+
`Initiating launch sequence... right... now!`,
|
|
463
|
+
`Awaiting further instructions.`
|
|
464
|
+
]
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
function getSeason() {
|
|
469
|
+
const date = /* @__PURE__ */ new Date();
|
|
470
|
+
const month = date.getMonth() + 1;
|
|
471
|
+
const day = date.getDate() + 1;
|
|
472
|
+
if (month === 1 && day <= 7) {
|
|
473
|
+
return "new-year";
|
|
474
|
+
}
|
|
475
|
+
if (month === 10 && day > 7) {
|
|
476
|
+
return "spooky";
|
|
477
|
+
}
|
|
478
|
+
if (month === 12 && day > 7 && day < 25) {
|
|
479
|
+
return "holiday";
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
function rarity(frequency, emoji) {
|
|
483
|
+
if (frequency === 1)
|
|
484
|
+
return emoji;
|
|
485
|
+
if (frequency === 0)
|
|
486
|
+
return [""];
|
|
487
|
+
const empty = Array.from({ length: Math.round(emoji.length * frequency) }, () => "");
|
|
488
|
+
return [...emoji, ...empty];
|
|
489
|
+
}
|
|
490
|
+
|
|
413
491
|
// src/actions/context.ts
|
|
414
492
|
async function getContext(argv) {
|
|
415
493
|
const flags = (0, import_arg.default)(
|
|
@@ -461,6 +539,7 @@ async function getContext(argv) {
|
|
|
461
539
|
typescript2 = "strict";
|
|
462
540
|
}
|
|
463
541
|
skipHouston = (os.platform() === "win32" && !fancy || skipHouston) ?? [yes, no, install2, git2, typescript2].some((v2) => v2 !== void 0);
|
|
542
|
+
const { messages, hats, ties } = getSeasonalHouston({ fancy });
|
|
464
543
|
const context = {
|
|
465
544
|
help: help2,
|
|
466
545
|
prompt,
|
|
@@ -473,8 +552,9 @@ async function getContext(argv) {
|
|
|
473
552
|
projectName: projectName2,
|
|
474
553
|
template: template2,
|
|
475
554
|
ref: ref ?? "latest",
|
|
476
|
-
|
|
477
|
-
|
|
555
|
+
welcome: random(messages),
|
|
556
|
+
hat: hats ? random(hats) : void 0,
|
|
557
|
+
tie: ties ? random(ties) : void 0,
|
|
478
558
|
yes,
|
|
479
559
|
install: install2 ?? (noInstall ? false : void 0),
|
|
480
560
|
git: git2 ?? (noGit ? false : void 0),
|
|
@@ -632,10 +712,10 @@ function help() {
|
|
|
632
712
|
|
|
633
713
|
// src/actions/intro.ts
|
|
634
714
|
import { color as color4, label as label2 } from "@astrojs/cli-kit";
|
|
635
|
-
import { random as random2 } from "@astrojs/cli-kit/utils";
|
|
636
715
|
async function intro(ctx) {
|
|
637
716
|
banner();
|
|
638
717
|
if (!ctx.skipHouston) {
|
|
718
|
+
const { welcome, hat, tie } = ctx;
|
|
639
719
|
await say(
|
|
640
720
|
[
|
|
641
721
|
[
|
|
@@ -647,9 +727,9 @@ async function intro(ctx) {
|
|
|
647
727
|
),
|
|
648
728
|
Promise.resolve(ctx.username).then((username) => `${username}!`)
|
|
649
729
|
],
|
|
650
|
-
|
|
730
|
+
welcome ?? "Let's build something awesome!"
|
|
651
731
|
],
|
|
652
|
-
{ clear: true, hat
|
|
732
|
+
{ clear: true, hat, tie }
|
|
653
733
|
);
|
|
654
734
|
}
|
|
655
735
|
}
|
|
@@ -667,7 +747,7 @@ async function next(ctx) {
|
|
|
667
747
|
const devCmd = commandMap[ctx.packageManager] || "npm run dev";
|
|
668
748
|
await nextSteps({ projectDir, devCmd });
|
|
669
749
|
if (!ctx.skipHouston) {
|
|
670
|
-
await say(["Good luck out there, astronaut! \u{1F680}"], { hat: ctx.hat });
|
|
750
|
+
await say(["Good luck out there, astronaut! \u{1F680}"], { hat: ctx.hat, tie: ctx.tie });
|
|
671
751
|
}
|
|
672
752
|
return;
|
|
673
753
|
}
|
package/dist/messages.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export declare function say(messages: string | string[], { clear, hat }?: {
|
|
1
|
+
export declare function say(messages: string | string[], { clear, hat, tie }?: {
|
|
2
2
|
clear?: boolean | undefined;
|
|
3
3
|
hat?: string | undefined;
|
|
4
|
+
tie?: string | undefined;
|
|
4
5
|
}): Promise<void>;
|
|
5
6
|
export declare function spinner(args: {
|
|
6
7
|
start: string;
|
|
@@ -9,7 +10,6 @@ export declare function spinner(args: {
|
|
|
9
10
|
while: (...args: any) => Promise<any>;
|
|
10
11
|
}): Promise<void>;
|
|
11
12
|
export declare const title: (text: string) => string;
|
|
12
|
-
export declare const welcome: string[];
|
|
13
13
|
export declare const getName: () => Promise<string>;
|
|
14
14
|
export declare const getVersion: (packageManager: string) => Promise<string>;
|
|
15
15
|
export declare const log: (message: string) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astro",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.1",
|
|
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.4.
|
|
28
|
+
"@astrojs/cli-kit": "^0.4.1",
|
|
29
29
|
"giget": "1.1.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|