From 13f9c21e8cd62387d18bd5fe1dc94ee525717fb5 Mon Sep 17 00:00:00 2001 From: Andrew Tung Date: Mon, 26 Aug 2019 17:45:57 -0700 Subject: [PATCH] Fix boilerplate to respect .getconfig.sh --- .neutrinorc.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.neutrinorc.js b/.neutrinorc.js index 1f6296b..2aab595 100644 --- a/.neutrinorc.js +++ b/.neutrinorc.js @@ -1,8 +1,15 @@ +const merge = require('babel-merge'); const path = require('path'); +const fs = require('fs'); const { pick, without, find } = require('lodash'); const UglifyjsPlugin = require('uglifyjs-webpack-plugin'); -const appConfig = require('./config.json'); +const processEnv = process.env.environment; +const deployedConfigPath = `./config-${process.env.environment}.json`; +const localConfigPath = './config.json'; +const isDeployed = processEnv && fs.existsSync(deployedConfigPath); + +const appConfig = require(isDeployed ? deployedConfigPath : localConfigPath); const safeConfigKeys = require('./configWhitelist.json'); const extraBabelPlugins = [ @@ -21,12 +28,11 @@ module.exports = { [ '@neutrinojs/react', { + minify: { + babel: false + }, html: { title: 'Veritone App Boilerplate', - // config.json can be baked into the app for static deployments. - // Otherwise just add a stub at window.config where something else can - // inject config at runtime. - window: { config: appConfig.useHardcodedConfig ? safeConfig : {} }, links: [ { href: @@ -58,8 +64,13 @@ module.exports = { href: 'https://static.veritone.com/assets/favicon/favicon.ico', rel: 'shortcut icon', type: 'image/x-icon' + }, + { + href: 'https://fonts.googleapis.com/icon?family=Material+Icons', + rel: 'stylesheet' } - ] + ], + window: { config: safeConfig } }, devServer: { public: appConfig.useOAuthGrant ? 'localhost' : 'local.veritone.com', @@ -80,8 +91,8 @@ module.exports = { useId: 'sass', options: { includePaths: [ - path.resolve('./src'), - path.resolve('./resources') + path.resolve(__dirname, './src'), + path.resolve(__dirname, './resources') ] } }