Skip to content

Commit e9d0a15

Browse files
committed
Remove support for chainning at composeWith.
1 parent c2245e1 commit e9d0a15

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

lib/index.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,7 @@ class Generator extends Base {
10511051
* Compose this generator with another one.
10521052
* @param {String|Object|Array} generator The path to the generator module or an object (see examples)
10531053
* @param {Object} [options] The options passed to the Generator
1054-
* @param {boolean} [returnNewGenerator] Returns the created generator instead of returning this.
1055-
* @return {this|Object} This generator or the composed generator when returnNewGenerator=true
1054+
* @return {Generator} The composed generator
10561055
*
10571056
* @example <caption>Using a peerDependency generator</caption>
10581057
* this.composeWith('bootstrap', { sass: true });
@@ -1063,22 +1062,15 @@ class Generator extends Base {
10631062
* @example <caption>Passing a Generator class</caption>
10641063
* this.composeWith({ Generator: MyGenerator, path: '../generator-bootstrap/app/main.js' }, { sass: true });
10651064
*/
1066-
composeWith(generator, options, returnNewGenerator = false) {
1065+
composeWith(generator, options) {
10671066
if (typeof options === 'boolean') {
1068-
returnNewGenerator = options;
10691067
options = {};
10701068
}
10711069

1072-
const returnCompose = (returnValue) =>
1073-
returnNewGenerator ? returnValue : this;
1074-
10751070
let instantiatedGenerator;
10761071

10771072
if (Array.isArray(generator)) {
1078-
const generators = generator.map((gen) =>
1079-
this.composeWith(gen, options, returnNewGenerator)
1080-
);
1081-
return returnCompose(generators);
1073+
return generator.map((gen) => this.composeWith(gen, options));
10821074
}
10831075

10841076
const instantiate = (Generator, path) => {
@@ -1166,7 +1158,7 @@ class Generator extends Base {
11661158
}
11671159

11681160
if (!instantiatedGenerator) {
1169-
return returnCompose(instantiatedGenerator);
1161+
return instantiatedGenerator;
11701162
}
11711163

11721164
if (this._running) {
@@ -1175,7 +1167,7 @@ class Generator extends Base {
11751167
this._composedWith.push(instantiatedGenerator);
11761168
}
11771169

1178-
return returnCompose(instantiatedGenerator);
1170+
return instantiatedGenerator;
11791171
}
11801172

11811173
/**

0 commit comments

Comments
 (0)