lukeed / taskr

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

Don't use package.json to load dependencies. #279

Open jorgebucaran opened 7 years ago

jorgebucaran commented 7 years ago

This was an early decision choice which I felt would help reduce boilerplate, and it does. On the other hand, it's magic.

EDIT: Grammar.

module.exports = {
  *lint(fly) {
    yield fly.source(js).xo({ esnext: true })
  },
  *scripts(fly) {
    yield fly.source(js).babel({ presets: ["es2015"] }).target(`${dist}/js`)
  },
  *styles(fly) {
    yield fly.source(sass).sass({ outputStyle: "compressed" }).autoprefixer().target(`${dist}/css`)
  },
  *build(fly) {
    yield fly.parallel(["lint", "scripts", "styles"])
  }
}

If you already know the API, you'd know that .source and .target are core and that .sass or .xo must be plugins, but what about plugins like .concat.

lukeed commented 7 years ago

I've been thinking about this as a far-away possibility. I'm developing other aspects of the approach first to see if this arises as a necessity.

Will revisit in the future 👍

jorgebucaran commented 6 years ago

@lukeed Have you thought about this? I was never able to find a good compromise, so I did nothing. Maybe your current approach is better, it works. Feel free to close.

lukeed commented 6 years ago

Hey, I have a lot of stuff in the works, I just haven't had time to refine it and publish it yet.

The only way to do this outside of package.json is with try-catch and require.

Honestly, I've never heard of someone having an issue and trying to bypass package, so this is a really low priority... I leave it open just to think about every once in a while lol

jorgebucaran commented 6 years ago

I remember not liking this approach, the idea of using pkg.json to store configuration, because I disliked it when I was working with ember-cli and their rampant use of pkg.json similarly. But that was an extreme example, and it's not like you are abusing it either.

Yeah, I know what you mean :p