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

default tasks #5

Open
jonschlinkert opened this issue Apr 14, 2016 · 4 comments
Open

default tasks #5

jonschlinkert opened this issue Apr 14, 2016 · 4 comments

Comments

@jonschlinkert
Copy link
Member

Here's what I'm thinking (this all works locally):

  • when tasks are explicitly defined on argv, run them
  • when no tasks are explicitly defined on argv
    • if .verb.md exists AND no verbfile.js exists, run the readme task (the downside is that we need also inform the user that verb-readme-generator needs to be installed)
    • if no .verb.md, set the default task to default (we can also ask the user if they want to add one, and if so, we can generate it then set the default task to readme)
    • if tasks were not passed on argv and the tasks property defined on the verb config object in package.json or in .verb.json, we will use that value

Questions:

  • If tasks are defined in package.json on the verb config object, or in .verb.json, AND a verbfile.js exists, IMO that doesn't change anything, we should still run the tasks defined on the config object. Pushback? thoughts?
@tunnckoCore
Copy link

Sounds reasonable and good.
I think the correct priority is package.json, then verb.json, then globals.

Hmm, maybe I get it wrong in first glance while writing, lol. So: the answer for me is to not run the tasks from configs, it should just run the verbfile (calling the default task only).

@doowb
Copy link
Member

doowb commented Apr 14, 2016

IMO that doesn't change anything, we should still run the tasks defined on the config object.

I agree. I think the verbfile.js is for overriding or adding new things (templates, helpers, plugins, tasks...). Then if you want to explicitly run a task from the verbfile.js you can either specify it in the command line or update the config setting to that task.

This also reduces the amount of logic needed to try to figure out if the verbfile.js specified a default task or not.

@jonschlinkert
Copy link
Member Author

the answer for me is to not run the tasks from configs, it should just run the verbfile (calling the default task only).

this is why I asked. I initially was thinking the same thing, but now I'm thinking that if you set something in your config we should respect that. Otherwise I think users will get confused if the tasks property defined in package.json doesn't do anything.

@jonschlinkert
Copy link
Member Author

actually I think @tunnckoCore is right. The arguments for using tasks defined in config make sense, but what happens when the user wants to just run the default task in verbfile.js and there are tasks defined in config?

Would you run verb default? In which case verb will override that with tasks in config. Would we have special logic to determine that the user actually entered default on the command line? (I hope not)

I think it's cleaner to just say: "If a verbfile.js is used in a project, tasks must be defined in verbfile.js or passed on the command line and any tasks defined in .verb.json or package.json will be ignored"

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

3 participants