grunt-cli
grunt-cli copied to clipboard
Request: more friendly CLI UX
❯ grunt init
grunt-cli: The grunt command line interface. (v0.1.13)
Fatal error: Unable to find local grunt.
If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started
Shouldn't this just generate a Gruntfile for the user?
The same error is displayed with grunt help and grunt --help.
I understand that at some point, this functionality was removed from Grunt, but I cannot figure out why. The links are broken in the current docs.
It'd also be great if there was a CLI UI like Bower or Yeoman.
❯ bower help init
Usage:
bower init [<options>]
Options:
-h, --help Show this help message
Additionally all global options listed in 'bower help' are available
Description:
Creates a bower.json file based on answers to questions.
❯ yo
[?] What would you like to do? (Use arrow keys)
❯ Run the Angular generator (0.7.1)
Run the Bootstrap3-less generator (3.0.1)
Run the Pure generator (0.2.0)
Run the Static generator (0.0.8)
Run the Webapp generator (0.4.7)
Run the Zurb-foundation generator (0.3.5)
Run the Karma generator (0.6.0)
(Move up and down to reveal more choices)
Even further,
❯ grunt-init
Running "init" task
A valid init template name must be specified.
Available templates
(No templates found)
Templates that exist in the /Users/kevinsuttle/.grunt-init directory may be run
with "grunt-init TEMPLATE". Templates that exist in another location may be run
with "grunt-init /path/to/TEMPLATE". A template is a directory that must
contain, at the very minimum, a template.js file.
For more information, see http://gruntjs.com/project-scaffolding
This is an opportunity to do work on the user's behalf, not give them a chore.
Thanks for creating this issue. We need to brainstorm this in the future. Here's some examples of how other tools handle it:
~/dev
$ rake
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
(See full trace by running task with --trace)
$ make
make: *** No targets specified and no makefile found. Stop.
Yeah, those could be improved also. I don't use them much anymore, but the (anti-)patterns are the same.
Nearly 4 years later this issue still exists. Luckily this is a very popular search topic on Stackoverflow. How about this message instead of/in addition to '...please see the Getting Started Guide'
Working with an existing grunt project? Try this:
Change to the project's root directory.
Install project dependencies with npm install.
Run Grunt with grunt.