Skip to content

Commit 949ae90

Browse files
authored
Merge pull request #1121 from izaera/fix-start-port
feat(js-toolkit-core): use PORT env var for `npm run start` when present
2 parents a96d6c8 + 216ce02 commit 949ae90

File tree

1 file changed

+7
-1
lines changed
  • projects/js-toolkit/packages/js-toolkit-core/src/project/liferayCli

1 file changed

+7
-1
lines changed

projects/js-toolkit/packages/js-toolkit-core/src/project/liferayCli/Start.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ export default class Start {
1515
constructor(project: Project, liferayJson: LiferayJson) {
1616
this._project = project;
1717

18-
this.port = liferayJson.start?.port || 8081;
18+
let envPort = Number(process.env['PORT']);
19+
20+
if (Number.isNaN(envPort)) {
21+
envPort = undefined;
22+
}
23+
24+
this.port = envPort || liferayJson.start?.port || 8081;
1925
}
2026

2127
storePort(port: number): void {

0 commit comments

Comments
 (0)