yeoman / yo

CLI tool for running Yeoman generators
http://yeoman.io
BSD 2-Clause "Simplified" License
3.85k stars 399 forks source link

Be helpful when generator is not installed #423

Open sindresorhus opened 8 years ago

sindresorhus commented 8 years ago

We should be helpful when a user tries to run a generator that is not installed. If it exists on npm, we should show how to install it, if not, we could search the generator list for similar ones and suggest them.

Similar to https://github.com/Homebrew/homebrew-command-not-found.

SBoudrias commented 8 years ago

Also, it'd be useful to suggest troubleshooting information. (basically, run yo doctor)

I believe I've looked at this issue a little while back and realized it was actually rooted into yeoman-environment. We probably should update the way this module find and run generator to allow surfacing these errors to the UI layers.

PatrickWalker commented 8 years ago

With the NPM search would we want to somehow find a 'top' result?

Example: I wanted to run yo angular2. It doesn't find one. So I try to search

npm search yeoman-generator generator-

that should get me a pretty good result so I could probably take the top 1 and add some text after it to say "If this doesn't look like what you want try searching..." or similar.

My main question probably is on the time of exeuction. At the minute yo is pretty lightning when it comes to this. I typo something yo angluar2 or similar and bang it lets me know. If you go off and do an npm search isn't that going to keep me waiting for a bit? It seems to take a fair bit of time locally for me anyway so if that's ok and the feature is still wanted would you want it hidden behind a flag or something?

Wondering if https://github.com/yeoman/yo/issues/361 and the generator list might be a speedier search mechanism for this? From my understanding, very limited as I'm a newb :smile: , it seems like reasonably similar implementation to the homebrew-command-not-found as it seems to operate a db or commands and aliases?

mischah commented 8 years ago

Partly fixed with: https://github.com/yeoman/environment/pull/70? improved

Talking with npm would be an awesome addition though 👌