Skip to content

Comment on Why I Left Gulp and Grunt for Npm Scripts

Comments

The `cross-env` used by the author seems useful, I didn't know about that, and for this reason I'd usually write a separate bash script when I wanted to execute something like

  FOO=1 some-command
because this syntax doesn't work in `package.json` on Windows.

BTW. If you're not into bash for writing long scripts, it's pretty easy to write shell scripts in nodejs. Node 0.12+ has native `execSync` that is nice to have to write build code in JS in synchronous way. I wrapped it with two helper functions to have sth like `execAndPrint` and `execAndReturn`:

https://gist.github.com/jakub-g/a128174fc135eb773631

It's not as powerful as bash script (doesn't support | syntax for redirecting etc) but if you need that, you can extract it away to a helper bash script.

See also https://github.com/shelljs/shelljs

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.