fix: Check for changes in project frontend files#15992
Conversation
… rebudle-upon-changes-in-ts
… rebudle-upon-changes-in-ts
| var filename; | ||
| if(line.includes('?')) { | ||
| filename = line.substring(line.indexOf("generated"), line.lastIndexOf('?')); | ||
| generatedImports.filter((line: string) => line.startsWith("Frontend/")).forEach((line: string) => { |
There was a problem hiding this comment.
IMO this should not at all look at the generated imports file. It should look at which files were used in the compilation. Now it can only react to the files you have imported from Java and not at all to the files those files in turn import. E.g. if you have
import './another.ts';
in your index.ts, then no changes to another.ts will ever cause a rebuild
There was a problem hiding this comment.
Yes, makes sense. I'm looking into it.
There was a problem hiding this comment.
So I did it in the following way:
- Frontend compiled TS/JS files are collected from
modulesin thestatsExtracterPlugin()and placed intostats.json:frontendHashesduring bundle build. - Flow takes files listed in
frontendHashesand checks the presence of the files in thefrontendfolder, during app start-up. - Then it checks the hash of the file if it exists, otherwise it considered as deleted.
…in-ts # Conflicts: # flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskRunDevBundleBuild.java # flow-server/src/main/resources/vite.generated.ts # flow-server/src/test/java/com/vaadin/flow/server/frontend/TaskRunDevBundleBuildTest.java
| for (Map.Entry<String, String> themeHash : packagedThemeHashes | ||
| .entrySet()) { | ||
| if (!hashesInStats.hasKey(themeHash.getKey())) { | ||
| getLogger().info( |
There was a problem hiding this comment.
PATH_TRAVERSAL_IN: This API (java/io/File.(Ljava/io/File;Ljava/lang/String;)V) reads a file whose location might be specified by user input
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
| Command | Usage |
|---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Help us improve LIFT! (Sonatype LiftBot external survey)
Was this a good recommendation for you? Answering this survey will not impact your Lift settings.
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
…in-ts # Conflicts: # flow-server/src/test/java/com/vaadin/flow/server/frontend/TaskRunDevBundleBuildTest.java
|
Kudos, SonarCloud Quality Gate passed!
|
🛠 Lift Auto-fixSome of the Lift findings in this PR can be automatically fixed. You can download and apply these changes in your local project directory of your branch to review the suggestions before committing.1 # Download the patch
curl https://lift.sonatype.com/api/patch/github.com/vaadin/flow/15992.diff -o lift-autofixes.diff
# Apply the patch with git
git apply lift-autofixes.diff
# Review the changes
git diffWant it all in a single command? Open a terminal in your project's directory and copy and paste the following command: curl https://lift.sonatype.com/api/patch/github.com/vaadin/flow/15992.diff | git applyOnce you're satisfied, commit and push your changes in your project. Footnotes |
Extends logic for dev-bundle re-build: it detects any project's frontend files modifications (create or delete) and re-builds bundle if such, for instance if Lit templates are modified. Imported files are also checked for modification. Fixes #15970
Extends logic for dev-bundle re-build: it detects any project's frontend files modifications (create or delete) and re-builds bundle if such, for instance if Lit templates are modified. Imported files are also checked for modification. Fixes #15970 Co-authored-by: Mikhail Shabarov <61410877+mshabarov@users.noreply.github.com>








Extends logic for dev-bundle re-build: it detects any project's frontend files modifications (create or delete) and re-builds bundle if such, for instance if Lit templates are modified. Imported files are also checked for modification.
Fixes #15970