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
Sub generators can include nested generators as a static property
which are resolved and installed automatically by Easy UI5 and
finally executed in a chain after the root generator and the sub
generator.
```js
export default class extends Generator {
static displayName = "Create a new UI5 application";
static nestedGenerators = [ "wdi5", "library:app" ];
```
Just describe the subgenerator name as you would specify it when
using Easy UI5 and if you want to address a dedicated generator
in the subgenerator, just use the namespace syntax defining the
dedicated generator with the `:`.
// lookup the default path of the generator if not set
260
+
if(!generator.branch){
261
+
try{
262
+
constrepoInfo=awaitoctokit.repos.get({
263
+
owner: generator.org,
264
+
repo: generator.name,
265
+
});
266
+
generator.branch=repoInfo.data.default_branch;
267
+
}catch(e){
268
+
console.error(`Generator "${owner}/${repo}!${dir}${branch ? "#"+branch : ""}" not found! Run with --verbose for details!`);
269
+
if(this.options.verbose){
270
+
console.error(e);
271
+
}
272
+
return;
273
+
}
274
+
}
275
+
// fetch the branch to retrieve the latest commit SHA
276
+
letcommitSHA;
277
+
try{
278
+
// determine the commitSHA
279
+
constreqBranch=awaitoctokit.repos.getBranch({
280
+
owner: generator.org,
281
+
repo: generator.name,
282
+
branch: generator.branch,
283
+
});
284
+
commitSHA=reqBranch.data.commit.sha;
285
+
}catch(ex){
286
+
console.error(chalk.red(`Failed to retrieve the branch "${generator.branch}" for repository "${generator.name}" for "${generator.org}" organization! Run with --verbose for details!`));
287
+
if(this.options.verbose){
288
+
console.error(chalk.red(ex.message));
289
+
}
290
+
return;
291
+
}
292
+
293
+
if(this.options.verbose){
294
+
this.log(`Using commit ${commitSHA} from @${generator.org}/${generator.name}#${generator.branch}!`);
// lookup the default path of the generator if not set
533
-
if(!generator.branch){
534
-
try{
535
-
constrepoInfo=awaitoctokit.repos.get({
536
-
owner: generator.org,
537
-
repo: generator.name,
538
-
});
539
-
generator.branch=repoInfo.data.default_branch;
540
-
}catch(e){
541
-
console.error(`Generator "${owner}/${repo}!${dir}${branch ? "#"+branch : ""}" not found! Run with --verbose for details!`);
542
-
if(this.options.verbose){
543
-
console.error(e);
544
-
}
545
-
return;
546
-
}
547
-
}
548
-
// fetch the branch to retrieve the latest commit SHA
549
-
letcommitSHA;
550
-
try{
551
-
// determine the commitSHA
552
-
constreqBranch=awaitoctokit.repos.getBranch({
553
-
owner: generator.org,
554
-
repo: generator.name,
555
-
branch: generator.branch,
556
-
});
557
-
commitSHA=reqBranch.data.commit.sha;
558
-
}catch(ex){
559
-
console.error(chalk.red(`Failed to retrieve the branch "${generator.branch}" for repository "${generator.name}" for "${generator.org}" organization! Run with --verbose for details!`));
560
-
if(this.options.verbose){
561
-
console.error(chalk.red(ex.message));
562
-
}
563
-
return;
564
-
}
565
-
566
-
if(this.options.verbose){
567
-
this.log(`Using commit ${commitSHA} from @${generator.org}/${generator.name}#${generator.branch}!`);
this.log(`The nested generator "${nestedGeneratorInfo.org}/${nestedGeneratorInfo.name}" has no subgenerator "${subcommand||"default"}"! Ignoring execution...`);
771
+
}
772
+
}
773
+
})||[]
774
+
);
775
+
};
776
+
777
+
// only resolve nested generators when they should not be skipped
778
+
if(!this.options.skipNested){
779
+
awaitresolveNestedGenerator(subGenerator);
731
780
}
732
781
733
-
// finally, run the subgenerator
734
-
env.run(subGenerator,{
735
-
verbose: this.options.verbose,
736
-
embedded: true,
737
-
destinationRoot: this.destinationRoot(),
738
-
});
782
+
// intercept the environments runGenerator method to determine
783
+
// and forward the destinationRoot between the generator executions
0 commit comments