oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.82k stars 2.56k forks source link

bun install and bunx not work well when use husky and @commitlint/cli #10691

Open sharh opened 2 months ago

sharh commented 2 months ago

What version of Bun is running?

1.1.6

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

# bun init
bun init
# install deps
bun install -d @commitlint/config-conventional @commitlint/cli husky
# init git
git init -b dev
# init git hook
bunx husky init

bunx husky init not works well: image

when change to npx, it works well as the above picture presents.

# huasky init
npx husky init
# commit lint
echo npx --no -- commitlint --edit $1 > .husky/commit-msg
# git commit lint
git commit -am 'test'

while use bun install the deps,the @commitlint/cli not works with husky git hook npx --no -- commitlint --edit $1 image

infact, the command commitlint is installed in node_modules/.bin diretory: image

when I change the git hook to: bunx --no -- commitlint --edit $1 it works: image

when use npm install -D @commitlint/config-conventional @commitlint/cli husky,this can be work well:

npx --no -- commitlint --edit $1

image

bunx --no -- commitlint --edit $1

image both bunx and npx can work well:

What is the expected behavior?

I hope bun install can works well as npm install

bun install -d @commitlint/config-conventional @commitlint/cli husky
bunx husky init
npm install -D @commitlint/config-conventional @commitlint/cli husky
npx husky init

bunx should works well as npx

bunx --no -- commitlint --edit $1 
npx --no -- commitlint --edit $1 

What do you see instead?

No response

Additional information

No response

snuricp commented 2 weeks ago

Bump.

I have the same issue here, trying to use bunx in the pre-commit hook with husky.

I'm trying to run

bunx tsc --noEmit
bunx lint-staged

But I get always as an error bunx: command not found