Skip to content

Commit

Permalink
fix: bun.lockb takes higher priority
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 14, 2022
1 parent 85f8ff1 commit a4e1c49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -218,7 +218,7 @@ export NI_CONFIG_FILE="$HOME/.config/ni/nirc"

**ni** assumes that you work with lockfiles (and you should)

Before it runs, it will detect your `yarn.lock` / `pnpm-lock.yaml` / `package-lock.json` to know current package manager (or `packageManager` field in your packages.json), and runs the corresponding commands.
Before it runs, it will detect your `yarn.lock` / `pnpm-lock.yaml` / `package-lock.json` / `bun.lockb` to know current package manager (or `packageManager` field in your packages.json if specified), and runs the [corresponding commands](https://github.com/antfu/ni/blob/main/src/agents.ts).

### Trouble shooting

Expand Down
5 changes: 3 additions & 2 deletions src/agents.ts
Expand Up @@ -83,19 +83,20 @@ export type Command = keyof typeof AGENTS.npm

export const agents = Object.keys(AGENTS) as Agent[]

// the order here matters, more specific one comes first
export const LOCKS: Record<string, Agent> = {
'bun.lockb': 'bun',
'pnpm-lock.yaml': 'pnpm',
'yarn.lock': 'yarn',
'package-lock.json': 'npm',
'npm-shrinkwrap.json': 'npm',
'bun.lockb': 'bun',
}

export const INSTALL_PAGE: Record<Agent, string> = {
'bun': 'https://bun.sh',
'pnpm': 'https://pnpm.js.org/en/installation',
'pnpm@6': 'https://pnpm.js.org/en/installation',
'yarn': 'https://classic.yarnpkg.com/en/docs/install',
'yarn@berry': 'https://yarnpkg.com/getting-started/install',
'npm': 'https://www.npmjs.com/get-npm',
'bun': 'https://bun.sh',
}

0 comments on commit a4e1c49

Please sign in to comment.