-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
replace default server port when property has custom value #8825
Changes from 4 commits
0b2dc16
85f61e6
afe2bba
219d87c
d389aad
526331d
f6d69a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -112,7 +112,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) { | |||||
.addScript(scriptKey("watch:css"), scriptCommand("onchange 'src/main/resources/static/css/**/*.css' -- npm run build:css")) | ||||||
.addScript(scriptKey("watch:js"), scriptCommand("onchange 'src/main/resources/static/js/**/*.js' -- npm run build:js")) | ||||||
.addScript(scriptKey("watch:svg"), scriptCommand("onchange 'src/main/resources/static/svg/**/*.svg' -- npm run build:svg")) | ||||||
.addScript(scriptKey("watch:serve"), scriptCommand("browser-sync start --proxy localhost:8080 --files 'target/classes/templates' 'target/classes/static'")) | ||||||
.addScript(scriptKey("watch:serve"), scriptCommand("browser-sync start --proxy localhost:%s --files 'target/classes/templates' 'target/classes/static'".formatted(getServerPort(properties)))) | ||||||
.and() | ||||||
.files() | ||||||
.add(RESOURCES_SOURCE.append(TEMPLATES).template("index.html"), toSrcMainResources().append(TEMPLATES).append("index.html")) | ||||||
|
@@ -132,7 +132,7 @@ public JHipsterModule buildTailwindcssModule(JHipsterModuleProperties properties | |||||
.packageJson() | ||||||
.addDevDependency(packageName("tailwindcss"), COMMON) | ||||||
.addScript(scriptKey("watch:html"), scriptCommand("onchange 'src/main/resources/templates/**/*.html' -- npm-run-all --serial build:css build:html")) | ||||||
.addScript(scriptKey("watch:serve"), scriptCommand("browser-sync start --no-inject-changes --proxy localhost:8080 --files 'target/classes/templates' 'target/classes/static'")) | ||||||
.addScript(scriptKey("watch:serve"), scriptCommand("browser-sync start --no-inject-changes --proxy localhost:%s --files 'target/classes/templates' 'target/classes/static'".formatted(getServerPort(properties)))) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no reason to redefine the default 8080 port in every module, it's already defined in JHipsterServerPort so you can just use:
Suggested change
and remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! I was not sure if the serverPort property is generated as well when no spring-boot-mvc-empty module is added. I have removed unnecessary method |
||||||
.and() | ||||||
.mandatoryReplacements() | ||||||
.in(path(POSTCSS_CONFIG_JS)) | ||||||
|
@@ -153,6 +153,12 @@ public JHipsterModule buildTailwindcssModule(JHipsterModuleProperties properties | |||||
//@formatter:on | ||||||
} | ||||||
|
||||||
private int getServerPort(JHipsterModuleProperties properties) { | ||||||
Assert.notNull(PROPERTIES, properties); | ||||||
|
||||||
return properties.getOrDefaultInteger("serverPort", 8080); | ||||||
} | ||||||
|
||||||
public JHipsterModule buildHtmxWebjarsModule(JHipsterModuleProperties properties) { | ||||||
Assert.notNull(PROPERTIES, properties); | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than doing a replacement, you should turn
proxy.conf.json
to a template that will use theserverPort
properties:proxy.conf.json
in src/main/resources/generator/client/angular/core/ toproxy.conf.json.mustache
and replace8080
by{{serverPort}}
.add(SOURCE.file("proxy.conf.json"), to("proxy.conf.json"))
to.addTemplate(SOURCE.file("proxy.conf.json"), to("proxy.conf.json"))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I have did the same to vte.config.ts in React Module. However, as I was not able to add the addTemple without the batch, I had to modify it to: