Skip to content

Commit c940037

Browse files
committed
refactor(hooks): replace hooks to ng-cli fileReplacements logic
1 parent 7fbc68c commit c940037

14 files changed

+36
-318
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# Introduction
1313

14-
Bootstrap and package your project with Angular 5(+) and Electron (Typescript + SASS + Hot Reload) for creating Desktop applications.
14+
Bootstrap and package your project with Angular 6(+) and Electron (Typescript + SASS + Hot Reload) for creating Desktop applications.
1515

1616
Currently runs with:
1717

angular.json

+26-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@
3030
"scripts": []
3131
},
3232
"configurations": {
33+
"dev": {
34+
"optimization": false,
35+
"outputHashing": "all",
36+
"sourceMap": true,
37+
"extractCss": true,
38+
"namedChunks": false,
39+
"aot": false,
40+
"extractLicenses": true,
41+
"vendorChunk": false,
42+
"buildOptimizer": false,
43+
"fileReplacements": [
44+
{
45+
"replace": "src/environments/environment.ts",
46+
"with": "src/environments/environment.dev.ts"
47+
}
48+
]
49+
},
3350
"production": {
3451
"optimization": true,
3552
"outputHashing": "all",
@@ -40,7 +57,12 @@
4057
"extractLicenses": true,
4158
"vendorChunk": false,
4259
"buildOptimizer": true,
43-
"fileReplacements": []
60+
"fileReplacements": [
61+
{
62+
"replace": "src/environments/environment.ts",
63+
"with": "src/environments/environment.prod.ts"
64+
}
65+
]
4466
}
4567
}
4668
},
@@ -50,6 +72,9 @@
5072
"browserTarget": "angular-electron:build"
5173
},
5274
"configurations": {
75+
"dev": {
76+
"browserTarget": "angular-electron:build:dev"
77+
},
5378
"production": {
5479
"browserTarget": "angular-electron:build:production"
5580
}

hooks/environments/README.md

-196
This file was deleted.

hooks/environments/app.config.ts.tpl

-23
This file was deleted.

hooks/environments/set_profile.js

-20
This file was deleted.

hooks/src/app/app.config.ts

-23
This file was deleted.

hooks/src/app/appconfig.ts

-23
This file was deleted.

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
"scripts": {
2020
"postinstall": "npx electron-builder install-app-deps",
2121
"ng": "ng",
22-
"start": "node hooks/environments/set_profile.js && npm-run-all -p ng:serve electron:serve",
23-
"build": "node hooks/environments/set_profile.js && ng build && npm run electron:tsc",
24-
"build:prod": "node hooks/environments/set_profile.js && ng build -c production && npm run electron:tsc",
22+
"start": "npm-run-all -p ng:serve electron:serve",
23+
"build": "npm run electron:tsc && ng build",
24+
"build:dev": "npm run build -- -c dev",
25+
"build:prod": "npm run build -- -c production",
2526
"ng:serve": "ng serve -o",
2627
"electron:tsc": "tsc main.ts",
2728
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:tsc && electron . --serve",

src/app/app.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component } from '@angular/core';
22
import { ElectronService } from './providers/electron.service';
33
import { TranslateService } from '@ngx-translate/core';
4-
import { AppConfig } from './app.config';
4+
import { AppConfig } from '../environments/environment';
55

66
@Component({
77
selector: 'app-root',

src/app/app.config.ts

-23
This file was deleted.

0 commit comments

Comments
 (0)