diff --git a/.travis.yml b/.travis.yml index 3ed7097635b..6750e179b8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,6 @@ node_js: - 6 cache: directories: - - global-cli/node_modules - - node_modules + - packages/react-scripts/node_modules + - packages/react-create-app/node_modules script: tasks/e2e.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 74d2eb8e97e..d43726ff191 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,7 +26,7 @@ Please also provide a **test plan**, i.e. specify how you verified what you adde 1. Clone the repo with `git clone https://github.com/facebookincubator/create-react-app` -2. Run `npm install` in the root `create-react-app` folder **and** the `create-react-app/global-cli` folder +2. Run `npm install` in `packages/create-react-app` folder **and** the `packages/react-scripts` folder Once it is done, you can modify any file locally and run `npm start` or `npm run build` just like in a generated project. diff --git a/global-cli/index.js b/packages/create-react-app/index.js similarity index 100% rename from global-cli/index.js rename to packages/create-react-app/index.js diff --git a/global-cli/package.json b/packages/create-react-app/package.json similarity index 100% rename from global-cli/package.json rename to packages/create-react-app/package.json diff --git a/.eslintrc.js b/packages/react-scripts/.eslintrc.js similarity index 100% rename from .eslintrc.js rename to packages/react-scripts/.eslintrc.js diff --git a/.gitignore b/packages/react-scripts/.gitignore similarity index 100% rename from .gitignore rename to packages/react-scripts/.gitignore diff --git a/bin/react-scripts.js b/packages/react-scripts/bin/react-scripts.js similarity index 100% rename from bin/react-scripts.js rename to packages/react-scripts/bin/react-scripts.js diff --git a/config/babel.dev.js b/packages/react-scripts/config/babel.dev.js similarity index 100% rename from config/babel.dev.js rename to packages/react-scripts/config/babel.dev.js diff --git a/config/babel.prod.js b/packages/react-scripts/config/babel.prod.js similarity index 100% rename from config/babel.prod.js rename to packages/react-scripts/config/babel.prod.js diff --git a/config/env.js b/packages/react-scripts/config/env.js similarity index 100% rename from config/env.js rename to packages/react-scripts/config/env.js diff --git a/config/eslint.js b/packages/react-scripts/config/eslint.js similarity index 100% rename from config/eslint.js rename to packages/react-scripts/config/eslint.js diff --git a/config/flow/css.js.flow b/packages/react-scripts/config/flow/css.js.flow similarity index 100% rename from config/flow/css.js.flow rename to packages/react-scripts/config/flow/css.js.flow diff --git a/config/flow/file.js.flow b/packages/react-scripts/config/flow/file.js.flow similarity index 100% rename from config/flow/file.js.flow rename to packages/react-scripts/config/flow/file.js.flow diff --git a/config/jest/CSSStub.js b/packages/react-scripts/config/jest/CSSStub.js similarity index 100% rename from config/jest/CSSStub.js rename to packages/react-scripts/config/jest/CSSStub.js diff --git a/config/jest/FileStub.js b/packages/react-scripts/config/jest/FileStub.js similarity index 100% rename from config/jest/FileStub.js rename to packages/react-scripts/config/jest/FileStub.js diff --git a/config/jest/environment.js b/packages/react-scripts/config/jest/environment.js similarity index 100% rename from config/jest/environment.js rename to packages/react-scripts/config/jest/environment.js diff --git a/config/jest/transform.js b/packages/react-scripts/config/jest/transform.js similarity index 100% rename from config/jest/transform.js rename to packages/react-scripts/config/jest/transform.js diff --git a/config/paths.js b/packages/react-scripts/config/paths.js similarity index 94% rename from config/paths.js rename to packages/react-scripts/config/paths.js index e6f2ff6cb3a..c18d32f0530 100644 --- a/config/paths.js +++ b/packages/react-scripts/config/paths.js @@ -32,9 +32,9 @@ function resolveApp(relativePath) { } if (isInCreateReactAppSource) { - // create-react-app development: we're in ./config/ + // create-react-app development: we're in ./config/packages/react-scripts module.exports = { - appBuild: resolveOwn('../build'), + appBuild: resolveOwn('../../../build'), appHtml: resolveOwn('../template/index.html'), appPackageJson: resolveOwn('../package.json'), appSrc: resolveOwn('../template/src'), diff --git a/config/polyfills.js b/packages/react-scripts/config/polyfills.js similarity index 100% rename from config/polyfills.js rename to packages/react-scripts/config/polyfills.js diff --git a/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js similarity index 100% rename from config/webpack.config.dev.js rename to packages/react-scripts/config/webpack.config.dev.js diff --git a/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js similarity index 100% rename from config/webpack.config.prod.js rename to packages/react-scripts/config/webpack.config.prod.js diff --git a/package.json b/packages/react-scripts/package.json similarity index 95% rename from package.json rename to packages/react-scripts/package.json index 1b389da8005..90796e907d2 100644 --- a/package.json +++ b/packages/react-scripts/package.json @@ -12,13 +12,12 @@ }, "scripts": { "build": "node scripts/build.js --debug-template", - "create-react-app": "node global-cli/index.js --scripts-version \"$PWD/`npm pack`\"", - "e2e": "tasks/e2e.sh", + "create-react-app": "node ../create-react-app/index.js --scripts-version \"$PWD/`npm pack`\"", + "e2e": "../../tasks/e2e.sh", "start": "node scripts/start.js --debug-template", "test": "node scripts/test.js --debug-template" }, "files": [ - "PATENTS", "bin", "config", "scripts", diff --git a/scripts/build.js b/packages/react-scripts/scripts/build.js similarity index 100% rename from scripts/build.js rename to packages/react-scripts/scripts/build.js diff --git a/scripts/eject.js b/packages/react-scripts/scripts/eject.js similarity index 100% rename from scripts/eject.js rename to packages/react-scripts/scripts/eject.js diff --git a/scripts/init.js b/packages/react-scripts/scripts/init.js similarity index 100% rename from scripts/init.js rename to packages/react-scripts/scripts/init.js diff --git a/scripts/start.js b/packages/react-scripts/scripts/start.js similarity index 100% rename from scripts/start.js rename to packages/react-scripts/scripts/start.js diff --git a/scripts/test.js b/packages/react-scripts/scripts/test.js similarity index 100% rename from scripts/test.js rename to packages/react-scripts/scripts/test.js diff --git a/scripts/utils/WatchMissingNodeModulesPlugin.js b/packages/react-scripts/scripts/utils/WatchMissingNodeModulesPlugin.js similarity index 100% rename from scripts/utils/WatchMissingNodeModulesPlugin.js rename to packages/react-scripts/scripts/utils/WatchMissingNodeModulesPlugin.js diff --git a/scripts/utils/chrome.applescript b/packages/react-scripts/scripts/utils/chrome.applescript similarity index 100% rename from scripts/utils/chrome.applescript rename to packages/react-scripts/scripts/utils/chrome.applescript diff --git a/scripts/utils/createJestConfig.js b/packages/react-scripts/scripts/utils/createJestConfig.js similarity index 100% rename from scripts/utils/createJestConfig.js rename to packages/react-scripts/scripts/utils/createJestConfig.js diff --git a/scripts/utils/prompt.js b/packages/react-scripts/scripts/utils/prompt.js similarity index 100% rename from scripts/utils/prompt.js rename to packages/react-scripts/scripts/utils/prompt.js diff --git a/template/README.md b/packages/react-scripts/template/README.md similarity index 100% rename from template/README.md rename to packages/react-scripts/template/README.md diff --git a/template/gitignore b/packages/react-scripts/template/gitignore similarity index 100% rename from template/gitignore rename to packages/react-scripts/template/gitignore diff --git a/template/index.html b/packages/react-scripts/template/index.html similarity index 100% rename from template/index.html rename to packages/react-scripts/template/index.html diff --git a/template/src/App.css b/packages/react-scripts/template/src/App.css similarity index 100% rename from template/src/App.css rename to packages/react-scripts/template/src/App.css diff --git a/template/src/App.js b/packages/react-scripts/template/src/App.js similarity index 100% rename from template/src/App.js rename to packages/react-scripts/template/src/App.js diff --git a/template/src/__tests__/App-test.js b/packages/react-scripts/template/src/__tests__/App-test.js similarity index 100% rename from template/src/__tests__/App-test.js rename to packages/react-scripts/template/src/__tests__/App-test.js diff --git a/template/src/favicon.ico b/packages/react-scripts/template/src/favicon.ico similarity index 100% rename from template/src/favicon.ico rename to packages/react-scripts/template/src/favicon.ico diff --git a/template/src/index.css b/packages/react-scripts/template/src/index.css similarity index 100% rename from template/src/index.css rename to packages/react-scripts/template/src/index.css diff --git a/template/src/index.js b/packages/react-scripts/template/src/index.js similarity index 100% rename from template/src/index.js rename to packages/react-scripts/template/src/index.js diff --git a/template/src/logo.svg b/packages/react-scripts/template/src/logo.svg similarity index 100% rename from template/src/logo.svg rename to packages/react-scripts/template/src/logo.svg diff --git a/tasks/e2e.sh b/tasks/e2e.sh index 6e6c20c9420..9f628d1efbe 100755 --- a/tasks/e2e.sh +++ b/tasks/e2e.sh @@ -12,7 +12,7 @@ cd "$(dirname "$0")" function cleanup { echo 'Cleaning up.' cd $initial_path - rm ../template/src/__tests__/__snapshots__/App-test.js.snap + rm ../packages/react-scripts/template/src/__tests__/__snapshots__/App-test.js.snap rm -rf $temp_cli_path $temp_app_path } @@ -41,7 +41,8 @@ set -x # npm pack the two directories to make sure they are valid npm modules initial_path=$PWD -cd .. +# Switch to the packages/react-scripts directory +cd ../packages/react-scripts # A hacky way to avoid bundling dependencies. # Packing with them enabled takes too much memory, and Travis crashes. @@ -62,6 +63,9 @@ npm start -- --smoke-test # Test local build command npm run build +# Jump to the root directory +cd ../.. + # Check for expected output test -e build/*.html test -e build/static/js/*.js @@ -69,12 +73,15 @@ test -e build/static/css/*.css test -e build/static/media/*.svg test -e build/favicon.ico +# Jump to the packages/react-scripts dir to run tests +cd packages/react-scripts + # Run tests npm run test test -e template/src/__tests__/__snapshots__/App-test.js.snap -# Pack CLI -cd global-cli +# Pack CLI, in packages/create-react-app +cd ../create-react-app npm install cli_path=$PWD/`npm pack` diff --git a/tasks/release.sh b/tasks/release.sh index c52d7c40bef..4a22499a32a 100755 --- a/tasks/release.sh +++ b/tasks/release.sh @@ -17,8 +17,8 @@ set -e # Echo every command being executed set -x -# Go to root -cd .. +# Go to packages/react-scripts +cd ../packages/react-scripts # You can only release with npm >= 3 if [ $(npm -v | head -c 1) -lt 3 ]; then