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.9
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.10
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Nov 20, 2023

  1. fix: .nirc may not exist (#186)

    Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
    a1mersnow and antfu authored Nov 20, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8812328 View commit details
  2. chore: update deps

    antfu committed Nov 20, 2023
    Copy the full SHA
    0d37c5c View commit details
  3. chore: release v0.21.10

    antfu committed Nov 20, 2023
    Copy the full SHA
    4890f32 View commit details
Showing with 324 additions and 458 deletions.
  1. +6 −6 package.json
  2. +306 −448 pnpm-lock.yaml
  3. +11 −3 src/config.ts
  4. +1 −1 src/parse.ts
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@antfu/ni",
"type": "module",
"version": "0.21.9",
"packageManager": "pnpm@8.10.2",
"version": "0.21.10",
"packageManager": "pnpm@8.10.5",
"description": "Use the right package manager",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
@@ -48,15 +48,15 @@
"test": "vitest"
},
"devDependencies": {
"@antfu/eslint-config": "^1.1.0",
"@antfu/eslint-config": "^2.0.0",
"@posva/prompts": "^2.4.4",
"@types/fs-extra": "^11.0.4",
"@types/ini": "^1.3.33",
"@types/node": "^20.9.0",
"@types/node": "^20.9.2",
"@types/which": "^3.0.2",
"bumpp": "^9.2.0",
"eslint": "^8.53.0",
"esno": "^0.17.0",
"eslint": "^8.54.0",
"esno": "^4.0.0",
"execa": "^8.0.1",
"fast-glob": "^3.3.2",
"find-up": "^6.3.0",
754 changes: 306 additions & 448 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -30,10 +30,18 @@ let config: Config | undefined
export async function getConfig(): Promise<Config> {
if (!config) {
const agent = await detect({ programmatic: true })
if (agent)
if (agent) {
config = { ...defaultConfig, defaultAgent: agent }
else
config = Object.assign({}, defaultConfig, ini.parse(fs.readFileSync(rcPath, 'utf-8')))
}
else {
config = Object.assign(
{},
defaultConfig,
fs.existsSync(rcPath)
? ini.parse(fs.readFileSync(rcPath, 'utf-8'))
: null,
)
}
}

return config
2 changes: 1 addition & 1 deletion src/parse.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import { exclude } from './utils'
import type { Runner } from './runner'

export class UnsupportedCommand extends Error {
constructor({ agent, command }: { agent: Agent; command: Command }) {
constructor({ agent, command }: { agent: Agent, command: Command }) {
super(`Command "${command}" is not support by agent "${agent}"`)
}
}