Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
aswind7 opened this issue Nov 15, 2023 · 1 comment
Closed

Comments

@aswind7
Copy link

aswind7 commented Nov 15, 2023

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
}
@aswind7 aswind7 changed the title Is globalAgent always use npm when i run Is globalAgent always use npm when run 'ni -g xxx' in project workspace? Nov 15, 2023
@antfu
Copy link
Member

antfu commented Nov 15, 2023

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants