From 76679f03a694d27fea8ce897f23765fae5dfc12f Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Mon, 9 Dec 2019 09:47:24 +0200 Subject: [PATCH] Remove old unused env variables --- packages/app/services/logger/logger.ts | 8 ++++---- webpack.config.js | 24 ++---------------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/packages/app/services/logger/logger.ts b/packages/app/services/logger/logger.ts index e4a4301..d57f6ad 100644 --- a/packages/app/services/logger/logger.ts +++ b/packages/app/services/logger/logger.ts @@ -2,8 +2,8 @@ import Raven from 'raven-js'; import abbreviate from './abbreviate'; -const isTest = process.env.__TEST__; // eslint-disable-line -const isProduction = process.env.__PROD__; // eslint-disable-line +const isTest = process.env.NODE_ENV === 'test'; +const isProduction = process.env.NODE_ENV === 'production'; class Logger { init({ sentryCdn }: { sentryCdn: string }) { @@ -11,8 +11,8 @@ class Logger { Raven.config(sentryCdn, { logger: 'accounts-js-app', level: 'info', - environment: process.env.APP_ENV, // eslint-disable-line - release: process.env.__VERSION__, // eslint-disable-line + environment: process.env.APP_ENV, + release: process.env.__VERSION__, shouldSendCallback: () => !isTest, dataCallback: data => { if (!data.level) { diff --git a/webpack.config.js b/webpack.config.js index e054818..e573c16 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -21,11 +21,9 @@ const localeFlags = require('app/components/i18n/localeFlags').default; const rootPath = path.resolve('./packages'); const outputPath = path.join(__dirname, 'dist'); -const isProduction = process.argv.some(arg => arg === '-p'); +const isProduction = process.env.NODE_ENV === 'production'; const isAnalyze = process.argv.some(arg => arg === '--analyze'); -const isTest = process.argv.some(arg => arg.indexOf('karma') !== -1); - const isDockerized = !!process.env.DOCKERIZED; const isCI = !!process.env.CI; const isSilent = isCI || process.argv.some(arg => /quiet/.test(arg)); @@ -33,10 +31,6 @@ const isCspEnabled = false; process.env.NODE_ENV = isProduction ? 'production' : 'development'; -if (isTest) { - process.env.NODE_ENV = 'test'; -} - const smp = new SpeedMeasurePlugin(); const webpackConfig = { @@ -62,17 +56,6 @@ const webpackConfig = { }, }, - externals: isTest - ? { - sinon: 'sinon', - // http://airbnb.io/enzyme/docs/guides/webpack.html - cheerio: 'window', - 'react/lib/ExecutionEnvironment': true, - 'react/lib/ReactContext': true, - 'react/addons': true, - } - : {}, - devtool: 'cheap-module-source-map', stats: { @@ -104,9 +87,6 @@ const webpackConfig = { NODE_ENV: process.env.NODE_ENV, APP_ENV: config.environment || process.env.NODE_ENV, __VERSION__: config.version || '', - __DEV__: !isProduction, - __TEST__: isTest, - __PROD__: isProduction, }), new HtmlWebpackPlugin({ template: 'packages/app/index.ejs', @@ -288,7 +268,7 @@ if (isProduction) { ); } -if (!isProduction && !isTest) { +if (!isProduction) { webpackConfig.devServer = { host: 'localhost', port: 8080,