Skip to content

Commit 360d235

Browse files
vaadin-botcaalador
andauthored
fix: do not store build info in bundle (#21786) (#21795)
Do not store the flow-build-info inside the production bundle zip file. Co-authored-by: caalador <mikael.grankvist@vaadin.com>
1 parent 98fbcc3 commit 360d235

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

flow-plugins/flow-plugin-base/src/main/java/com/vaadin/flow/plugin/base/BuildFrontendUtil.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
import java.net.URISyntaxException;
2323
import java.net.URL;
2424
import java.nio.charset.StandardCharsets;
25+
import java.nio.file.Files;
26+
import java.nio.file.Path;
27+
import java.nio.file.Paths;
2528
import java.util.ArrayList;
2629
import java.util.Arrays;
2730
import java.util.Collections;
@@ -504,8 +507,26 @@ public static void runFrontendBuild(PluginAdapterBase adapter)
504507
FrontendTools tools = new FrontendTools(settings);
505508
tools.validateNodeAndNpmVersion();
506509
BuildFrontendUtil.runVite(adapter, tools);
507-
ProdBundleUtils.compressBundle(adapter.projectBaseDirectory().toFile(),
508-
adapter.servletResourceOutputDirectory());
510+
String tokenContent = "";
511+
File tokenFile = getTokenFile(adapter);
512+
try {
513+
tokenContent = Files.readString(tokenFile.toPath());
514+
tokenFile.delete();
515+
} catch (IOException ex) {
516+
getLogger().error("Failed to read token file content.", ex);
517+
}
518+
519+
try {
520+
ProdBundleUtils.compressBundle(
521+
adapter.projectBaseDirectory().toFile(),
522+
adapter.servletResourceOutputDirectory());
523+
} finally {
524+
try {
525+
Files.writeString(tokenFile.toPath(), tokenContent);
526+
} catch (IOException ex) {
527+
getLogger().error("Failed to write token file content.", ex);
528+
}
529+
}
509530
}
510531

511532
/**

0 commit comments

Comments
 (0)