Skip to content

Commit

Permalink
Move configs to a separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Jul 19, 2016
1 parent 7a15b7e commit 95e73d3
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions webpack.config.dev.js → config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');

var isInNodeModules = 'node_modules' ===
path.basename(path.resolve(path.join(__dirname, '..')));
var relative = isInNodeModules ? '../..' : '.';
path.basename(path.resolve(path.join(__dirname, '..', '..')));
var relative = isInNodeModules ? '../../..' : '..';

module.exports = {
devtool: 'eval',
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.prod.js → config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');

var isInNodeModules = 'node_modules' ===
path.basename(path.resolve(path.join(__dirname, '..')));
var relative = isInNodeModules ? '../..' : '.';
path.basename(path.resolve(path.join(__dirname, '..', '..')));
var relative = isInNodeModules ? '../../..' : '..';

module.exports = {
devtool: 'source-map',
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
"files": [
"LICENSE",
"PATENTS",
".eslintrc",
"bin",
"config",
"scripts",
"src",
"index.html",
"webpack.config.dev.js",
"webpack.config.prod.js"
"index.html"
],
"bin": {
"start-react-app": "./bin/start-react-app.js",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ process.env.NODE_ENV = 'production';
var path = require('path');
var rimrafSync = require('rimraf').sync;
var webpack = require('webpack');
var config = require('../webpack.config.prod');
var config = require('../config/webpack.config.prod');

var isInNodeModules = 'node_modules' ===
path.basename(path.resolve(path.join(__dirname, '..', '..')));
Expand Down
12 changes: 7 additions & 5 deletions scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ prompt('Are you sure you want to eject? This action is permanent. [y/N]', functi
var hostPath = path.join(selfPath, '..', '..');

var files = [
path.join('scripts', 'build.js'),
path.join('scripts', 'start.js'),
'webpack.config.dev.js',
'webpack.config.prod.js',
'.eslintrc'
path.join('config', '.eslintrc'),
path.join('config', 'webpack.config.dev.js'),
path.join('config', 'webpack.config.prod.js'),
path.join('scripts', 'build.js'),
path.join('scripts', 'start.js')
];

// Ensure that the host folder is clean and we won't override any files
Expand All @@ -61,7 +61,9 @@ prompt('Are you sure you want to eject? This action is permanent. [y/N]', functi
});

// Copy the files over
fs.mkdirSync(path.join(hostPath, 'config'));
fs.mkdirSync(path.join(hostPath, 'scripts'));

files.forEach(function(file) {
console.log('Copying ' + file + ' to ' + hostPath);
var content = fs.readFileSync(path.join(selfPath, file), 'utf8');
Expand Down
2 changes: 1 addition & 1 deletion scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ process.env.NODE_ENV = 'development';

var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('../webpack.config.dev');
var config = require('../config/webpack.config.dev');
var execSync = require('child_process').execSync;
var opn = require('opn');

Expand Down

0 comments on commit 95e73d3

Please sign in to comment.