-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Adapt changes of yeoman generator 1.0.0 #170
Conversation
Needed to bump to prevent side effects with generator-node
484b4c6
to
6fdcf4e
Compare
}); | ||
|
||
this.composeWith('generator:subgenerator', { | ||
this.composeWith(require.resolve('../subgenerator'), { | ||
arguments: ['app'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be the name of the argument you want to pass in. It's treated the same as an option now.
{namespace: 'app'}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Tried that too. Doesn’t work as well :(
Pushed that for you one minute ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Missed one line. It does work.
generators.Base.apply(this, arguments); | ||
module.exports = class extends Generator { | ||
constructor(args, opts) { | ||
super(args, opts); | ||
|
||
this.argument('namespace', { | ||
type: String, | ||
required: true, | ||
description: 'Generator namespace' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old error, but that key as always been desc
instead of the full description.
965bd76
to
f66b24b
Compare
Using `namespace` leads to `this.options.namespace === 'generator:subgenerator'` instead of `this.options.namespace === 'app'`
Passing the arguments works now. Thanks @SBoudrias But I had to rename the argument. I guess because of the parameter of |
… to work with yeoman-generator v1.0.0
@@ -1,6 +1,7 @@ | |||
sudo: false | |||
language: node_js | |||
node_js: | |||
- stable | |||
- 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node
is the name for the latest stable version. I think I prefer this to 7 given it won't go into LTS.
|
||
this.argument('namespace', { | ||
this.option('name', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can stay an argument. The issue is that namespace was a "reserved" name for yeoman-environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhm. Using this.argument('name', {
leads to failing test.
Tests are failing with:
1) generator:app defaults "before all" hook:
Error: Did not provide required argument name!
at .<anonymous> (node_modules/yeoman-generator/lib/index.js:335:33)
at Array.forEach (native)
at Base.checkRequiredArgs (node_modules/yeoman-generator/lib/index.js:331:19)
at Base.parseOptions (node_modules/yeoman-generator/lib/index.js:316:8)
at argument (node_modules/yeoman-generator/lib/index.js:246:8)
at new <anonymous> (subgenerator/index.js:9:447)
at Environment.instantiate (node_modules/yeoman-environment/lib/environment.js:336:10)
at composeWith (node_modules/yeoman-generator/lib/index.js:485:26)
at default (app/index.js:9:2522)
at Object.<anonymous> (node_modules/yeoman-generator/lib/index.js:387:23)
2) generator:subgenerator "before all" hook:
Uncaught Error: Did not provide required argument name!
at .<anonymous> (node_modules/yeoman-generator/lib/index.js:335:33)
at Array.forEach (native)
at Base.checkRequiredArgs (node_modules/yeoman-generator/lib/index.js:331:19)
at Base.parseOptions (node_modules/yeoman-generator/lib/index.js:316:8)
at argument (node_modules/yeoman-generator/lib/index.js:246:8)
at new <anonymous> (subgenerator/index.js:9:447)
at Environment.instantiate (node_modules/yeoman-environment/lib/environment.js:336:10)
at Environment.create (node_modules/yeoman-environment/lib/environment.js:313:15)
at RunContext._run (node_modules/yeoman-test/lib/run-context.js:90:29)
at RunContext.<anonymous> (node_modules/yeoman-test/lib/run-context.js:58:10)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could be a bug. I'll investigate!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually that's pretty simple. It's breaking because generator-node is pre 1.0, so it doesn't recognize the arguments being passed as part of the options.
We should fix that in yeoman-generator
so we keep compatibility with older generators too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to change something over here?
Guess I’m ready to review now. About failing tests: On travis it says:
I guess that is because the latest version of |
Also, could we copy the packages version from our own |
How can we get the content of the package.json of generator-generator? I only have nasty ideas like regexing
|
from the package.json of generator-generator
'yeoman-generator': '^0.23.0', | ||
chalk: '^1.0.0', | ||
yosay: '^1.0.0' | ||
'yeoman-generator': 'yeoman/generator#bump-version-for-updating-generator-generator', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to change this when v1.0.0 is released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update the tests to also read from package.json
like the generator
"yeoman-generator": "^0.23.3", | ||
"yosay": "^1.0.2" | ||
"superb": "^1.3.0", | ||
"yeoman-generator": "yeoman/generator#bump-version-for-updating-generator-generator", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to change this when v1.0.0 is released.
4a76c5a
to
3071aa1
Compare
The failing tests are caused by a bug of gulp-eslint adametry/gulp-eslint#186 😖 |
Because of adametry/gulp-eslint#186
e47decc
to
249963f
Compare
|
@@ -62,15 +62,17 @@ module.exports = class extends Generator { | |||
|
|||
writing() { | |||
var pkg = this.fs.readJSON(this.destinationPath('package.json'), {}); | |||
var generatorGeneratorPkg = this.fs.readJSON(path.normalize(this.resolved.replace(/app\/index.js/, 'package.json'))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just use require('../package.json')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈 Thanks and done.
@@ -2,5 +2,6 @@ sudo: false | |||
language: node_js | |||
node_js: | |||
- stable | |||
- 6 | |||
- 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's drop 5 and replace stable
by node
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
One last to do on my site: |
Question:
It’s dead code because of:
|
The generated generator isn’t ES6ified for now.
6a8469e
to
e7abcd8
Compare
generator-generator is successfully ES6ified 🎉 The generated generator is still using ES5 syntax. |
Please remember to squash that mess when merging 🙈 |
Hey, you can use Until generator-node goes to 1.0, you'll need pass the arguments as before with |
Done
Done. That’s slightly confusing 😆 |
ab06347
to
2ff0754
Compare
@mischah code looks good! How do you feel about the API changes overall? |
@SBoudrias I like them a lot. Especially the new |
Hej, I need help 😖I’m stucked with passing thenamespace
argument when composing withgenerator:subgenerator
.See: https://github.com/yeoman/generator-generator/compare/yeoman-generator/1.0.0?expand=1#diff-2018087f584c4398b5c3a23fc0e5f9dbL63I’m confused.All set and done
🎉