From f18b8284d07a66ea984aa51063b6ada3bccbb4af Mon Sep 17 00:00:00 2001 From: Ade Viankakrisna Fadlil Date: Mon, 10 Jul 2017 05:10:50 +0700 Subject: [PATCH] use babel for react-dev-utils remove build artifacts move babel-cli babel-preset-react-app and cross-env to devDependencies remove unused deps --- .eslintignore | 1 + package.json | 2 +- packages/react-dev-utils/.babelrc | 3 +++ packages/react-dev-utils/.gitignore | 1 + packages/react-dev-utils/package.json | 15 ++++++++++++--- .../react-dev-utils/{ => src}/FileSizeReporter.js | 0 .../{ => src}/InterpolateHtmlPlugin.js | 0 .../{ => src}/ModuleScopePlugin.js | 0 .../{ => src}/WatchMissingNodeModulesPlugin.js | 0 .../{ => src}/WebpackDevServerUtils.js | 0 .../{ => src}/checkRequiredFiles.js | 0 .../react-dev-utils/{ => src}/clearConsole.js | 0 packages/react-dev-utils/{ => src}/crossSpawn.js | 0 .../{ => src}/errorOverlayMiddleware.js | 0 .../react-dev-utils/{ => src}/eslintFormatter.js | 0 .../{ => src}/formatWebpackMessages.js | 0 .../{ => src}/getProcessForPort.js | 0 .../react-dev-utils/{ => src}/ignoredFiles.js | 0 packages/react-dev-utils/{ => src}/inquirer.js | 0 .../react-dev-utils/{ => src}/launchEditor.js | 0 .../{ => src}/launchEditorEndpoint.js | 0 .../{ => src}/noopServiceWorkerMiddleware.js | 0 packages/react-dev-utils/{ => src}/openBrowser.js | 0 .../react-dev-utils/{ => src}/printBuildError.js | 0 .../{ => src}/printHostingInstructions.js | 0 .../{ => src}/webpackHotDevClient.js | 0 26 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 packages/react-dev-utils/.babelrc create mode 100644 packages/react-dev-utils/.gitignore rename packages/react-dev-utils/{ => src}/FileSizeReporter.js (100%) rename packages/react-dev-utils/{ => src}/InterpolateHtmlPlugin.js (100%) rename packages/react-dev-utils/{ => src}/ModuleScopePlugin.js (100%) rename packages/react-dev-utils/{ => src}/WatchMissingNodeModulesPlugin.js (100%) rename packages/react-dev-utils/{ => src}/WebpackDevServerUtils.js (100%) rename packages/react-dev-utils/{ => src}/checkRequiredFiles.js (100%) rename packages/react-dev-utils/{ => src}/clearConsole.js (100%) rename packages/react-dev-utils/{ => src}/crossSpawn.js (100%) rename packages/react-dev-utils/{ => src}/errorOverlayMiddleware.js (100%) rename packages/react-dev-utils/{ => src}/eslintFormatter.js (100%) rename packages/react-dev-utils/{ => src}/formatWebpackMessages.js (100%) rename packages/react-dev-utils/{ => src}/getProcessForPort.js (100%) rename packages/react-dev-utils/{ => src}/ignoredFiles.js (100%) rename packages/react-dev-utils/{ => src}/inquirer.js (100%) rename packages/react-dev-utils/{ => src}/launchEditor.js (100%) rename packages/react-dev-utils/{ => src}/launchEditorEndpoint.js (100%) rename packages/react-dev-utils/{ => src}/noopServiceWorkerMiddleware.js (100%) rename packages/react-dev-utils/{ => src}/openBrowser.js (100%) rename packages/react-dev-utils/{ => src}/printBuildError.js (100%) rename packages/react-dev-utils/{ => src}/printHostingInstructions.js (100%) rename packages/react-dev-utils/{ => src}/webpackHotDevClient.js (100%) diff --git a/.eslintignore b/.eslintignore index 4eaf46c6d7d..4c7882c3158 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,4 @@ build my-app* packages/react-scripts/template packages/react-scripts/fixtures +packages/react-dev-utils/*.js diff --git a/package.json b/package.json index 9cf2f50f14f..56ed477410e 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "create-react-app": "node tasks/cra.js", "e2e": "tasks/e2e-simple.sh", "e2e:docker": "tasks/local-test.sh", - "postinstall": "node bootstrap.js && cd packages/react-error-overlay/ && npm run build:prod", + "postinstall": "node bootstrap.js && cd packages/react-dev-utils/ && npm run build:prod && cd ../react-error-overlay/ && npm run build:prod", "publish": "tasks/release.sh", "start": "node packages/react-scripts/scripts/start.js", "screencast": "svg-term --cast hItN7sl5yfCPTHxvFg5glhhfp --out screencast.svg --window", diff --git a/packages/react-dev-utils/.babelrc b/packages/react-dev-utils/.babelrc new file mode 100644 index 00000000000..c14b2828d16 --- /dev/null +++ b/packages/react-dev-utils/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["react-app"] +} diff --git a/packages/react-dev-utils/.gitignore b/packages/react-dev-utils/.gitignore new file mode 100644 index 00000000000..dcaffc008a6 --- /dev/null +++ b/packages/react-dev-utils/.gitignore @@ -0,0 +1 @@ +/*.js diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 54606f33fe8..f96f6d6f05f 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -4,6 +4,14 @@ "description": "Webpack utilities used by Create React App", "repository": "facebookincubator/create-react-app", "license": "MIT", + "scripts": { + "test": "jest", + "prepublish": "npm run build:prod", + "babel": "rimraf *.js && babel src/ -d ./", + "build": "cross-env NODE_ENV=development npm run babel", + "watch": "cross-env NODE_ENV=development npm run babel -- -w", + "build:prod": "cross-env NODE_ENV=production npm run babel" + }, "bugs": { "url": "https://github.com/facebookincubator/create-react-app/issues" }, @@ -56,9 +64,10 @@ "text-table": "0.2.0" }, "devDependencies": { + "babel-cli": "6.24.1", + "babel-preset-react-app": "3.0.2", + "cross-env": "5.0.5", + "rimraf": "^2.6.1", "jest": "20.0.4" - }, - "scripts": { - "test": "jest" } } diff --git a/packages/react-dev-utils/FileSizeReporter.js b/packages/react-dev-utils/src/FileSizeReporter.js similarity index 100% rename from packages/react-dev-utils/FileSizeReporter.js rename to packages/react-dev-utils/src/FileSizeReporter.js diff --git a/packages/react-dev-utils/InterpolateHtmlPlugin.js b/packages/react-dev-utils/src/InterpolateHtmlPlugin.js similarity index 100% rename from packages/react-dev-utils/InterpolateHtmlPlugin.js rename to packages/react-dev-utils/src/InterpolateHtmlPlugin.js diff --git a/packages/react-dev-utils/ModuleScopePlugin.js b/packages/react-dev-utils/src/ModuleScopePlugin.js similarity index 100% rename from packages/react-dev-utils/ModuleScopePlugin.js rename to packages/react-dev-utils/src/ModuleScopePlugin.js diff --git a/packages/react-dev-utils/WatchMissingNodeModulesPlugin.js b/packages/react-dev-utils/src/WatchMissingNodeModulesPlugin.js similarity index 100% rename from packages/react-dev-utils/WatchMissingNodeModulesPlugin.js rename to packages/react-dev-utils/src/WatchMissingNodeModulesPlugin.js diff --git a/packages/react-dev-utils/WebpackDevServerUtils.js b/packages/react-dev-utils/src/WebpackDevServerUtils.js similarity index 100% rename from packages/react-dev-utils/WebpackDevServerUtils.js rename to packages/react-dev-utils/src/WebpackDevServerUtils.js diff --git a/packages/react-dev-utils/checkRequiredFiles.js b/packages/react-dev-utils/src/checkRequiredFiles.js similarity index 100% rename from packages/react-dev-utils/checkRequiredFiles.js rename to packages/react-dev-utils/src/checkRequiredFiles.js diff --git a/packages/react-dev-utils/clearConsole.js b/packages/react-dev-utils/src/clearConsole.js similarity index 100% rename from packages/react-dev-utils/clearConsole.js rename to packages/react-dev-utils/src/clearConsole.js diff --git a/packages/react-dev-utils/crossSpawn.js b/packages/react-dev-utils/src/crossSpawn.js similarity index 100% rename from packages/react-dev-utils/crossSpawn.js rename to packages/react-dev-utils/src/crossSpawn.js diff --git a/packages/react-dev-utils/errorOverlayMiddleware.js b/packages/react-dev-utils/src/errorOverlayMiddleware.js similarity index 100% rename from packages/react-dev-utils/errorOverlayMiddleware.js rename to packages/react-dev-utils/src/errorOverlayMiddleware.js diff --git a/packages/react-dev-utils/eslintFormatter.js b/packages/react-dev-utils/src/eslintFormatter.js similarity index 100% rename from packages/react-dev-utils/eslintFormatter.js rename to packages/react-dev-utils/src/eslintFormatter.js diff --git a/packages/react-dev-utils/formatWebpackMessages.js b/packages/react-dev-utils/src/formatWebpackMessages.js similarity index 100% rename from packages/react-dev-utils/formatWebpackMessages.js rename to packages/react-dev-utils/src/formatWebpackMessages.js diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/src/getProcessForPort.js similarity index 100% rename from packages/react-dev-utils/getProcessForPort.js rename to packages/react-dev-utils/src/getProcessForPort.js diff --git a/packages/react-dev-utils/ignoredFiles.js b/packages/react-dev-utils/src/ignoredFiles.js similarity index 100% rename from packages/react-dev-utils/ignoredFiles.js rename to packages/react-dev-utils/src/ignoredFiles.js diff --git a/packages/react-dev-utils/inquirer.js b/packages/react-dev-utils/src/inquirer.js similarity index 100% rename from packages/react-dev-utils/inquirer.js rename to packages/react-dev-utils/src/inquirer.js diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/src/launchEditor.js similarity index 100% rename from packages/react-dev-utils/launchEditor.js rename to packages/react-dev-utils/src/launchEditor.js diff --git a/packages/react-dev-utils/launchEditorEndpoint.js b/packages/react-dev-utils/src/launchEditorEndpoint.js similarity index 100% rename from packages/react-dev-utils/launchEditorEndpoint.js rename to packages/react-dev-utils/src/launchEditorEndpoint.js diff --git a/packages/react-dev-utils/noopServiceWorkerMiddleware.js b/packages/react-dev-utils/src/noopServiceWorkerMiddleware.js similarity index 100% rename from packages/react-dev-utils/noopServiceWorkerMiddleware.js rename to packages/react-dev-utils/src/noopServiceWorkerMiddleware.js diff --git a/packages/react-dev-utils/openBrowser.js b/packages/react-dev-utils/src/openBrowser.js similarity index 100% rename from packages/react-dev-utils/openBrowser.js rename to packages/react-dev-utils/src/openBrowser.js diff --git a/packages/react-dev-utils/printBuildError.js b/packages/react-dev-utils/src/printBuildError.js similarity index 100% rename from packages/react-dev-utils/printBuildError.js rename to packages/react-dev-utils/src/printBuildError.js diff --git a/packages/react-dev-utils/printHostingInstructions.js b/packages/react-dev-utils/src/printHostingInstructions.js similarity index 100% rename from packages/react-dev-utils/printHostingInstructions.js rename to packages/react-dev-utils/src/printHostingInstructions.js diff --git a/packages/react-dev-utils/webpackHotDevClient.js b/packages/react-dev-utils/src/webpackHotDevClient.js similarity index 100% rename from packages/react-dev-utils/webpackHotDevClient.js rename to packages/react-dev-utils/src/webpackHotDevClient.js