Skip to content

Commit

Permalink
Merge pull request #41 from kytta/25-bun
Browse files Browse the repository at this point in the history
Add support for Bun
  • Loading branch information
ai authored Jul 1, 2024
2 parents b5faa51 + b34b890 commit 258a68d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
uses: pnpm/action-setup@v3
with:
version: 9
- name: Install Bun
uses: oven-sh/setup-bun@v1
- name: Install Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -43,6 +45,8 @@ jobs:
uses: pnpm/action-setup@v3
with:
version: 9
- name: Install Bun
uses: oven-sh/setup-bun@v1
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand All @@ -67,6 +71,8 @@ jobs:
uses: pnpm/action-setup@v3
with:
version: 7
- name: Install Bun
uses: oven-sh/setup-bun@v1
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ function detectLockfile() {

if (existsSync(lockfilePnpm)) {
return { file: lockfilePnpm, mode: 'pnpm' }
} else if (existsSync(lockfileBun)) {
return { file: lockfileBun, mode: 'bun' }
} else if (existsSync(lockfileNpm)) {
return { file: lockfileNpm, mode: 'npm' }
} else if (existsSync(lockfileYarn)) {
Expand Down
6 changes: 3 additions & 3 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ test('updates caniuse-lite for pnpm', async () => {
})

test('updates caniuse-lite for bun', async () => {
let dir = await chdir('update-bun', 'package.json', 'bun.lockb')
await chdir('update-bun', 'package.json', 'bun.lockb')
match(
runUpdate(),
`Latest version: ${caniuse.version}\n` +
Expand All @@ -274,8 +274,8 @@ test('updates caniuse-lite for bun', async () => {
'caniuse-lite has been successfully updated\n'
)

let lock = (await readFile(join(dir, 'bun.lockb'))).toString()
ok(lock.includes(`/caniuse-lite-${caniuse.version}`))
let pmls = execSync('bun pm ls --all', { env: { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1" } }).toString()
ok(pmls.includes(`caniuse-lite@${caniuse.version}`))
})

test.run()

0 comments on commit 258a68d

Please sign in to comment.