Skip to content

Commit

Permalink
Add LAUNCH_MODE env
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed Jul 12, 2024
1 parent 1f3363c commit 376f475
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class PrepareForBundlingProcessor {
entry(EsBuildConfig.Loader.BINARY, LoadersConfig::binary));
public static final String TARGET_DIR_NAME = "web-bundler/";
public static final String DIST = "dist";
private static final String LAUNCH_MODE_ENV = "LAUNCH_MODE";

static {
for (EsBuildConfig.Loader loader : EsBuildConfig.Loader.values()) {
Expand Down Expand Up @@ -152,8 +153,8 @@ ReadyForBundlingBuildItem prepareForBundling(WebBundlerConfig config,
.outDir(PathUtils.join(DIST, config.bundlePath()))
.publicPath(config.publicBundlePath())
.splitting(config.bundling().splitting())
.sourceMap(config.bundling().sourceMapEnabled());

.sourceMap(config.bundling().sourceMapEnabled())
.define(LAUNCH_MODE_ENV, "'" + launchMode.getLaunchMode().name() + "'");
if (browserLiveReload) {
esBuildConfigBuilder
.preserveSymlinks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void test() throws InterruptedException {
.body(Matchers.containsString("console.log(\"Hello World! Modified!\");"));
test.modifyResourceFile("web/app/app.css", s -> s.replace("background-color: #6b6bf5;", "background-color: #123456;"));
test.modifyResourceFile("web/app/other.scss", s -> s.replace("color: #AAAAAA;", "color: #567890;"));
Thread.sleep(500);
Thread.sleep(1000);
RestAssured.given()
.get("/foo/bar/static/bundle/main.css")
.then()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public void test() {
.basePath("")
.get(bundle.script("main"))
.then()
.statusCode(200);
.statusCode(200)
.body(Matchers.containsString("hello world in test mode"));
RestAssured.given()
.get("/static/hello.txt")
.then()
Expand Down
2 changes: 1 addition & 1 deletion deployment/src/test/resources/web/app/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import $ from 'jquery';

$(document).ready(function() {
console.log("hello " + HELLO_ENV);
console.log("hello " + HELLO_ENV + " in " + LAUNCH_MODE + " mode");
});

0 comments on commit 376f475

Please sign in to comment.