Commit 024b4d4f authored by Dan Abramov's avatar Dan Abramov
Browse files

Minor tweaks

parent c7bc89ce
Showing with 8 additions and 10 deletions
+8 -10
...@@ -12,16 +12,15 @@ var autoprefixer = require('autoprefixer'); ...@@ -12,16 +12,15 @@ var autoprefixer = require('autoprefixer');
var webpack = require('webpack'); var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin');
function isInDebugMode() {
return process.argv.some(function (item) { return item.indexOf('--debug-template') > -1 });
}
// TODO: hide this behind a flag and eliminate dead code on eject. // TODO: hide this behind a flag and eliminate dead code on eject.
// This shouldn't be exposed to the user. // This shouldn't be exposed to the user.
var isInNodeModules = 'node_modules' === var isInNodeModules = 'node_modules' ===
path.basename(path.resolve(path.join(__dirname, '..', '..'))); path.basename(path.resolve(path.join(__dirname, '..', '..')));
var relativePath = isInNodeModules ? '../../..' : '..'; var relativePath = isInNodeModules ? '../../..' : '..';
if (isInDebugMode()) { var isInDebugMode = process.argv.some(arg =>
arg.indexOf('--debug-template') > -1
);
if (isInDebugMode) {
relativePath = '../template'; relativePath = '../template';
} }
var srcPath = path.resolve(__dirname, relativePath, 'src'); var srcPath = path.resolve(__dirname, relativePath, 'src');
......
...@@ -17,14 +17,13 @@ var config = require('../config/webpack.config.dev'); ...@@ -17,14 +17,13 @@ var config = require('../config/webpack.config.dev');
var execSync = require('child_process').execSync; var execSync = require('child_process').execSync;
var opn = require('opn'); var opn = require('opn');
function isSmokeTest() {
return process.argv.some(function (item) { return item.indexOf('--smoke-test') > -1 });
}
// TODO: hide this behind a flag and eliminate dead code on eject. // TODO: hide this behind a flag and eliminate dead code on eject.
// This shouldn't be exposed to the user. // This shouldn't be exposed to the user.
var handleCompile; var handleCompile;
if (isSmokeTest()) { var isSmokeTest = process.argv.some(arg =>
arg.indexOf('--smoke-test') > -1
);
if (isSmokeTest) {
handleCompile = function (err, stats) { handleCompile = function (err, stats) {
if (err || stats.hasErrors() || stats.hasWarnings()) { if (err || stats.hasErrors() || stats.hasWarnings()) {
process.exit(1); process.exit(1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment