Skip to content
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

feat: support nesting of generators #141

Merged
merged 1 commit into from
Jan 10, 2024
Merged

Conversation

petermuessig
Copy link
Contributor

@petermuessig petermuessig commented Jan 5, 2024

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.

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 :.

@petermuessig petermuessig force-pushed the feat/NestingOfGenerators branch 2 times, most recently from 58effea to 39cca9e Compare January 6, 2024 08:25
@petermuessig
Copy link
Contributor Author

@nicoschoenteich @vobu - this extension of the Easy UI5 generator allows to configure nested generators in generators to chain the execution. This feature also switches from env.run to composeWith to embed the nested generators into the run of the Easy UI5 generator. But I needed to add a delegator to forward destination root changes, e.g. the typical generators app, ts-app are changing the destination root and this must be delegated to any follow up execution... Therefore, I injected a hidden delegator generator...

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 `:`.
@petermuessig petermuessig force-pushed the feat/NestingOfGenerators branch from 39cca9e to eed882e Compare January 10, 2024 20:10
@petermuessig
Copy link
Contributor Author

@nicoschoenteich @vobu I needed to go back to env.run to ensure that the subgenerators make use of their dependencies rather than of the dependencies of the root generator. As I found a good way to intercept the generator executions and to determine the destinationRoot I can also ensure to pass it properly in between the generators.

@petermuessig petermuessig merged commit afd9173 into main Jan 10, 2024
6 checks passed
@petermuessig petermuessig deleted the feat/NestingOfGenerators branch January 10, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant