Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise support for API #351

Open
luvies opened this issue Aug 26, 2018 · 8 comments
Open

Promise support for API #351

luvies opened this issue Aug 26, 2018 · 8 comments

Comments

@luvies
Copy link

luvies commented Aug 26, 2018

Would it be possible to provide promise-based versions of the API jake provides to allow a Jakefile to be written completely with async/awaits? Using util.promisify you should be able to have a small function that loops through the API functions and converts them I would think.

@luvies
Copy link
Author

luvies commented Aug 26, 2018

You could alternatively make it so that commands like jake.exec return a promise if no callback is passed in

@zaaack
Copy link

zaaack commented Nov 23, 2018

Any updates here? This can make jake more modern.

@zaaack
Copy link

zaaack commented Dec 6, 2018

Never mind, I just published a new task runner cli app which support promise: https://github.com/zaaack/foy

@luvies
Copy link
Author

luvies commented Dec 6, 2018

I actually did something similar (luvies/take), which is why I've mostly given up on this issue (athough I need to put some more work into it)

@chocolateboy
Copy link

They both look... promising :-), but neither of them appears to do a topological sort of the dependencies, which IMO is the most important feature of a make/rake-like task runner.

@luvies
Copy link
Author

luvies commented Dec 6, 2018

My task runner does actually build up a full dependency tree, making it perform all dependency-less targets in parallel would be trivial I think (I already support a parallelDeps option that does this, but only for the dependencies of the current target). I haven't really seen topological sorts before tbh, but it looks like I did at least something like it instinctively. I also implemented this so I could detect things like circular dependencies easily & before execution.

@zaaack
Copy link

zaaack commented Dec 6, 2018

@chocolateboy Well, mine just added a simple hash set for tasks in the dependency tree, each task with same name and options will be identified as a standalone task and will be executed once. Also, each task is executed serialized by default. But you can use options to change them, like force rerun, parallelize dependencies' execution.

@NoahTheDuke
Copy link

Seems like most of the API works async, but invoke and execute aren't, making it hard to call other tasks that are async.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants