-
Notifications
You must be signed in to change notification settings - Fork 309
/
setup-production-env.js
42 lines (37 loc) · 1.09 KB
/
setup-production-env.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import fs from "fs";
const productionFilePath = './src/environments/environment.prod.ts';
const productionFileContent = `import { enableProdMode } from '@angular/core';
import { MockEnclosureScenario } from 'app/core/testing/mock-enclosure/enums/mock-enclosure.enum';
import { EnclosureModel } from 'app/enums/enclosure-model.enum';
import { WebUiEnvironment, environmentVersion, remote, sentryPublicDsn } from './environment.interface';
export const environment: WebUiEnvironment = {
environmentVersion,
remote,
buildYear: ${new Date().getFullYear()},
production: true,
sentryPublicDsn,
mockConfig: {
enabled: false,
controllerModel: EnclosureModel.M40,
expansionModels: [],
scenario: MockEnclosureScenario.FillSomeSlots,
},
};
// Production
enableProdMode();`;
function productionFileErrorHandler(err) {
if(!err) {
return;
}
console.error(
'Failed to update production file. WebUI might not work as expected. See following error details.\n',
err
);
exit();
}
fs.writeFile(
productionFilePath,
productionFileContent,
null,
productionFileErrorHandler
);