0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

Fix beta reference in create-astro

This commit is contained in:
Reuben Tier 2024-09-27 11:22:42 +01:00
parent 0a1036eef6
commit 2fe2da6b52
No known key found for this signature in database
GPG key ID: 08B0E5AC1EFCC6AB
2 changed files with 6 additions and 4 deletions

View file

@ -75,6 +75,8 @@ export async function getContext(argv: string[]): Promise<Context> {
} = flags;
let projectName = cwd;
ref ??= 'latest'
if (no) {
yes = false;
if (install == undefined) install = false;
@ -93,13 +95,13 @@ export async function getContext(argv: string[]): Promise<Context> {
prompt,
packageManager,
username: getName(),
version: getVersion(packageManager, 'astro', process.env.ASTRO_VERSION),
version: getVersion(packageManager, 'astro', ref, process.env.ASTRO_VERSION),
skipHouston,
fancy,
dryRun,
projectName,
template,
ref: ref ?? 'latest',
ref,
welcome: random(messages),
hat: hats ? random(hats) : undefined,
tie: ties ? random(ties) : undefined,

View file

@ -60,10 +60,10 @@ export const getName = () =>
});
});
export const getVersion = (packageManager: string, packageName: string, fallback = '') =>
export const getVersion = (packageManager: string, packageName: string, ref: string, fallback = '') =>
new Promise<string>(async (resolve) => {
let registry = await getRegistry(packageManager);
const { version } = await fetch(`${registry}/${packageName}/latest`, {
const { version } = await fetch(`${registry}/${packageName}/${ref}`, {
redirect: 'follow',
})
.then((res) => res.json())