gruntjs / grunt-cli

Grunt's command line interface.
http://gruntjs.com/
MIT License
706 stars 248 forks source link

Implement liftoff into grunt-cli #117

Closed shama closed 6 years ago

shama commented 6 years ago

Ref: https://github.com/gruntjs/rfcs/blob/master/text/0001-liftoff.md

This is a conservative implementation of Liftoff into grunt-cli. It should be fully backwards compatible with existing Grunt versions. It needs a bit more vetting though to be sure.

This adds the ability to write your Gruntfile in any language: Gruntfile.ts, Gruntfile.coffee, Gruntfile.babel.js and many others. Or if the language isnt natively supported, you can run your own: grunt --require custom-lang/register.

You can also now specify v8 flags, so grunt --harmony gets passed to the node process (maybe not as useful these days but at least it can now).


Down the road, this change will allow us to remove the coffeescript dependency and lib/grunt/cli.js (among other related deps). When we do so, anyone who previously had a Gruntfile.coffee, would need to separately npm install coffeescript but the good news is they'll no longer be stuck to our old version. But all that can wait until we do a grunt@2.0.0 release.

jsf-clabot commented 6 years ago

CLA assistant check
All committers have signed the CLA.

shama commented 6 years ago

FYI, I've been using this branch as my grunt command for the past 2 weeks on all my projects. Everything has been 👍. There are a few more edge cases I want to test and then will merge/release this.

tkellen commented 6 years ago

@shama, @vladikoff, @Arkni, ya'll are saints. Thank you for working on this!

shama commented 6 years ago

One part I'm having second thoughts about is whether to support all the v8 flags. At the moment, v8flags needs to shell out node --v8-options to get the list of options. This adds a tiny perf hit in the beginning and takes a lot of options from userland.

The alternative is someone could do node --harmony ./node_modules/.bin/grunt --my-flag if they needed to run node with a specific flag.

vladikoff commented 6 years ago

a tiny perf hit

If it's a really tiny hit that's fine.

tkellen commented 6 years ago

@shama That perf hit is only incurred once, we cache the output and read it from a file after subsequent runs.

jorrit commented 6 years ago

Is anything holding this issue back? It sounds great!

vladikoff commented 6 years ago

Soon.