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

Manage landscape preset configuration #10239

Closed
Tracked by #9491
renanfranca opened this issue Jul 9, 2024 · 4 comments · Fixed by #10297
Closed
Tracked by #9491

Manage landscape preset configuration #10239

renanfranca opened this issue Jul 9, 2024 · 4 comments · Fixed by #10297

Comments

@renanfranca
Copy link
Contributor

I propose saving/reading the preset configuration into a JSON file, similar to how history.json works. Here is what I think the .jhipster/modules/preset.json should look like:

[
  {
    "name": "angular + spring boot",
    "date": "2024-07-09T15:10:00.521252170Z",
    "modules": [
      "init",
      "application-service-hexagonal-architecture-documentation",
      "maven-java",
      "prettier",
      "angular-core",
      "java-base",
      "maven-wrapper",
      "spring-boot",
      "spring-boot-mvc-empty",
      "logs-spy",
      "spring-boot-tomcat"
    ]
  }
]

When applying the selected preset, the properties defined by the landscape interface or default will be used, which is why they won't be stored in the json.

    "properties": {
      "packageName": "com.mycompany.myapp",
      "projectName": "JHipster Sample Application",
      "baseName": "jhipsterSampleApplication",
      "serverPort": 8080,
      "endOfLine": "lf",
      "indentSize": 2,
      "springConfigurationFormat": "yaml"
    },
@renanfranca
Copy link
Contributor Author

@murdos and @pascalgrimaud: feel free to drop any suggestions or feedback. I am going to work on this issue 😀

I added a TO-DO/Roadmap to the following issue description:

@murdos
Copy link
Contributor

murdos commented Jul 9, 2024

I'm not sure to understand what problem we're trying to solve here.

IMO a preset is something that the landscape should be able to ingest, in order to:

  • either have a way to manually load a serialized, pre-configured list of modules that will be selected for generation. The intent here is to save time for users that frequently generated similar projects. The serialized preset could be a json file, but it will not belong to a generated project (so I don't understand the .jhipster/modules/preset.json file).
  • or be the final step once users have chosen main project characteristics from a simple page that will guide them (aka the alternative page to Landscape)

@pascalgrimaud
Copy link
Member

It's a good idea to use a json file to load a pre-selected modules.
But this json file should belong to JHLite project, and not in .jhipster/modules/preset.json

@renanfranca
Copy link
Contributor Author

Thank you for the feedback, @murdos and @pascalgrimaud! 😃✌

Short answer: I agree with both of you and will implement loading presets from a JSON file. Here is the JSON file I envision:

[
  {
    "name": "angular + spring boot",
    "modules": [
      "init",
      "application-service-hexagonal-architecture-documentation",
      "maven-java",
      "prettier",
      "angular-core",
      "java-base",
      "maven-wrapper",
      "spring-boot",
      "spring-boot-mvc-empty",
      "logs-spy",
      "spring-boot-tomcat"
    ]
  }
]

I removed the "date": "2024-07-09T15:10:00.521252170Z" attribute because the change commit will have this information.

Long answer:

either have a way to manually load a serialized, pre-configured list of modules that will be selected for generation. The intent here is to save time for users that frequently generated similar projects. The serialized preset could be a json file, but it will not belong to a generated project (so I don't understand the .jhipster/modules/preset.json file).

My intention was to implement something similar to the preset you defined. I had imagined using the alternative landscape interface to allow the creation of new presets via a web application. But how exactly could we add new presets to the generator using the running application? I think it's not possible.

I see another use for presets besides facilitating the generation of repeated projects. I think presets could also function as a tutorial to help users understand how the landscape screen works.

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

Successfully merging a pull request may close this issue.

3 participants