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

Angular: use single version in dependencies #3836

Closed
pascalgrimaud opened this issue Oct 6, 2022 · 9 comments · Fixed by #7397
Closed

Angular: use single version in dependencies #3836

pascalgrimaud opened this issue Oct 6, 2022 · 9 comments · Fixed by #7397
Assignees
Labels
area: dependencies area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ client: angular generator: internal $300 https://www.jhipster.tech/bug-bounties/

Comments

@pascalgrimaud
Copy link
Member

Following #3835 and several other PRs, it would be cool to:

  • add a single version of angular in dependency package.json
  • use this same version for all other libs

Pro:

  • less dependabot upgrade
  • no need to manually do a PR to upgrade Angular
@pascalgrimaud pascalgrimaud added area: dependencies client: angular $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $100 https://www.jhipster.tech/bug-bounties/ labels Oct 6, 2022
@A-5ingh
Copy link

A-5ingh commented Oct 10, 2022

@pascalgrimaud Can you please provide more insights on this change?

@pascalgrimaud
Copy link
Member Author

Just to warn you, it's not an easy ticket :)

As you can see in this code https://github.com/jhipster/jhipster-lite/blob/main/src/main/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactory.java#L19-L28

For each lib, it will go into this https://github.com/jhipster/jhipster-lite/blob/main/src/main/resources/generator/dependencies/angular/package.json and find the version associated to the lib

Because of that, dependabot will try to bump the dependencies separately so it won't work.

The goal here is to find a mechanism to use a single version, but for now, I don't know how.
Maybe something like :

  NpmPackageVersion angularVersion = retrieveVersion("@angular/core", ANGULAR);

  return ClientsModulesFactory.clientModuleBuilder(properties)
      .packageJson()
        .addDependency(packageName("@angular/animations"), angularVersion)
        .addDependency(packageName("@angular/cdk"), ANGULAR)
        .addDependency(packageName("@angular/common"), angularVersion)
        .addDependency(packageName("@angular/compiler"), angularVersion)
        .addDependency(packageName("@angular/core"), angularVersion)

I think @DamnClin can have some better ideas as it will impact the engine of JH Lite: maybe you can help here?

@A-5ingh
Copy link

A-5ingh commented Oct 10, 2022

Thanks, @pascalgrimaud. Yes, it's an interesting problem and I'm up for a challenge on weekends. :) I'll get familiar with jhipster-lite in the meantime we wait for response from @DamnClin.

@DamnClin
Copy link
Collaborator

I think adding a signature with source and package source may be more consistent with the java ones using version slug

@murdos murdos self-assigned this Sep 5, 2023
@murdos
Copy link
Contributor

murdos commented Sep 5, 2023

I'm picking this ticket, in order to reduce the burden of manual dependencies upgrade.

I'm inclined to the following API, with an additional optional PackageName corresponding to the source of the version:

  return ClientsModulesFactory.clientModuleBuilder(properties)
      .packageJson()
        .addDependency(packageName("@angular/animations"), ANGULAR, packageName("@angular/core"))
        .addDependency(packageName("@angular/cdk"), ANGULAR, packageName("@angular/core"))
        .addDependency(packageName("@angular/common"), ANGULAR, packageName("@angular/core"))
        .addDependency(packageName("@angular/compiler"), ANGULAR, packageName("@angular/core"))
        .addDependency(packageName("@angular/core"), ANGULAR)

murdos added a commit to murdos/jhipster-lite that referenced this issue Sep 5, 2023
murdos added a commit to murdos/jhipster-lite that referenced this issue Sep 6, 2023
@pascalgrimaud pascalgrimaud added $200 https://www.jhipster.tech/bug-bounties/ and removed $100 https://www.jhipster.tech/bug-bounties/ labels Sep 7, 2023
@murdos
Copy link
Contributor

murdos commented Sep 7, 2023

I just noticed that dependabot is now supporting grouping dependencies updates: dependabot/dependabot-core#1296
I think #7397 is anyway a nice feature to have for module, but I'll give a try for grouping furthermore dependencies updates since it could also help to group dependencies together that don't share the same version number.

@pascalgrimaud pascalgrimaud added $300 https://www.jhipster.tech/bug-bounties/ and removed $200 https://www.jhipster.tech/bug-bounties/ labels Sep 7, 2023
@pascalgrimaud
Copy link
Member Author

Increasing the bounty as it was more work than expected
thanks a lot @murdos, it will help a lot

@murdos
Copy link
Contributor

murdos commented Sep 7, 2023

@pascalgrimaud
Copy link
Member Author

@murdos : approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dependencies area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ client: angular generator: internal $300 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@murdos @pascalgrimaud @A-5ingh @DamnClin and others