From 6061a0bd470adf5777e9997dd01fda84062edf83 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 2 Apr 2024 10:10:33 -0700 Subject: [PATCH] Revert "fix(@schematics/angular): rename SSR port env variable" This reverts commit 950a44521fdfb82000f6564ccc4c87d4a2b94680. (cherry picked from commit a673baf5ce385415ded23641a2dc5cdcae8f3f5c) --- .../build_angular/src/builders/ssr-dev-server/index.ts | 2 +- .../src/builders/ssr-dev-server/specs/proxy_spec.ts | 2 +- .../build_angular/src/builders/ssr-dev-server/specs/ssl_spec.ts | 2 +- .../src/builders/ssr-dev-server/specs/works_spec.ts | 2 +- .../angular/migrations/update-17/replace-nguniversal-engines.ts | 2 +- .../migrations/update-17/replace-nguniversal-engines_spec.ts | 2 +- .../angular/ssr/files/application-builder/server.ts.template | 2 +- .../angular/ssr/files/server-builder/server.ts.template | 2 +- tests/legacy-cli/e2e/assets/17-ssr-project-webpack/server.ts | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/index.ts b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/index.ts index e5b43cf0836d..847d4348bb5c 100644 --- a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/index.ts +++ b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/index.ts @@ -220,7 +220,7 @@ function startNodeServer( ): Observable { const outputPath = serverOutput.outputPath as string; const path = join(outputPath, 'main.js'); - const env = { ...process.env, SSR_PORT: '' + port, PORT: '' + port }; + const env = { ...process.env, PORT: '' + port }; const args = ['--enable-source-maps', `"${path}"`]; if (inspectMode) { diff --git a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/proxy_spec.ts b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/proxy_spec.ts index e88c4af077c4..61db7fa33509 100644 --- a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/proxy_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/proxy_spec.ts @@ -58,7 +58,7 @@ describe('Serve SSR Builder', () => { return server; } - app().listen(process.env['SSR_PORT']); + app().listen(process.env['PORT']); export * from './app/app.module.server'; `, diff --git a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/ssl_spec.ts b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/ssl_spec.ts index 6a831f7669f2..60130092946f 100644 --- a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/ssl_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/ssl_spec.ts @@ -58,7 +58,7 @@ describe('Serve SSR Builder', () => { return server; } - app().listen(process.env['SSR_PORT']); + app().listen(process.env['PORT']); export * from './app/app.module.server'; `, diff --git a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/works_spec.ts b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/works_spec.ts index 359ba271ee55..ab08119dd7b7 100644 --- a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/works_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/works_spec.ts @@ -57,7 +57,7 @@ describe('Serve SSR Builder', () => { return server; } - app().listen(process.env['SSR_PORT']); + app().listen(process.env['PORT']); export * from './app/app.module.server'; `, diff --git a/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines.ts b/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines.ts index 508fe952b87e..99aaf6592201 100644 --- a/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines.ts +++ b/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines.ts @@ -202,7 +202,7 @@ export function app(): express.Express { } function run(): void { - const port = process.env['SSR_PORT'] || 4000; + const port = process.env['PORT'] || 4000; // Start up the Node server const server = app(); diff --git a/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines_spec.ts b/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines_spec.ts index eb0dada1183a..4a07f6fe5426 100644 --- a/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines_spec.ts +++ b/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines_spec.ts @@ -128,7 +128,7 @@ export function app(): express.Express { } function run() { - const port = process.env.SSR_PORT || 4000; + const port = process.env.PORT || 4000; // Start up the Node server const server = app(); diff --git a/packages/schematics/angular/ssr/files/application-builder/server.ts.template b/packages/schematics/angular/ssr/files/application-builder/server.ts.template index becf161c4915..7bf10181c7d1 100644 --- a/packages/schematics/angular/ssr/files/application-builder/server.ts.template +++ b/packages/schematics/angular/ssr/files/application-builder/server.ts.template @@ -44,7 +44,7 @@ export function app(): express.Express { } function run(): void { - const port = process.env['SSR_PORT'] || 4000; + const port = process.env['PORT'] || 4000; // Start up the Node server const server = app(); diff --git a/packages/schematics/angular/ssr/files/server-builder/server.ts.template b/packages/schematics/angular/ssr/files/server-builder/server.ts.template index 5660620c6b6b..de1bf66f9726 100644 --- a/packages/schematics/angular/ssr/files/server-builder/server.ts.template +++ b/packages/schematics/angular/ssr/files/server-builder/server.ts.template @@ -47,7 +47,7 @@ export function app(): express.Express { } function run(): void { - const port = process.env['SSR_PORT'] || 4000; + const port = process.env['PORT'] || 4000; // Start up the Node server const server = app(); diff --git a/tests/legacy-cli/e2e/assets/17-ssr-project-webpack/server.ts b/tests/legacy-cli/e2e/assets/17-ssr-project-webpack/server.ts index aecd41516f45..c7f4927deffd 100644 --- a/tests/legacy-cli/e2e/assets/17-ssr-project-webpack/server.ts +++ b/tests/legacy-cli/e2e/assets/17-ssr-project-webpack/server.ts @@ -47,7 +47,7 @@ export function app(): express.Express { } function run(): void { - const port = process.env['SSR_PORT'] || 4000; + const port = process.env['PORT'] || 4000; // Start up the Node server const server = app();