You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue:
When a parent generator passes a boolean option with a value of undefined to the composeWith function the sub-generators this.option method (in the sub-generator's constructor) converts the boolean option to false.
Versions:
"yeoman-generator": "1.1.0" and "1.1.1"
Simple example:
// In my-generator/generators/app/index.js
module.exports = class extends Generator {
constructor(args, opts) {
super(args, opts);
this.option('opt1', {
type: Boolean,
description: 'opt1 :',
});
}
initializing() {
console.log('app opt1: ' + this.options['opt1']);
this.composeWith(require.resolve('../gen1'), this.options);
}
};
//sub-generator
module.exports = class extends Generator {
constructor(args, opts) {
super(args, opts);
console.log('gen1 opt1: ' + this.options['opt1']);
//A side affect of this function reassigns the value of op1 from undefined to false.
this.option('opt1', {
type: Boolean,
description: 'opt1 :',
});
console.log('gen1 opt1: ' + this.options['opt1']);
}
prompting() {
console.log('prompting - gen1');
}
writing() {
console.log('writing - gen1');
}
};
I traced the to problem back to the parseOptions function in yeoman-generator/lib/index.js. It looks like after the call to minimist the boolean options with value EMPTY are not converted to undefined.
Thanks,
Adrain
The text was updated successfully, but these errors were encountered:
Issue:
When a parent generator passes a boolean option with a value of undefined to the composeWith function the sub-generators this.option method (in the sub-generator's constructor) converts the boolean option to false.
Versions:
"yeoman-generator": "1.1.0" and "1.1.1"
Simple example:
Output:
I traced the to problem back to the parseOptions function in yeoman-generator/lib/index.js. It looks like after the call to minimist the boolean options with value EMPTY are not converted to undefined.
Thanks,
Adrain
The text was updated successfully, but these errors were encountered: