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

Conditionally skip frontend build tasks #14799

Merged
merged 1 commit into from
May 7, 2021

Conversation

vishal423
Copy link
Contributor

Closes #13796

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

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

@atomfrede
Copy link
Member

Are you building the checksum across the input file? Asking because while evaluating our build scans the resulting index.html contains the buildtimestamp for cache busting of translations files. So maybe this might not be "correct", although I would say for development it is fine in case the build timestamp is "outdated".

@vishal423
Copy link
Contributor Author

Not sure I quite get your question. The checksums are calculated over a set of frontend input source files including i18 translations. As long as there is a change in one of the input files (including package.json), we shall execute the node build steps. Here, we are not concerned with generated output files that might contain a build timestamp for cache bursting.

I believe you are looking into the 2nd OR condition. That handles a special case when the user first does the frontend build and later tries to run a maven build (first time). In that scenario, to avoid another frontend build, we check if the build output contains the input.html.

@vishal423 vishal423 removed the request for review from pascalgrimaud May 3, 2021 06:38
@vishal423
Copy link
Contributor Author

It seems @pascalgrimaud is a little occupied. @jhipster/developers, anyone else wants to try out the change and review? I think it greatly simplifies the build time and improves the overall developer experience.

@atomfrede
Copy link
Member

Not sure I quite get your question. The checksums are calculated over a set of frontend input source files including i18 translations. As long as there is a change in one of the input files (including package.json), we shall execute the node build steps. Here, we are not concerned with generated output files that might contain a build timestamp for cache bursting.

I believe you are looking into the 2nd OR condition. That handles a special case when the user first does the frontend build and later tries to run a maven build (first time). In that scenario, to avoid another frontend build, we check if the build output contains the input.html.

A little had to describe, but I think your change mimics the gradle change detection which is great. The build timestamp is not relevant if the i18n files are also in the checksum, so it's fine. I will give it try today.

@pascalgrimaud
Copy link
Member

Yes sorry @vishal423 : I don't have enough time these last weeks.
If someone can help to review and test it, it would be really welcome.
Otherwise, I'll do my best when possible

@mraible
Copy link
Contributor

mraible commented May 3, 2021

I tried it today:

  • 1st build (after downloading everything): 53s
  • 2nd build: 15s

Looks good!

FWIW, I used my jhipster7-demo project to test.

Copy link
Member

@atomfrede atomfrede left a comment

Choose a reason for hiding this comment

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

Nice work! Works very well.

First build 58s
Second build 18s 🚀

@vishal423 Don't forget to claim the bounty, well deserved!

@atomfrede atomfrede merged commit 71c9594 into jhipster:main May 7, 2021
@mshima
Copy link
Member

mshima commented May 7, 2021

Sorry for the late review.
This will generate a development jar without frontend.

rm -rf target
./mvnw -P-webapp compile
./mvnw package

This will start a development backend with production frontend.

rm -rf target
./mvnw -Pprod compile
./mvnw

IMO we should rely on webpack 5 cache.

@vishal423 vishal423 deleted the skip-frontend-builds branch May 7, 2021 14:54
@vishal423
Copy link
Contributor Author

@mshima , Thanks for review. I had the first issue in mind and will create a PR for that.

@mshima
Copy link
Member

mshima commented May 7, 2021

Should include configurations that can change generated webapp:

  • webpack/*
  • (.)postcssrc.js ? too much?

When executing with production profile mvnw should delete checksums.

@vishal423
Copy link
Contributor Author

@jdubois
Copy link
Member

jdubois commented May 14, 2021

Awesome work @vishal423 !!

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.

npm install is slow and happens too often
7 participants