mirror of
https://github.com/withastro/astro.git
synced 2025-02-10 22:38:53 -05:00
Fix reference in create-astro
This commit is contained in:
parent
2594eb088d
commit
87b9c89914
2 changed files with 5 additions and 4 deletions
|
@ -74,6 +74,7 @@ export async function getContext(argv: string[]): Promise<Context> {
|
|||
'--ref': ref,
|
||||
} = flags;
|
||||
let projectName = cwd;
|
||||
ref ??= 'latest'
|
||||
|
||||
if (no) {
|
||||
yes = false;
|
||||
|
@ -93,13 +94,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…
Add table
Reference in a new issue