antfu-collective / ni

💡 Use the right package manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is globalAgent always use npm when run 'ni -g xxx' in project workspace?

aswind7 opened this issue · comments

when i run 'ni -g xxx' in a project workspace i see it always use npm, then i see the source code of src/config.ts.
I think it always excute config = { ...defaultConfig, defaultAgent: agent } because agent always exists. And i want to know is it so? thanks.

export async function getConfig(): Promise<Config> {
  if (!config) {
    const agent = await detect({ programmatic: true })
    if (agent)
      config = { ...defaultConfig, defaultAgent: agent }
    else
      config = Object.assign({}, defaultConfig, ini.parse(fs.readFileSync(rcPath, 'utf-8')))
  }

  return config
}