Closed alexgorbatchev closed 10 years ago
Pretty sure this bug have been resolved in next release. To test it though you'd need to use a build of yo
using yeoman-generator master branch.
Try to npm link
your generator locally.
Tested myself with lastest yeoman-generator and it works good for me. I added your case to the relevant method assertion list to make sure it is covered in the future too.
@SBoudrias could you tell me how you are testing? Also, what are node/npm versions you have? I really want to get this to work :)
I figured out what the problem is... The folder where your generator resides HAS to be named the same as your generator, eg generator-foo
.
Heum, can you represent your folder structure before and after? I really don't see what you mean from the log, ain't your generator named generator-express-app
as the folder?
I had the same issue and can see why it is a little confusing. One would assume the base-folder holding the app really wouldn't have to follow a naming convention, considering the contents of the folder holds the real configuration of the generator. It does enforce a very clean, but rigid design that ultimately limits misunderstandings. My example resulted from me skimming the tutorial and mistakingly named my folder xxxxx-generator instead of generator-xxxxx.
@brandonculver Yeoman needs to base itself on directory paths because we cannot require
all available generators to get meta data from them. This would be way too long. So instead, we walk the NPM directories and look for packages matching generator-*
pattern.
That's why the folder name matter; performance reason.
@SBoudrias Yeah it makes sense.
@alexgorbatchev I'm currently using the latest version v1.8.5 and i still happen to run into this problem. My generator is a called generator-ttestt
and it resides in a folder called generator-ttestt
. If it helps, my package.json
is also is consistent in naming
@joelbandi can you add more context. It fails during tests or when you type yo ttestt
?
@SBoudrias my Yeoman-cli doesn't even recognize the generator. I followed the tutorial given here http://yeoman.io/authoring/ Here's what I tried:
yo file/path/to/generator-testt/
and it worksnpm link
. Verified that the symlink is created and is in the same folder as that of the yo
binaries, but yo
still doesnt recognize my generatorgenerator-generator
to scaffold out a project and surprisingly yo
is able to recognize the generator-ttestt
after npm link
@joelbandi any chance the file structure was wrong? yo file/path/to/generator-testt/
should be yo file/path/to/generator-testt/app
(or yo file/path/to/generator-testt/sub-generator-name
) for it to match the behavior of yo namespacing.
@SBoudrias I think my file structure was wrong. I placed my index.js
which exports an instance of generator
subclass in the root of my project instead of placing it in file/path/to/generator-testt/generator/app
. When the guide used the name index.js
I inferred it's going to be placed in the project root. Here in the line "In the generator's index.js file, here's how you extend the base generator:" under the "Extending generator" section.
@joelbandi i am another victim of this same ambiguity in the guide
@dt-rush @joelbandi Could one of you send a PR to our documentation to disambiguate this line? I'll be happy to review and help merge quickly.
@SBoudrias Will be glad to send one out over this weekend!
I'm trying to create my first generator following tutorial, so I'm most likely doing something wrong... just can't tell what
it seems that npm linked generator ends up under wrong name... using full path, instead of actual generator name
I have also tried installing from master and it doesn't seem to work at all.
No visible generators...
posted originally in https://github.com/yeoman/yeoman/issues/1244