From 1a3fa312cdb22fe1c8a90305e9cc0b8123a75c2d Mon Sep 17 00:00:00 2001 From: Daniel Grant Date: Thu, 26 Jan 2017 02:22:48 +0000 Subject: [PATCH] Move utils into scripts folder (for inclusion in ejection) --- packages/react-scripts/scripts/eject.js | 5 +++-- packages/react-scripts/scripts/start.js | 4 ++-- packages/react-scripts/scripts/test.js | 2 +- .../{ => scripts}/utils/addWebpackMiddleware.js | 4 ++-- .../react-scripts/{ => scripts}/utils/createJestConfig.js | 2 +- .../{ => scripts}/utils/createWebpackCompiler.js | 0 6 files changed, 9 insertions(+), 8 deletions(-) rename packages/react-scripts/{ => scripts}/utils/addWebpackMiddleware.js (98%) rename packages/react-scripts/{ => scripts}/utils/createJestConfig.js (97%) rename packages/react-scripts/{ => scripts}/utils/createWebpackCompiler.js (100%) diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js index 57158cbada1..13f6a650701 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/scripts/eject.js @@ -14,7 +14,7 @@ var spawnSync = require('cross-spawn').sync; var chalk = require('chalk'); var prompt = require('react-dev-utils/prompt'); var paths = require('../config/paths'); -var createJestConfig = require('../utils/createJestConfig'); +var createJestConfig = require('./utils/createJestConfig'); var green = chalk.green; var cyan = chalk.cyan; @@ -48,7 +48,8 @@ prompt( var folders = [ 'config', 'config/jest', - 'scripts' + 'scripts', + 'scripts/utils' ]; // Make shallow array of files paths diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index d5d4c7880a1..652e3e339ac 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -29,8 +29,8 @@ var prompt = require('react-dev-utils/prompt'); var paths = require('../config/paths'); var config = require('../config/webpack.config.dev'); var devServerConfig = require('../config/webpackDevServer.config'); -var createWebpackCompiler = require('../utils/createWebpackCompiler'); -var addWebpackMiddleware = require('../utils/addWebpackMiddleware'); +var createWebpackCompiler = require('./utils/createWebpackCompiler'); +var addWebpackMiddleware = require('./utils/addWebpackMiddleware'); var useYarn = fs.existsSync(paths.yarnLockFile); var cli = useYarn ? 'yarn' : 'npm'; diff --git a/packages/react-scripts/scripts/test.js b/packages/react-scripts/scripts/test.js index 9de5181d739..dfd2c75c728 100644 --- a/packages/react-scripts/scripts/test.js +++ b/packages/react-scripts/scripts/test.js @@ -28,7 +28,7 @@ if (!process.env.CI && argv.indexOf('--coverage') < 0) { // @remove-on-eject-begin // This is not necessary after eject because we embed config into package.json. -const createJestConfig = require('../utils/createJestConfig'); +const createJestConfig = require('./utils/createJestConfig'); const path = require('path'); const paths = require('../config/paths'); argv.push('--config', JSON.stringify(createJestConfig( diff --git a/packages/react-scripts/utils/addWebpackMiddleware.js b/packages/react-scripts/scripts/utils/addWebpackMiddleware.js similarity index 98% rename from packages/react-scripts/utils/addWebpackMiddleware.js rename to packages/react-scripts/scripts/utils/addWebpackMiddleware.js index 4987853985a..1eccc95ef86 100644 --- a/packages/react-scripts/utils/addWebpackMiddleware.js +++ b/packages/react-scripts/scripts/utils/addWebpackMiddleware.js @@ -1,7 +1,7 @@ +var chalk = require('chalk'); var historyApiFallback = require('connect-history-api-fallback'); var httpProxyMiddleware = require('http-proxy-middleware'); -var paths = require('../config/paths'); -var chalk = require('chalk'); +var paths = require('../../config/paths'); module.exports = function addMiddleware(devServer) { // `proxy` lets you to specify a fallback server during development. diff --git a/packages/react-scripts/utils/createJestConfig.js b/packages/react-scripts/scripts/utils/createJestConfig.js similarity index 97% rename from packages/react-scripts/utils/createJestConfig.js rename to packages/react-scripts/scripts/utils/createJestConfig.js index 406b818846e..c99345b858a 100644 --- a/packages/react-scripts/utils/createJestConfig.js +++ b/packages/react-scripts/scripts/utils/createJestConfig.js @@ -9,7 +9,7 @@ */ const fs = require('fs'); -const paths = require('../config/paths'); +const paths = require('../../config/paths'); module.exports = (resolve, rootDir, isEjecting) => { // Use this instead of `paths.testsSetup` to avoid putting diff --git a/packages/react-scripts/utils/createWebpackCompiler.js b/packages/react-scripts/scripts/utils/createWebpackCompiler.js similarity index 100% rename from packages/react-scripts/utils/createWebpackCompiler.js rename to packages/react-scripts/scripts/utils/createWebpackCompiler.js