Git Product home page Git Product logo

Comments (5)

phated avatar phated commented on July 25, 2024

You are overthinking this. It is not recommended to call the method returned by taker.series directly, the wrapping libraries take care of that for you.

You shouldn't be wrapping taker.task or taker.series in a promise.

If you need to register custom tasks, use a Custom Registry.

If you are just using custom functions for taker.series, you can just pass it functions directly to the method; you don't have to register them as tasks first.

You most definitely should not be listening to the events emitted by undertaker. They are undocumented and likely to change. They are an implementation detail that leaked to wire up gulp-cli and task resolution.

from undertaker.

Reinmar avatar Reinmar commented on July 25, 2024

Thanks for clarifying this.

I must say I'm a bit surprised. I thought that Undertaker will be a great tool to do a gulp-like task management, but outside of gulp.

I'm writing a library which is meant to expose some tasks, but which also should be reusable and easy to use. Hence, it exposes low level tasks (e.g. compileFoo(), compileBar()) and some higher level ones (e.g. compileAll() which internally will call the compileFoo() and compileBar() ones). However, I can't use gulp for that because:

  • the code must be reusable without it (I'm creating a library which should be useful in many contexts),
  • I want to avoid registering unnecessary intermediate tasks (to not pollute gulp -T),
  • tasks should accept their options as function arguments, not through some separate channel like CLI args (cause I don't even know how those functions are called).

So, for me tasks like compileFoo() are just functions which can return stream, promise or nothing. In order to implement compileAll() I need to sync all of them together and this is where I thought I can use undertaker.

It seemed a perfect solution and now I'm puzzled, cause I don't understand:

  • what problems is undertaker supposed to solve?
  • how to use it right?

And, of course, I'd like to know how to solve my case ;). Unfortunately, as you can see, I found the documentation confusing.

The funny thing is that the way I use it, it solves my problems perfectly. For me, this proves undertaker's value and I'd be super happy if its scope could be extended to also cover use cases like mine.

from undertaker.

phated avatar phated commented on July 25, 2024

If you'd like to open another issue about this use case with more in-depth examples, I'd be interested in discussing it further and helping you solve/understand the usage. Your usage sounds interesting and I'm quite intrigued.

from undertaker.

phated avatar phated commented on July 25, 2024

@Reinmar are you still interested in opening another issue to discuss your use case further?

from undertaker.

Reinmar avatar Reinmar commented on July 25, 2024

Yep, I've just opened #67.

from undertaker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.