Skip to content

Conversation

Tcharl
Copy link
Contributor

@Tcharl Tcharl commented Jul 30, 2025

Contributes to #28235

No so sure about what I did: Options vs config is not so clear to me: from what I've seen, option looks to be a superset of config but I don't get the intrinstic difference: maybe we could get rid of options an treat everything as config anyway (context or storage) or get rid of context and keep a clear separation between option and config (persisting options in config when storage is set and all the rest being part of the option type).

Please be attentive during review, and give explained feedback. Thank you in advance, as you know I'm eager to simplify the codebase ^^


Please make sure the below checklist is followed for Pull Requests.

When you are still working on the PR, consider converting it to Draft (below reviewers) and adding skip-ci label, you can still see CI build result at your branch.

Copy link
Member

@mshima mshima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No so sure about what I did: Options vs config is not so clear to me: from what I've seen, option looks to be a superset of config but I don't get the intrinstic difference: maybe we could get rid of options an treat everything as config anyway (context or storage) or get rid of context and keep a clear separation between option and config (persisting options in config when storage is set and all the rest being part of the option type).

Options is every option relevant to generator it's more relevant to external generators when composing with the generator. It may be transient like skipChecks.

Config are stored inside json, it may be a state like last changelog date.

I will add some jsdoc

@@ -15,7 +15,6 @@ export type OptionsAll = Simplify<
ExportGeneratorOptionsFromCommand<typeof import('../../generators/base/command.ts').default> &
ExportGeneratorOptionsFromCommand<typeof import('../../generators/bootstrap-application-base/command.ts').default> &
ExportGeneratorOptionsFromCommand<typeof import('../../generators/client/command.ts').default> &
ExportGeneratorOptionsFromCommand<typeof import('../../generators/git/command.ts').default> &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason to remove git from optionsAll

Copy link
Contributor Author

@Tcharl Tcharl Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used anymore in other generators than git (has been move) (considered as resolved: better being part of workspaceoptions)

@@ -29,6 +29,5 @@ export type ApplicationAll<E extends EntityAll = EntityAll> = BaseApplication<E>
ClientApplication<E> &
DockerApplication &
LiqbuibaseApplication<E> &
ExportApplicationPropertiesFromCommand<typeof import('../../generators/git/command.ts').default> &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason to remove git from propertiesAll

Copy link
Contributor Author

@Tcharl Tcharl Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used anymore in other generators than git (has been move) (considered as resolved: better being part of workspaceoptions)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All config/properties/application is only used by BaseApplicationGeneratorAll and testing helpers.
helpers.run().withJHipsterConfig() should use ConfigAll.

@@ -22,7 +22,6 @@ export type ConfigAll = Simplify<
microfrontends?: { baseName: string }[];
} & ExportStoragePropertiesFromCommand<typeof import('../../generators/app/command.ts').default> &
ExportStoragePropertiesFromCommand<typeof import('../../generators/bootstrap-application-base/command.ts').default> &
ExportStoragePropertiesFromCommand<typeof import('../../generators/git/command.ts').default> &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason to remove git from configAll

Copy link
Contributor Author

@Tcharl Tcharl Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used anymore in other generators than git (has been move to git options) (considered as resolved: better being part of workspaceoptions) : played with inheritance to have workspaceoptions & config in the inheritance chain

Copy link
Member

@mshima mshima Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All config/properties/application is only used by BaseApplicationGeneratorAll and testing helpers.
helpers.run().withJHipsterConfig() should use ConfigAll.

Comment on lines -51 to -55
async initializeMonorepository() {
if (!this.skipGit && this.jhipsterConfig.monorepository) {
await this.initializeGitRepository();
}
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Monorepository is very hard to handle.
This looks to be wrong.

Monorepository is initialized before composing with applications generators, so generators will detect they are inside a monorepository.

Copy link
Contributor Author

@Tcharl Tcharl Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen that, but is there a need to have git repo initialized twice?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, initializeGitRepository will not be executed later in this case.

@@ -13,4 +14,4 @@ type JdlOptions = {

export type Config = BaseConfig & JdlOptions & Command['Config'];

export type Options = BaseOptions & JdlOptions & Command['Options'];
export type Options = BaseOptions & JdlOptions & Command['Options'] & GitOptions;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to expose every Options to JDL generator, then it should be ApplicationAll and DeploymentAll since it will compose with every generator.
JDL types have only types related to JDL generation.

Copy link
Contributor Author

@Tcharl Tcharl Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git is a bit specific as it is valid for app and deployment :-S, would prefer to keep it here, but the only one in this case (otherwise both workspace and application would be used until jdl merged into config)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 2 options:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did inheritance from workspaceoptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants