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:
parent
0a1036eef6
commit
2fe2da6b52
2 changed files with 6 additions and 4 deletions
|
@ -75,6 +75,8 @@ export async function getContext(argv: string[]): Promise<Context> {
|
||||||
} = flags;
|
} = flags;
|
||||||
let projectName = cwd;
|
let projectName = cwd;
|
||||||
|
|
||||||
|
ref ??= 'latest'
|
||||||
|
|
||||||
if (no) {
|
if (no) {
|
||||||
yes = false;
|
yes = false;
|
||||||
if (install == undefined) install = false;
|
if (install == undefined) install = false;
|
||||||
|
@ -93,13 +95,13 @@ export async function getContext(argv: string[]): Promise<Context> {
|
||||||
prompt,
|
prompt,
|
||||||
packageManager,
|
packageManager,
|
||||||
username: getName(),
|
username: getName(),
|
||||||
version: getVersion(packageManager, 'astro', process.env.ASTRO_VERSION),
|
version: getVersion(packageManager, 'astro', ref, process.env.ASTRO_VERSION),
|
||||||
skipHouston,
|
skipHouston,
|
||||||
fancy,
|
fancy,
|
||||||
dryRun,
|
dryRun,
|
||||||
projectName,
|
projectName,
|
||||||
template,
|
template,
|
||||||
ref: ref ?? 'latest',
|
ref,
|
||||||
welcome: random(messages),
|
welcome: random(messages),
|
||||||
hat: hats ? random(hats) : undefined,
|
hat: hats ? random(hats) : undefined,
|
||||||
tie: ties ? random(ties) : undefined,
|
tie: ties ? random(ties) : undefined,
|
||||||
|
|
|
@ -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) => {
|
new Promise<string>(async (resolve) => {
|
||||||
let registry = await getRegistry(packageManager);
|
let registry = await getRegistry(packageManager);
|
||||||
const { version } = await fetch(`${registry}/${packageName}/latest`, {
|
const { version } = await fetch(`${registry}/${packageName}/${ref}`, {
|
||||||
redirect: 'follow',
|
redirect: 'follow',
|
||||||
})
|
})
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
|
|
Loading…
Reference in a new issue