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;
|
||||
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,
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue