create-astro 4.7.3 → 4.7.4
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 +1 -1
- package/dist/index.js +121 -122
- package/package.json +1 -3
package/dist/index.js
CHANGED
|
@@ -170,14 +170,118 @@ var require_arg = __commonJS({
|
|
|
170
170
|
|
|
171
171
|
// src/actions/context.ts
|
|
172
172
|
var import_arg = __toESM(require_arg(), 1);
|
|
173
|
+
import os from "node:os";
|
|
173
174
|
import { prompt } from "@astrojs/cli-kit";
|
|
174
175
|
import { random } from "@astrojs/cli-kit/utils";
|
|
175
|
-
|
|
176
|
+
|
|
177
|
+
// src/data/seasonal.ts
|
|
178
|
+
function getSeasonalHouston({ fancy }) {
|
|
179
|
+
const season = getSeason();
|
|
180
|
+
switch (season) {
|
|
181
|
+
case "new-year": {
|
|
182
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
183
|
+
return {
|
|
184
|
+
hats: rarity(0.5, ["\u{1F3A9}"]),
|
|
185
|
+
ties: rarity(0.25, ["\u{1F38A}", "\u{1F380}", "\u{1F389}"]),
|
|
186
|
+
messages: [
|
|
187
|
+
`New year, new Astro site!`,
|
|
188
|
+
`Kicking ${year} off with Astro?! What an honor!`,
|
|
189
|
+
`Happy ${year}! Let's make something cool.`,
|
|
190
|
+
`${year} is your year! Let's build something awesome.`,
|
|
191
|
+
`${year} is the year of Astro!`,
|
|
192
|
+
`${year} is clearly off to a great start!`,
|
|
193
|
+
`Thanks for starting ${year} with Astro!`
|
|
194
|
+
]
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
case "spooky":
|
|
198
|
+
return {
|
|
199
|
+
hats: rarity(0.5, ["\u{1F383}", "\u{1F47B}", "\u2620\uFE0F", "\u{1F480}", "\u{1F577}\uFE0F", "\u{1F52E}"]),
|
|
200
|
+
ties: rarity(0.25, ["\u{1F9B4}", "\u{1F36C}", "\u{1F36B}"]),
|
|
201
|
+
messages: [
|
|
202
|
+
`I'm afraid I can't help you... Just kidding!`,
|
|
203
|
+
`Boo! Just kidding. Let's make a website!`,
|
|
204
|
+
`Let's haunt the internet. OooOooOOoo!`,
|
|
205
|
+
`No tricks here. Seeing you is always treat!`,
|
|
206
|
+
`Spiders aren't the only ones building the web!`,
|
|
207
|
+
`Let's conjure up some web magic!`,
|
|
208
|
+
`Let's harness the power of Astro to build a frightful new site!`,
|
|
209
|
+
`We're conjuring up a spooktacular website!`,
|
|
210
|
+
`Prepare for a web of spooky wonders to be woven.`,
|
|
211
|
+
`Chills and thrills await you on your new project!`
|
|
212
|
+
]
|
|
213
|
+
};
|
|
214
|
+
case "holiday":
|
|
215
|
+
return {
|
|
216
|
+
hats: rarity(0.75, ["\u{1F381}", "\u{1F384}", "\u{1F332}"]),
|
|
217
|
+
ties: rarity(0.75, ["\u{1F9E3}"]),
|
|
218
|
+
messages: [
|
|
219
|
+
`'Tis the season to code and create.`,
|
|
220
|
+
`Jingle all the way through your web creation journey!`,
|
|
221
|
+
`Bells are ringing, and so are your creative ideas!`,
|
|
222
|
+
`Let's make the internet our own winter wonderland!`,
|
|
223
|
+
`It's time to decorate a brand new website!`,
|
|
224
|
+
`Let's unwrap the magic of the web together!`,
|
|
225
|
+
`Hope you're enjoying the holiday season!`,
|
|
226
|
+
`I'm dreaming of a brand new website!`,
|
|
227
|
+
`No better holiday gift than a new site!`,
|
|
228
|
+
`Your creativity is the gift that keeps on giving!`
|
|
229
|
+
]
|
|
230
|
+
};
|
|
231
|
+
default:
|
|
232
|
+
return {
|
|
233
|
+
hats: fancy ? ["\u{1F3A9}", "\u{1F3A9}", "\u{1F3A9}", "\u{1F3A9}", "\u{1F393}", "\u{1F451}", "\u{1F9E2}", "\u{1F366}"] : void 0,
|
|
234
|
+
ties: fancy ? rarity(0.33, ["\u{1F380}", "\u{1F9E3}"]) : void 0,
|
|
235
|
+
messages: [
|
|
236
|
+
`Let's claim your corner of the internet.`,
|
|
237
|
+
`I'll be your assistant today.`,
|
|
238
|
+
`Let's build something awesome!`,
|
|
239
|
+
`Let's build something great!`,
|
|
240
|
+
`Let's build something fast!`,
|
|
241
|
+
`Let's build the web we want.`,
|
|
242
|
+
`Let's make the web weird!`,
|
|
243
|
+
`Let's make the web a better place!`,
|
|
244
|
+
`Let's create a new project!`,
|
|
245
|
+
`Let's create something unique!`,
|
|
246
|
+
`Time to build a new website.`,
|
|
247
|
+
`Time to build a faster website.`,
|
|
248
|
+
`Time to build a sweet new website.`,
|
|
249
|
+
`We're glad to have you on board.`,
|
|
250
|
+
`Keeping the internet weird since 2021.`,
|
|
251
|
+
`Initiating launch sequence...`,
|
|
252
|
+
`Initiating launch sequence... right... now!`,
|
|
253
|
+
`Awaiting further instructions.`
|
|
254
|
+
]
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function getSeason() {
|
|
259
|
+
const date = /* @__PURE__ */ new Date();
|
|
260
|
+
const month = date.getMonth() + 1;
|
|
261
|
+
const day = date.getDate() + 1;
|
|
262
|
+
if (month === 1 && day <= 7) {
|
|
263
|
+
return "new-year";
|
|
264
|
+
}
|
|
265
|
+
if (month === 10 && day > 7) {
|
|
266
|
+
return "spooky";
|
|
267
|
+
}
|
|
268
|
+
if (month === 12 && day > 7 && day < 25) {
|
|
269
|
+
return "holiday";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function rarity(frequency, emoji) {
|
|
273
|
+
if (frequency === 1)
|
|
274
|
+
return emoji;
|
|
275
|
+
if (frequency === 0)
|
|
276
|
+
return [""];
|
|
277
|
+
const empty = Array.from({ length: Math.round(emoji.length * frequency) }, () => "");
|
|
278
|
+
return [...emoji, ...empty];
|
|
279
|
+
}
|
|
176
280
|
|
|
177
281
|
// src/messages.ts
|
|
178
|
-
import { color, say as houston, label, spinner as load } from "@astrojs/cli-kit";
|
|
179
|
-
import { align, sleep } from "@astrojs/cli-kit/utils";
|
|
180
282
|
import { exec } from "node:child_process";
|
|
283
|
+
import { color, label, say as houston, spinner as load } from "@astrojs/cli-kit";
|
|
284
|
+
import { align, sleep } from "@astrojs/cli-kit/utils";
|
|
181
285
|
|
|
182
286
|
// ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
|
|
183
287
|
function ansiRegex({ onlyFirst = false } = {}) {
|
|
@@ -269,10 +373,7 @@ var getVersion = (packageManager, packageName, fallback = "") => new Promise(asy
|
|
|
269
373
|
let registry = await getRegistry(packageManager);
|
|
270
374
|
const { version } = await fetch(`${registry}/${packageName}/latest`, {
|
|
271
375
|
redirect: "follow"
|
|
272
|
-
}).then(
|
|
273
|
-
(res) => res.json(),
|
|
274
|
-
() => ({ version: fallback })
|
|
275
|
-
);
|
|
376
|
+
}).then((res) => res.json()).catch(() => ({ version: fallback }));
|
|
276
377
|
return resolve(version);
|
|
277
378
|
});
|
|
278
379
|
var log = (message) => stdout.write(message + "\n");
|
|
@@ -366,7 +467,7 @@ function printHelp({
|
|
|
366
467
|
if (headline) {
|
|
367
468
|
message.push(
|
|
368
469
|
linebreak(),
|
|
369
|
-
`${title(commandName)} ${color.green(`v${"4.7.
|
|
470
|
+
`${title(commandName)} ${color.green(`v${"4.7.4"}`)} ${headline}`
|
|
370
471
|
);
|
|
371
472
|
}
|
|
372
473
|
if (usage) {
|
|
@@ -389,110 +490,6 @@ function printHelp({
|
|
|
389
490
|
log(message.join("\n") + "\n");
|
|
390
491
|
}
|
|
391
492
|
|
|
392
|
-
// src/data/seasonal.ts
|
|
393
|
-
function getSeasonalHouston({ fancy }) {
|
|
394
|
-
const season = getSeason();
|
|
395
|
-
switch (season) {
|
|
396
|
-
case "new-year": {
|
|
397
|
-
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
398
|
-
return {
|
|
399
|
-
hats: rarity(0.5, ["\u{1F3A9}"]),
|
|
400
|
-
ties: rarity(0.25, ["\u{1F38A}", "\u{1F380}", "\u{1F389}"]),
|
|
401
|
-
messages: [
|
|
402
|
-
`New year, new Astro site!`,
|
|
403
|
-
`Kicking ${year} off with Astro?! What an honor!`,
|
|
404
|
-
`Happy ${year}! Let's make something cool.`,
|
|
405
|
-
`${year} is your year! Let's build something awesome.`,
|
|
406
|
-
`${year} is the year of Astro!`,
|
|
407
|
-
`${year} is clearly off to a great start!`,
|
|
408
|
-
`Thanks for starting ${year} with Astro!`
|
|
409
|
-
]
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
case "spooky":
|
|
413
|
-
return {
|
|
414
|
-
hats: rarity(0.5, ["\u{1F383}", "\u{1F47B}", "\u2620\uFE0F", "\u{1F480}", "\u{1F577}\uFE0F", "\u{1F52E}"]),
|
|
415
|
-
ties: rarity(0.25, ["\u{1F9B4}", "\u{1F36C}", "\u{1F36B}"]),
|
|
416
|
-
messages: [
|
|
417
|
-
`I'm afraid I can't help you... Just kidding!`,
|
|
418
|
-
`Boo! Just kidding. Let's make a website!`,
|
|
419
|
-
`Let's haunt the internet. OooOooOOoo!`,
|
|
420
|
-
`No tricks here. Seeing you is always treat!`,
|
|
421
|
-
`Spiders aren't the only ones building the web!`,
|
|
422
|
-
`Let's conjure up some web magic!`,
|
|
423
|
-
`Let's harness the power of Astro to build a frightful new site!`,
|
|
424
|
-
`We're conjuring up a spooktacular website!`,
|
|
425
|
-
`Prepare for a web of spooky wonders to be woven.`,
|
|
426
|
-
`Chills and thrills await you on your new project!`
|
|
427
|
-
]
|
|
428
|
-
};
|
|
429
|
-
case "holiday":
|
|
430
|
-
return {
|
|
431
|
-
hats: rarity(0.75, ["\u{1F381}", "\u{1F384}", "\u{1F332}"]),
|
|
432
|
-
ties: rarity(0.75, ["\u{1F9E3}"]),
|
|
433
|
-
messages: [
|
|
434
|
-
`'Tis the season to code and create.`,
|
|
435
|
-
`Jingle all the way through your web creation journey!`,
|
|
436
|
-
`Bells are ringing, and so are your creative ideas!`,
|
|
437
|
-
`Let's make the internet our own winter wonderland!`,
|
|
438
|
-
`It's time to decorate a brand new website!`,
|
|
439
|
-
`Let's unwrap the magic of the web together!`,
|
|
440
|
-
`Hope you're enjoying the holiday season!`,
|
|
441
|
-
`I'm dreaming of a brand new website!`,
|
|
442
|
-
`No better holiday gift than a new site!`,
|
|
443
|
-
`Your creativity is the gift that keeps on giving!`
|
|
444
|
-
]
|
|
445
|
-
};
|
|
446
|
-
default:
|
|
447
|
-
return {
|
|
448
|
-
hats: fancy ? ["\u{1F3A9}", "\u{1F3A9}", "\u{1F3A9}", "\u{1F3A9}", "\u{1F393}", "\u{1F451}", "\u{1F9E2}", "\u{1F366}"] : void 0,
|
|
449
|
-
ties: fancy ? rarity(0.33, ["\u{1F380}", "\u{1F9E3}"]) : void 0,
|
|
450
|
-
messages: [
|
|
451
|
-
`Let's claim your corner of the internet.`,
|
|
452
|
-
`I'll be your assistant today.`,
|
|
453
|
-
`Let's build something awesome!`,
|
|
454
|
-
`Let's build something great!`,
|
|
455
|
-
`Let's build something fast!`,
|
|
456
|
-
`Let's build the web we want.`,
|
|
457
|
-
`Let's make the web weird!`,
|
|
458
|
-
`Let's make the web a better place!`,
|
|
459
|
-
`Let's create a new project!`,
|
|
460
|
-
`Let's create something unique!`,
|
|
461
|
-
`Time to build a new website.`,
|
|
462
|
-
`Time to build a faster website.`,
|
|
463
|
-
`Time to build a sweet new website.`,
|
|
464
|
-
`We're glad to have you on board.`,
|
|
465
|
-
`Keeping the internet weird since 2021.`,
|
|
466
|
-
`Initiating launch sequence...`,
|
|
467
|
-
`Initiating launch sequence... right... now!`,
|
|
468
|
-
`Awaiting further instructions.`
|
|
469
|
-
]
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
function getSeason() {
|
|
474
|
-
const date = /* @__PURE__ */ new Date();
|
|
475
|
-
const month = date.getMonth() + 1;
|
|
476
|
-
const day = date.getDate() + 1;
|
|
477
|
-
if (month === 1 && day <= 7) {
|
|
478
|
-
return "new-year";
|
|
479
|
-
}
|
|
480
|
-
if (month === 10 && day > 7) {
|
|
481
|
-
return "spooky";
|
|
482
|
-
}
|
|
483
|
-
if (month === 12 && day > 7 && day < 25) {
|
|
484
|
-
return "holiday";
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
function rarity(frequency, emoji) {
|
|
488
|
-
if (frequency === 1)
|
|
489
|
-
return emoji;
|
|
490
|
-
if (frequency === 0)
|
|
491
|
-
return [""];
|
|
492
|
-
const empty = Array.from({ length: Math.round(emoji.length * frequency) }, () => "");
|
|
493
|
-
return [...emoji, ...empty];
|
|
494
|
-
}
|
|
495
|
-
|
|
496
493
|
// src/actions/context.ts
|
|
497
494
|
async function getContext(argv) {
|
|
498
495
|
const flags = (0, import_arg.default)(
|
|
@@ -550,7 +547,7 @@ async function getContext(argv) {
|
|
|
550
547
|
prompt,
|
|
551
548
|
packageManager,
|
|
552
549
|
username: getName(),
|
|
553
|
-
version: getVersion(packageManager, "astro"),
|
|
550
|
+
version: getVersion(packageManager, "astro", "4.4.15"),
|
|
554
551
|
skipHouston,
|
|
555
552
|
fancy,
|
|
556
553
|
dryRun,
|
|
@@ -580,10 +577,13 @@ function detectPackageManager() {
|
|
|
580
577
|
return name === "npminstall" ? "cnpm" : name;
|
|
581
578
|
}
|
|
582
579
|
|
|
580
|
+
// src/index.ts
|
|
581
|
+
import { tasks } from "@astrojs/cli-kit";
|
|
582
|
+
|
|
583
583
|
// src/actions/dependencies.ts
|
|
584
|
-
import { color as color2 } from "@astrojs/cli-kit";
|
|
585
584
|
import fs from "node:fs";
|
|
586
585
|
import path from "node:path";
|
|
586
|
+
import { color as color2 } from "@astrojs/cli-kit";
|
|
587
587
|
async function dependencies(ctx) {
|
|
588
588
|
let deps = ctx.install ?? ctx.yes;
|
|
589
589
|
if (deps === void 0) {
|
|
@@ -758,8 +758,8 @@ async function next(ctx) {
|
|
|
758
758
|
}
|
|
759
759
|
|
|
760
760
|
// src/actions/project-name.ts
|
|
761
|
-
import { color as color5, generateProjectName } from "@astrojs/cli-kit";
|
|
762
761
|
import path4 from "node:path";
|
|
762
|
+
import { color as color5, generateProjectName } from "@astrojs/cli-kit";
|
|
763
763
|
|
|
764
764
|
// src/actions/shared.ts
|
|
765
765
|
import fs3 from "node:fs";
|
|
@@ -866,10 +866,10 @@ async function checkCwd(cwd) {
|
|
|
866
866
|
}
|
|
867
867
|
|
|
868
868
|
// src/actions/template.ts
|
|
869
|
-
import { color as color6 } from "@astrojs/cli-kit";
|
|
870
|
-
import { downloadTemplate } from "giget";
|
|
871
869
|
import fs4 from "node:fs";
|
|
872
870
|
import path5 from "node:path";
|
|
871
|
+
import { color as color6 } from "@astrojs/cli-kit";
|
|
872
|
+
import { downloadTemplate } from "giget";
|
|
873
873
|
async function template(ctx) {
|
|
874
874
|
if (!ctx.template && ctx.yes)
|
|
875
875
|
ctx.template = "basics";
|
|
@@ -979,9 +979,9 @@ async function copyTemplate(tmpl, ctx) {
|
|
|
979
979
|
}
|
|
980
980
|
|
|
981
981
|
// src/actions/typescript.ts
|
|
982
|
-
import { color as color7 } from "@astrojs/cli-kit";
|
|
983
982
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
984
983
|
import path6 from "node:path";
|
|
984
|
+
import { color as color7 } from "@astrojs/cli-kit";
|
|
985
985
|
|
|
986
986
|
// ../../node_modules/.pnpm/strip-json-comments@5.0.1/node_modules/strip-json-comments/index.js
|
|
987
987
|
var singleComment = Symbol("singleComment");
|
|
@@ -1142,8 +1142,8 @@ var FILES_TO_UPDATE2 = {
|
|
|
1142
1142
|
parsedPackageJson.scripts.build = `astro check && ${buildScript}`;
|
|
1143
1143
|
}
|
|
1144
1144
|
const [astroCheckVersion, typescriptVersion] = await Promise.all([
|
|
1145
|
-
getVersion(options.ctx.packageManager, "@astrojs/check"),
|
|
1146
|
-
getVersion(options.ctx.packageManager, "typescript")
|
|
1145
|
+
getVersion(options.ctx.packageManager, "@astrojs/check", "0.3.1"),
|
|
1146
|
+
getVersion(options.ctx.packageManager, "typescript", "5.2.2")
|
|
1147
1147
|
]);
|
|
1148
1148
|
parsedPackageJson.dependencies ??= {};
|
|
1149
1149
|
parsedPackageJson.dependencies["@astrojs/check"] = `^${astroCheckVersion}`;
|
|
@@ -1189,8 +1189,8 @@ async function setupTypeScript(value, ctx) {
|
|
|
1189
1189
|
}
|
|
1190
1190
|
|
|
1191
1191
|
// src/actions/verify.ts
|
|
1192
|
-
import { color as color8 } from "@astrojs/cli-kit";
|
|
1193
1192
|
import dns from "node:dns/promises";
|
|
1193
|
+
import { color as color8 } from "@astrojs/cli-kit";
|
|
1194
1194
|
async function verify(ctx) {
|
|
1195
1195
|
if (!ctx.dryRun) {
|
|
1196
1196
|
const online = await isOnline();
|
|
@@ -1246,7 +1246,6 @@ function parseGitURI(input) {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
1248
|
// src/index.ts
|
|
1249
|
-
import { tasks } from "@astrojs/cli-kit";
|
|
1250
1249
|
var exit = () => process.exit(0);
|
|
1251
1250
|
process.on("SIGINT", exit);
|
|
1252
1251
|
process.on("SIGTERM", exit);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astro",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "withastro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,8 +30,6 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"arg": "^5.0.2",
|
|
33
|
-
"chai": "^4.3.7",
|
|
34
|
-
"mocha": "^10.2.0",
|
|
35
33
|
"strip-ansi": "^7.1.0",
|
|
36
34
|
"strip-json-comments": "^5.0.1",
|
|
37
35
|
"astro-scripts": "0.0.14"
|