lukeed / taskr

A fast, concurrency-focused task automation tool.
MIT License
2.53k stars 74 forks source link

Remove magic `this` from tasks #243

Closed lukeed closed 7 years ago

lukeed commented 7 years ago

Tasks will lose access to this during definition.

What used to be:

exports.default = function * (opts) {
  yield this.source(opts.src || 'src/**')...
}

Now looks like this:

exports.default = function * (fly, opts) {
  yield fly.source(opts.src || 'src/**')...
}

Note: The opts param is conditionally populated in both cases. This is already an implemented behavior.

Need Feedback

For 2.0, I think users should still have access to this but it will not be documented or encouraged.

Then in 3.0, the binding to this will be removed entirely.


cc: @jbucaran @rauchg

jorgebucaran commented 7 years ago

Nice. Why not entirely removing the binding when 2.0 is released? We could drop node 4.6 by then as well.

lukeed commented 7 years ago

We could. Only hesitation is that it breaks all past flyfiles. There should probably be a grace period, despite the fact that it's easy to upgrade.

jorgebucaran commented 7 years ago

It's fine then. 2.0 is still too soon before I can come up with anything as discussed in #241.

I am going to be toying with this today for a bit!

lukeed commented 7 years ago

@jbucaran Already solved this. Opened issue just for tracking.

jorgebucaran commented 7 years ago

Great! I am going to be toying with #241. I'll update that issue to clarify.

rauchg commented 7 years ago

This is fantastic

devmondo commented 7 years ago

Awesome!!!