Update package.json main attribute
Knorcedger opened this issue · 10 comments
Hello,
i'm trying to create a composite generator that is using this one, but its not able to even find the 'generator-travis' module. After a couple hours banging my head, I found out that if I change the attribute main in your package.json to the correct path (generators/app/index.js) everything is fine.
Tnx!
@Knorcedger you want to use composeWith.
Then to get the path you want require.resolve('generator-travis/app')
.
No need for a main field as it currently doesn't mean anything in the Yeoman context.
@SBoudrias No, it says again Error: Cannot find module 'generator-travis/app'
That's the code I'm using. Not sure why changing main attribute fixes it, but it does :P
travis: function() {
this.composeWith('knr-generator:travis', {}, {
local: require.resolve('generator-travis/app')
});
}
Did you npm i --save generator-travis
?
Also, you actually want require.resolve('generator-travis/generators/app')
Of course. I deleted the node_modules and installed again and then did the change you told me.
My code is here -> https://github.com/Knorcedger/generator-knr-generator
EDIT: Yes, that works, but why does changing main also work?
@SBoudrias thank you for help.
@Knorcedger i have composability section in readme, where you find instructions how to use this package:
My bad, I didn't notice them, sorry :(
no worries, its fine. glad that you decided to use this project
i will add this stuff
fixed in v1.2.3