mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
parent
fcba0f0199
commit
9e2426f756
3 changed files with 18 additions and 4 deletions
6
.changeset/fair-trees-jump.md
Normal file
6
.changeset/fair-trees-jump.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'create-astro': patch
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Default registry logic to fallback to NPM if registry command fails (sorry, Bun users!)
|
|
@ -77,8 +77,12 @@ const OFFICIAL_ADAPTER_TO_IMPORT_MAP: Record<string, string> = {
|
|||
// A copy of this function also exists in the create-astro package
|
||||
async function getRegistry(): Promise<string> {
|
||||
const packageManager = (await preferredPM(process.cwd()))?.name || 'npm';
|
||||
try {
|
||||
const { stdout } = await execa(packageManager, ['config', 'get', 'registry']);
|
||||
return stdout || 'https://registry.npmjs.org';
|
||||
} catch (e) {
|
||||
return 'https://registry.npmjs.org';
|
||||
}
|
||||
}
|
||||
|
||||
export default async function add(names: string[], { cwd, flags, logging }: AddOptions) {
|
||||
|
|
|
@ -13,8 +13,12 @@ import detectPackageManager from 'which-pm-runs';
|
|||
// A copy of this function also exists in the astro package
|
||||
async function getRegistry(): Promise<string> {
|
||||
const packageManager = detectPackageManager()?.name || 'npm';
|
||||
try {
|
||||
const { stdout } = await execa(packageManager, ['config', 'get', 'registry']);
|
||||
return stdout || 'https://registry.npmjs.org';
|
||||
} catch (e) {
|
||||
return 'https://registry.npmjs.org';
|
||||
}
|
||||
}
|
||||
|
||||
let stdout = process.stdout;
|
||||
|
|
Loading…
Reference in a new issue