Skip to content

Commit b9aa2bc

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

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;
@@ -493,8 +496,26 @@ public static void runFrontendBuild(PluginAdapterBase adapter)
493496
FrontendTools tools = new FrontendTools(settings);
494497
tools.validateNodeAndNpmVersion();
495498
BuildFrontendUtil.runVite(adapter, tools);
496-
ProdBundleUtils.compressBundle(adapter.projectBaseDirectory().toFile(),
497-
adapter.servletResourceOutputDirectory());
499+
String tokenContent = "";
500+
File tokenFile = getTokenFile(adapter);
501+
try {
502+
tokenContent = Files.readString(tokenFile.toPath());
503+
tokenFile.delete();
504+
} catch (IOException ex) {
505+
getLogger().error("Failed to read token file content.", ex);
506+
}
507+
508+
try {
509+
ProdBundleUtils.compressBundle(
510+
adapter.projectBaseDirectory().toFile(),
511+
adapter.servletResourceOutputDirectory());
512+
} finally {
513+
try {
514+
Files.writeString(tokenFile.toPath(), tokenContent);
515+
} catch (IOException ex) {
516+
getLogger().error("Failed to write token file content.", ex);
517+
}
518+
}
498519
}
499520

500521
/**

0 commit comments

Comments
 (0)