create-astro 4.12.0 → 4.12.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/index.js +22 -4
- package/dist/messages.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -349,9 +349,9 @@ var getName = () => new Promise((resolve) => {
|
|
|
349
349
|
});
|
|
350
350
|
});
|
|
351
351
|
});
|
|
352
|
-
var getVersion = (packageManager, packageName, fallback = "") => new Promise(async (resolve) => {
|
|
352
|
+
var getVersion = (packageManager, packageName, packageTag = "latest", fallback = "") => new Promise(async (resolve) => {
|
|
353
353
|
let registry = await getRegistry(packageManager);
|
|
354
|
-
const { version } = await fetch(`${registry}/${packageName}
|
|
354
|
+
const { version } = await fetch(`${registry}/${packageName}/${packageTag}`, {
|
|
355
355
|
redirect: "follow"
|
|
356
356
|
}).then((res) => res.json()).catch(() => ({ version: fallback }));
|
|
357
357
|
return resolve(version);
|
|
@@ -442,7 +442,7 @@ function printHelp({
|
|
|
442
442
|
if (headline) {
|
|
443
443
|
message.push(
|
|
444
444
|
linebreak(),
|
|
445
|
-
`${title(commandName)} ${color.green(`v${"4.12.
|
|
445
|
+
`${title(commandName)} ${color.green(`v${"4.12.1"}`)} ${headline}`
|
|
446
446
|
);
|
|
447
447
|
}
|
|
448
448
|
if (usage) {
|
|
@@ -466,7 +466,20 @@ function printHelp({
|
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
// src/actions/context.ts
|
|
469
|
+
function getPackageTag(packageSpecifier) {
|
|
470
|
+
switch (packageSpecifier) {
|
|
471
|
+
case "alpha":
|
|
472
|
+
case "beta":
|
|
473
|
+
case "rc":
|
|
474
|
+
return packageSpecifier;
|
|
475
|
+
// Will fallback to latest
|
|
476
|
+
case void 0:
|
|
477
|
+
default:
|
|
478
|
+
return void 0;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
469
481
|
async function getContext(argv) {
|
|
482
|
+
const packageSpecifier = argv.find((argItem) => /^(astro|create-astro)@/.exec(argItem))?.split("@")[1];
|
|
470
483
|
const flags = (0, import_arg.default)(
|
|
471
484
|
{
|
|
472
485
|
"--template": String,
|
|
@@ -518,7 +531,12 @@ async function getContext(argv) {
|
|
|
518
531
|
prompt,
|
|
519
532
|
packageManager,
|
|
520
533
|
username: getName(),
|
|
521
|
-
version: getVersion(
|
|
534
|
+
version: getVersion(
|
|
535
|
+
packageManager,
|
|
536
|
+
"astro",
|
|
537
|
+
getPackageTag(packageSpecifier),
|
|
538
|
+
"5.8.1"
|
|
539
|
+
),
|
|
522
540
|
skipHouston,
|
|
523
541
|
fancy,
|
|
524
542
|
add,
|
package/dist/messages.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function say(messages: string | string[], { clear, hat, tie }?: {
|
|
|
5
5
|
}): Promise<void>;
|
|
6
6
|
export declare const title: (text: string) => string;
|
|
7
7
|
export declare const getName: () => Promise<string>;
|
|
8
|
-
export declare const getVersion: (packageManager: string, packageName: string, fallback?: string) => Promise<string>;
|
|
8
|
+
export declare const getVersion: (packageManager: string, packageName: string, packageTag?: string, fallback?: string) => Promise<string>;
|
|
9
9
|
export declare const log: (message: string) => boolean;
|
|
10
10
|
export declare const banner: () => void;
|
|
11
11
|
export declare const bannerAbort: () => boolean;
|