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

tree() returns an array #24

Closed
mikehaas763 opened this issue Apr 20, 2015 · 9 comments
Closed

tree() returns an array #24

mikehaas763 opened this issue Apr 20, 2015 · 9 comments
Milestone

Comments

@mikehaas763
Copy link

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
Copy link

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
Copy link
Author

@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
Copy link
Member

phated commented Apr 21, 2015

@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
Copy link

@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
Copy link
Member

phated commented Apr 21, 2015

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

@tunnckoCore
Copy link

hmm.. nope, it would be intuitive.

  • .task(name) - get a task with specified name
  • .tasks() - get all tasks
  • .tree() - archey list

there's no place for confusion.

@phated
Copy link
Member

phated commented Apr 21, 2015

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
Copy link
Member

phated commented Apr 21, 2015

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

@gulpjs gulpjs locked and limited conversation to collaborators Apr 21, 2015
@phated phated modified the milestone: 1.0.0 Aug 21, 2015
@phated
Copy link
Member

phated commented Nov 17, 2015

Completed in c1cda41

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

No branches or pull requests

3 participants