Making Cross-Platform npm Scripts

One of the questions I had early on as I began work on the JavaScript Test Recipes project was how I could make sure my Node npm scripts worked in a cross-platform way.  As you may know, many JavaScript developers are following the lead of Keith Cirkel by abandoning Grunt and Gulp in favor of a still more simple build tool they already use:  npm.  For the sake of reducing the needed dependencies, I’m trying to use only npm scripts as well for the builds.  However, the limitation is that even though my Linux box and someone else’s Mac may think of “./node_modules/.bin/some_module” as a perfectly acceptable path, we’re greatly outnumbered by folks working in environments that want to see “node_modules\.bin\some_module”.

A really simple and elegant solution to this that I stumbled upon was the npm-run package

Leave a Reply