diff --git a/angular.json b/angular.json index af54062..6132feb 100644 --- a/angular.json +++ b/angular.json @@ -40,7 +40,7 @@ { "type": "initial", "maximumWarning": "500kb", - "maximumError": "1mb" + "maximumError": "2mb" }, { "type": "anyComponentStyle", @@ -52,12 +52,12 @@ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" - }, - { - "replace": "src/index.html", - "with": "src/index.prod.html" } ], + "index": { + "input": "src/index.prod.html", + "output": "index.html" + }, "outputHashing": "all" }, "development": { diff --git a/scripts/process-environment.js b/scripts/process-environment.js index 7bd12c1..b966df3 100644 --- a/scripts/process-environment.js +++ b/scripts/process-environment.js @@ -4,7 +4,18 @@ const fs = require('fs'); const path = require('path'); const _ = require('lodash'); -const envDict = process.env; +const DefaultEnv = { + SITE_TITLE: 'mira', + BASE_URL: '/', + CHROME_EXTENSION_ID: '', + FIREFOX_EXTENSION_ID: '', + FIREFOX_EXTENSION_URL: '', + EDGE_EXTENSION_ID: '' +}; + +const envDict = Object.assign({}, DefaultEnv, process.env); +console.log('enviroment variables:'); +console.log(JSON.stringify(envDict, null, 2)); const envFileTemplatePath = path.join(__dirname, '../src/environments/_environment.prod.ts'); const envFilePath = path.join(__dirname, '../src/environments/environment.prod.ts'); const envFileTemplate = fs.readFileSync(envFileTemplatePath, {encoding: 'utf-8'}); @@ -12,7 +23,7 @@ console.log('Updating environment.prod.ts'); const compiledEnvFileTemplate = _.template(envFileTemplate); fs.writeFileSync(envFilePath, compiledEnvFileTemplate(envDict), {encoding: 'utf-8'}); -const indexTemplatePath = path.join(__dirname, 'src/_index.html'); +const indexTemplatePath = path.join(__dirname, '../src/_index.html'); const indexTemplate = fs.readFileSync(indexTemplatePath, {encoding: 'utf-8'}); console.log('Updating index.html'); const compiledIndexTemplate = _.template(indexTemplate); diff --git a/src/environments/_environment.prod.ts b/src/environments/_environment.prod.ts index 3f91f0c..86a98c3 100644 --- a/src/environments/_environment.prod.ts +++ b/src/environments/_environment.prod.ts @@ -1,6 +1,6 @@ export const environment = { - production: false, - siteTitle: '<%= SITE_TILE =>', + production: true, + siteTitle: '<%= SITE_TITLE %>', chromeExtensionId: '<%= CHROME_EXTENSION_ID %>', firefoxExtensionId: '<%= FIREFOX_EXTENSION_ID %>', firefoxExtensionUrl: '<%= FIREFOX_EXTENSION_URL %>',