isaacs / rimraf

A `rm -rf` util for nodejs
ISC License
5.66k stars 252 forks source link

[5.0.2 regression]: bin is broken? #288

Closed AviVahl closed 1 year ago

AviVahl commented 1 year ago

Noticed calls to rimraf are no-op. Even --help.

mkdir rimraf-test
cd rimraf-test
npm init -y
npm i rimraf -D
npx rimraf --help
<nothing>

Interesting part: directly calling node node_modules/rimraf/dist/esm/bin.mjs --help works. I'm guessing it's a file mode thingy. If the mjs is generated, npm i didn't get to set its mode, like it does for bin entrypoints. Possible fix, create a static bin entry that imports that file. e.g. https://github.com/wixplosives/pleb/blob/main/bin/pleb.js (see that GitHub says "executable file")

isaacs commented 1 year ago

Not file mode, was detecting main-module status incorrectly.

I could have sworn that node realpath'ed argv[1], but I guess it doesn't do that anymore, or my brain is just lying about history, it does do that sometimes.

fwouts commented 1 year ago

Thank you for the very prompt fix! 🎉