'Some questions about JHipster blueprint/module creation
I've been trying to create a custom blueprint at work lately, but I'd like some help, because I honestly can't get a high level picture of what I should be doing. I have some general questions, and some specific to what I'm trying to do.
What is the difference between a module and a blueprint? The website explanation isn't very clear. From my experimentation, I got the impression that modules have to do with overriding the 'app' subgenerator, but I don't really understand.
What is the recommended way to create a blueprint? I tried with generator-jhipster-blueprint, but it was old. Then I cloned its code, to use the latest directly, but it said it was only for jhipster 7.0.0beta, and aborted (I had jhipster 7.6.0 on my system at the time). Then I just took what I needed from generator-jhipster itself, while mimicking what other blueprints had done, and somehow managed to make it work, but I'm sure this isn't ideal. Seeing the recently released [email protected], there is a new tool: generate-blueprint. Is this the recommended way now?
How should I handle upgrading my blueprint together with generator-jhipster? My blueprint right now is based on 7.6.0. Is upgrading as simple as updating the dependency to generator-jhipster to 7.7.0?
From what I could gather, there is this hierarchy: JHipsterBasePrivateGenerator > JHipsterBaseGenerator > JHipsterBaseBlueprintGenerator. The last one defines some phases of generation. This is in turn extended by jhipster's subgenerators themselves (so they are in effect blueprints themselves?), which implement these phases. We are also expected to override these phases when creating a blueprint, but there is no documentation on what each phase is supposed to do. I see many blueprints just overriding the writing phase, but it would be great if you could shed some light there.
I cannot find which variables are usable in template files, are they different per generator? I would imagine so, since for example the entity generators get variables for each specific entity currently iterated on. Any info on that? Also where should I be creating my own variables for use inside my blueprint or template files?
Now for the work I'm trying to do:
a) I'm trying to modify the generation of a react frontend. Am I right in overriding only the following subgenerators' writing phase? : 'client', 'entity-client', and maybe 'entity-i18n' if needed?
b) I'd preferably like not to use prompts, and do everything via jdl + configuration files. Where should such configuration files (e.g. describing keycloak and proxy configuration) live?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
