Skip to content

Commit 47b7537

Browse files
authored
feat(build): update nestjs-universal config (#5156)
1 parent 4ebf2ad commit 47b7537

File tree

6 files changed

+17
-13
lines changed

6 files changed

+17
-13
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"3.0.1"}
1+
{"version":"4.0.1"}

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"@applitools/eyes.cypress": "3.4.2",
104104
"@cypress/webpack-preprocessor": "3.0.1",
105105
"@nestjs/common": "6.0.1",
106-
"@nestjs/core": "6.0.1",
106+
"@nestjs/core": "6.0.5",
107107
"@nestjs/microservices": "6.0.5",
108108
"@nestjs/ng-universal": "0.5.1",
109109
"@nestjs/platform-express": "^6.0.1",
@@ -132,6 +132,7 @@
132132
"cpy": "7.0.0",
133133
"cpy-cli": "2.0.0",
134134
"cypress": "3.2.0",
135+
"express": "4.16.4",
135136
"gh-pages": "1.1.0",
136137
"gitignore-to-glob": "0.3.0",
137138
"google-code-prettify": "1.0.5",

scripts/universal/app.module.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import { Module } from '@nestjs/common';
22
import { join } from 'path';
33
import { AngularUniversalModule, applyDomino } from '@nestjs/ng-universal';
44

5-
const BROWSER_DIR = join(process.cwd(), 'demo/dist/browser');
5+
const BROWSER_DIR = join(process.cwd(), process.env.DYNO ? 'browser' : 'demo/dist/browser');
6+
67
applyDomino(global, join(BROWSER_DIR, 'index.html'));
78

89
@Module({
910
imports: [
1011
AngularUniversalModule.forRoot({
1112
viewsPath: BROWSER_DIR,
12-
bundle: require('./../../demo/dist/server/main.js'),
13-
}),
13+
bundle: require('./../../demo/dist/server/main.js')
14+
})
1415
]
1516
})
1617
export class ApplicationModule {}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
const fs = require('fs-extra');
22
const path = require('path');
3+
const devDependencies = JSON.stringify(require('../../package').devDependencies, null, 2);
34

45
fs.writeFileSync(path.join(process.cwd(), 'demo/dist/Procfile'), 'web: node server.js', 'utf8');
5-
fs.writeFileSync(path.join(process.cwd(), 'demo/dist/package.json'), '{"name": "ngx-universal", "version": "1.0.0" }', 'utf8');
6+
fs.writeFileSync(path.join(process.cwd(), 'demo/dist/package.json'),
7+
`{
8+
"name": "ngx-universal",
9+
"version": "2.0.0",
10+
"devDependencies": ${devDependencies}
11+
}`, 'utf8');

scripts/universal/server.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ enableProdMode();
88

99
async function bootstrap() {
1010
const app = await NestFactory.create(ApplicationModule);
11-
app.enableCors({
12-
methods: 'GET',
13-
maxAge: 3600,
14-
});
1511
await app.listen(PORT);
1612
}
1713
bootstrap().catch(err => console.error(err));

0 commit comments

Comments
 (0)