Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: antfu-collective/ni
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.21.10
Choose a base ref
...
head repository: antfu-collective/ni
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.21.11
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Nov 27, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    760598e View commit details
  2. chore: release v0.21.11

    antfu committed Nov 27, 2023
    Copy the full SHA
    1bb91b3 View commit details
Showing with 10 additions and 13 deletions.
  1. +1 −1 package.json
  2. +9 −12 src/config.ts
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@antfu/ni",
"type": "module",
"version": "0.21.10",
"version": "0.21.11",
"packageManager": "pnpm@8.10.5",
"description": "Use the right package manager",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
21 changes: 9 additions & 12 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -29,19 +29,16 @@ let config: Config | undefined

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

return config