Skip to content

Commit

Permalink
Enable bun on Windows (#1401)
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine authored Apr 25, 2024
1 parent a788309 commit 3b12e6a
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 29 deletions.
139 changes: 137 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "npm-check-updates",
"version": "16.14.19",
"version": "16.14.20-0",
"author": "Tomas Junnonen <[email protected]>",
"license": "Apache-2.0",
"contributors": [
Expand Down Expand Up @@ -37,7 +37,7 @@
"lint:lockfile": "lockfile-lint",
"lint:markdown": "markdownlint \"**/*.md\" --ignore node_modules --ignore build --config .markdownlint.js",
"lint:src": "eslint --cache --cache-location node_modules/.cache/.eslintcache --ignore-path .gitignore --report-unused-disable-directives .",
"prepare": "src/scripts/install-hooks && test/bun-setup.sh",
"prepare": "src/scripts/install-hooks",
"prepublishOnly": "npm run build",
"prettier": "prettier .",
"test": "mocha test test/package-managers/*",
Expand Down Expand Up @@ -117,6 +117,7 @@
"@types/update-notifier": "^6.0.5",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"bun": "^1.1.4",
"c8": "^7.14.0",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const install = async (

pkgsNormalized.forEach(async pkgFile => {
const packageManager = await getPackageManagerForInstall(options, pkgFile)
const cmd = packageManager + (process.platform === 'win32' ? '.cmd' : '')
const cmd = packageManager + (process.platform === 'win32' && packageManager !== 'bun' ? '.cmd' : '')
const cwd = options.cwd || path.resolve(pkgFile, '..')
let stdout = ''
try {
Expand Down
7 changes: 0 additions & 7 deletions src/package-managers/bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Options } from 'pacote'
import path from 'path'
import spawn from 'spawn-please'
import keyValueBy from '../lib/keyValueBy'
import programError from '../lib/programError'
import { Index } from '../types/IndexType'
import { NpmOptions } from '../types/NpmOptions'
import * as npm from './npm'
Expand All @@ -13,12 +12,6 @@ async function spawnBun(
npmOptions: NpmOptions = {},
spawnOptions: Index<any> = {},
): Promise<string> {
// Bun not yet supported on Windows.
// @see https://github.com/oven-sh/bun/issues/43
if (process.platform === 'win32') {
programError(npmOptions, 'Bun not yet supported on Windows')
}

const fullArgs = [
...(npmOptions.prefix ? [`--prefix=${npmOptions.prefix}`] : []),
...(npmOptions.location === 'global' ? ['--global'] : []),
Expand Down
12 changes: 0 additions & 12 deletions test/bun-setup.sh

This file was deleted.

1 change: 0 additions & 1 deletion test/doctor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ else {
testFail({ packageManager: 'yarn' })
})

// Bun not yet supported on Windows
// const describeSkipWindows = os.platform() === 'win32' ? describe.skip : describe
// TODO: Works locally, but not in GitHub action.
describe.skip('bun', () => {
Expand Down
5 changes: 1 addition & 4 deletions test/package-managers/bun/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import os from 'os'
import * as bun from '../../../src/package-managers/bun'
import chaiSetup from '../../helpers/chaiSetup'

chaiSetup()

// Bun not yet supported on Windows
const describeSkipWindows = os.platform() === 'win32' ? describe.skip : describe
describeSkipWindows('bun', function () {
describe('bun', function () {
it('list', async () => {
const result = await bun.list({ cwd: __dirname })
result.should.have.property('ncu-test-v2')
Expand Down

0 comments on commit 3b12e6a

Please sign in to comment.