Hacker News new | ask | show | jobs
by mythz 883 days ago
Looks good, will consider it next time I need to create a complex shell script. For creating cross-platform scripts in package.json I've settled on shx [1].

[1] https://www.npmjs.com/package/shx

1 comments

Maybe give bsx a try instead? (disclaimer: I'm the maintainer)

    pnpm add --dev bsx

    {
        "scripts": {"cleanup": "bsx rm -rf some-cache"}
    }
https://npm.im/bsx

This would use busybox-w32 on Windows, and regular shell on other platforms. You do have your usual footguns like some *nixes not having some tools installed out of the box, but for the 95% cases this should be fine and it's only 536 kB (vs 1.5M for shx)!