Skip to content

Commit

Permalink
refactor(hooks): replace hooks to ng-cli fileReplacements logic
Browse files Browse the repository at this point in the history
  • Loading branch information
leo6104 committed May 19, 2018
1 parent 7fbc68c commit b7d3001
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 317 deletions.
27 changes: 26 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@
"scripts": []
},
"configurations": {
"dev": {
"optimization": false,
"outputHashing": "all",
"sourceMap": true,
"extractCss": true,
"namedChunks": false,
"aot": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.dev.ts"
}
]
},
"production": {
"optimization": true,
"outputHashing": "all",
Expand All @@ -40,7 +57,12 @@
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": []
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
Expand All @@ -50,6 +72,9 @@
"browserTarget": "angular-electron:build"
},
"configurations": {
"dev": {
"browserTarget": "angular-electron:build:dev"
},
"production": {
"browserTarget": "angular-electron:build:production"
}
Expand Down
196 changes: 0 additions & 196 deletions hooks/environments/README.md

This file was deleted.

23 changes: 0 additions & 23 deletions hooks/environments/app.config.ts.tpl

This file was deleted.

20 changes: 0 additions & 20 deletions hooks/environments/set_profile.js

This file was deleted.

23 changes: 0 additions & 23 deletions hooks/src/app/app.config.ts

This file was deleted.

23 changes: 0 additions & 23 deletions hooks/src/app/appconfig.ts

This file was deleted.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
"scripts": {
"postinstall": "npx electron-builder install-app-deps",
"ng": "ng",
"start": "node hooks/environments/set_profile.js && npm-run-all -p ng:serve electron:serve",
"build": "node hooks/environments/set_profile.js && ng build && npm run electron:tsc",
"build:prod": "node hooks/environments/set_profile.js && ng build -c production && npm run electron:tsc",
"start": "npm-run-all -p ng:serve electron:serve",
"build": "npm run electron:tsc && ng build",
"build:dev": "npm run build -- -c dev",
"build:prod": "npm run build -- -c production",
"ng:serve": "ng serve -o",
"electron:tsc": "tsc main.ts",
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:tsc && electron . --serve",
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { ElectronService } from './providers/electron.service';
import { TranslateService } from '@ngx-translate/core';
import { AppConfig } from './app.config';
import { AppConfig } from '../environments/environment';

@Component({
selector: 'app-root',
Expand Down
23 changes: 0 additions & 23 deletions src/app/app.config.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/environments/environment.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// `ng build --env=prod` then `index.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.

export const CONF_DEV = {
export const AppConfig = {
production: false,
environment: 'DEV'
};
2 changes: 1 addition & 1 deletion src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const CONF_PROD = {
export const AppConfig = {
production: true,
environment: 'PROD'
};
Loading

0 comments on commit b7d3001

Please sign in to comment.