antfu-collective / taze

🥦 A modern cli tool that keeps your deps fresh
MIT License
2.67k stars 86 forks source link

support change registry #13

Open bytemain opened 3 years ago

bytemain commented 3 years ago

support change registry in command line.

and also can get registry from npmrc/yarnrc

a1mersnow commented 10 months ago

As I test, taze already support specify the registry via .npmrc.

In my opinion, it's not very useful to specify registry via command line options.

export async function getPackageData(name: string): Promise<PackageData> {
  // ...

  try {
    debug.resolve(`resolving ${name}`)
    const npmConfig = await getNpmConfig()
    // .npmrc -> npmConfig
    const data = await pacote.packument(name, { ...npmConfig, fullMetadata: true })

    // ...
  }
  catch (e) {
    error = e
  }
  // ...
}