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

should scoped generators show up in my generator list? #1640

Closed
travi opened this issue Oct 25, 2016 · 7 comments
Closed

should scoped generators show up in my generator list? #1640

travi opened this issue Oct 25, 2016 · 7 comments

Comments

@travi
Copy link

travi commented Oct 25, 2016

I've been struggling with something that I kind of expected to just work.

I've started to put together a couple of very foundational generators that I want to extend with more specialized ones, the first of which is here. My intent is to scope these to my namespace so they don't collide with others.

When I try to make it available to yo by using npm link, it does not show up in the list of generators. Also, when I try to run it directly as yo @travi/git, I get the following message:

Error @travi/git 

You don’t seem to have a generator with the name “@travi/git” installed.
But help is on the way:

You can see available generators via npm search yeoman-generator or via http://yeoman.io/generators/. 
Install them with npm install generator-@travi/git.

To see all your installed generators run yo without any arguments. Adding the --help option will also show subgenerators. 

If yo cannot find the generator, run yo doctor to troubleshoot your system.

Some debugging details:

$ npm -g root
/usr/local/lib/node_modules
ls /usr/local/lib/node_modules/@travi/
generator-git@
$ yo doctor

Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✖ No .bowerrc file in home directory

We found a undefined file in your home directory. This can cause
issues by overriding expected default config. Prefer setting up one `.bowerrc` per
project.

To delete the file, run: rm ~/.bowerrc

✔ No .yo-rc.json file in home directory
✔ npm version

This issue seems to suggest that this should work, but I don't find any details in the docs, so I'm hoping you can help me understand what I might be missing.

@mocheng
Copy link

mocheng commented Oct 25, 2016

I have same issue.

@molant and @SBoudrias , it looks you have make it work. Would you like to shed some light on this?

@SBoudrias
Copy link
Member

Run it with DEBUG=yeoman:* yo and see if you can get any useful information on where Yeoman is resolving the packages.

@travi
Copy link
Author

travi commented Oct 26, 2016

  yeoman:environment found /usr/local/lib/node_modules/@travi/generator-git/generators/git/index.js, trying to register +1ms
  yeoman:environment Resolve namespaces for /usr/local/lib/node_modules/@travi/generator-git/generators/git/index.js: @travi/git:git +0ms
  yeoman:environment Registered @travi/git:git (/Users/admin/development/yo/generator-git/generators/git/index.js) +0ms
? 'Allo Matt! What would you like to do? (Use arrow keys)
  Run a generator
❯ Generator 
  ──────────────
  Update your generators 
  Install a generator 
(Move up and down to reveal more choices)

seeing this, I tried running

$ yo @travi/git:git

which worked, so the generator itself seems to be functional.

Admittedly, I haven't built a generator for a while, so I may be forgetting some important details. If so, hopefully you can shed some light on what I missed, but I don't understand why this generator would be getting registered, but wouldn't show up in the list.

@SBoudrias
Copy link
Member

I think the list only show top level generators, and not the sub-generators they themselves contains no?

@travi
Copy link
Author

travi commented Oct 26, 2016

that appears to be the problem. i overlooked the fact that the default generator is app and that it must be contained in app/. now that you pointed me in the direction of updating that, i seem to have things working the way that i expected.

it's too bad that yo doctor doesn't warn about generators that it successfully finds that don't define a default. would it be worth me opening a separate issue to suggest that as an improvement to doctor?

@travi travi closed this as completed Oct 26, 2016
@SBoudrias
Copy link
Member

it's too bad that yo doctor doesn't warn about generators that it successfully finds that don't define a default. would it be worth me opening a separate issue to suggest that as an improvement to doctor?

I think that's a very good point! Mind opening a ticket here https://github.com/yeoman/doctor ?

@travi
Copy link
Author

travi commented Oct 26, 2016

sure thing: yeoman/doctor#32

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