gulpjs / undertaker

Task registry that allows composition through series/parallel methods.
MIT License
200 stars 31 forks source link

tree() returns an array #24

Closed mikehaas763 closed 8 years ago

mikehaas763 commented 9 years ago

I'm consuming the tree() function from the gulp implementation and I get an array of task names returned. The documentation indicates that an object graph should be returned. Can someone clarify how this is supposed to work?

tunnckoCore commented 9 years ago

yea, pass {deep: true} to have json tree like

[ { label: 'should throw TypeError when `name` is not a string',
    type: 'task',
    nodes: [] },
  { label: 'should throw TypeError when `callback` is not a function',
    type: 'task',
    nodes: [] },
  { label: 'should return false if given `name` exist in npm registry',
    type: 'task',
    nodes: [] },
  { label: 'should return true if given `name` not exist in npm registry',
    type: 'task',
    nodes: [] },
  { label: 'should return false when repository already exists',
    type: 'task',
    nodes: [] },
  { label: 'should return true when repository not exists',
    type: 'task',
    nodes: [] } ]

this is copy-pasta from my test runner based on undertaker.

mikehaas763 commented 9 years ago

@tunnckoCore Thanks, I missed that. I saw the documentation about deep and tried passing a bool directly rather than an object with the deep property.

Anyway, what an intuitive API. Ask for a tree and get something else.

phated commented 9 years ago

@mikehaas763 no need to be a sarcastic asshole about it. I actually agree that it is not intuitive and I am looking into switching it over to a tree. It seems like I can make it work with gulp's CLI for 4.0 without too much trouble.

tunnckoCore commented 9 years ago

@phated maybe its a good idea Undertaker to have also .tasks() method which will just return array with task names. and tree to be just as .tree({deep: true})

phated commented 9 years ago

@tunnckoCore that API is too close to task, the main API, and I know it would cause more issues than it would solve.

tunnckoCore commented 9 years ago

hmm.. nope, it would be intuitive.

there's no place for confusion.

phated commented 9 years ago

there is plenty of room for confusion when someone typos task as tasks. I've already considered this and am not going to do that

phated commented 9 years ago

@mikehaas763 be aware that I am looking into this, but I am going to lock this for my sanity.

phated commented 8 years ago

Completed in https://github.com/gulpjs/undertaker/commit/c1cda411ad2cc4e906041edf389f72ac74ee0ef2