refactor(hooks): replace hooks to ng-cli fileReplacements logic

This commit is contained in:
Heo Sangmin
2018-05-19 18:55:27 +09:00
parent 7fbc68cd1f
commit c940037211
14 changed files with 36 additions and 318 deletions

View File

@@ -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',

View File

@@ -1,23 +0,0 @@
import { CONF_LOCAL } from '../environments/environment.local';
import { CONF_DEV } from '../environments/environment.dev';
import { CONF_PROD } from '../environments/environment.prod';
const ENV = 'prod';
const LOCAL: String = 'local';
const DEV: String = 'dev';
const PROD: String = 'prod';
let conf: any;
console.log('Env', ENV);
if (ENV === PROD) {
conf = CONF_PROD;
} else if (ENV === DEV) {
conf = CONF_DEV;
} else {
conf = CONF_LOCAL;
}
export const AppConfig = Object.assign({}, conf);

View File

@@ -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'
};

View File

@@ -1,4 +1,4 @@
export const CONF_PROD = {
export const AppConfig = {
production: true,
environment: 'PROD'
};

View File

@@ -1,4 +1,4 @@
export const CONF_LOCAL = {
export const AppConfig = {
production: false,
environment: 'LOCAL'
};

View File

@@ -2,7 +2,7 @@ import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { AppConfig } from './app/app.config';
import { AppConfig } from './environments/environment';
if (AppConfig.production) {
enableProdMode();