From 2413af7b39a21879b17f3c422a2a57d4923306e9 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 18:41:44 +0000 Subject: [PATCH 01/17] Switch to Yarn Workspaces --- CONTRIBUTING.md | 18 ++++++------- bootstrap.js | 67 ------------------------------------------------ lerna.json | 9 +++---- package.json | 15 ++++++----- tasks/release.sh | 46 --------------------------------- 5 files changed, 21 insertions(+), 134 deletions(-) delete mode 100644 bootstrap.js delete mode 100755 tasks/release.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8957c0c3de6..10472909d5c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,20 +75,18 @@ All functionality must be retained (and configuration given to the user) if they 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. +2. Run `yarn --no-lockfile` in the root `create-react-app` folder. -Once it is done, you can modify any file locally and run `npm start`, `npm test` or `npm run build` just like in a generated project. +Once it is done, you can modify any file locally and run `yarn start`, `yarn test` or `yarn build` just like in a generated project. If you want to try out the end-to-end flow with the global CLI, you can do this too: ``` -npm run create-react-app my-app +yarn run create-react-app my-app cd my-app ``` -and then run `npm start` or `npm run build`. - -*Note: if you are using yarn, we suggest that you use `yarn install --no-lockfile` instead of the bare `yarn` or `yarn install` because we [intentionally](https://github.com/facebookincubator/create-react-app/pull/2014#issuecomment-300811661) do not ignore or add yarn.lock to our repo.* +and then run `yarn start` or `yarn build`. ## Contributing to E2E (end to end) tests @@ -104,8 +102,8 @@ The scripts in tasks folder and other scripts in `package.json` will not work in A good step by step guide can be found [here](https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/) -### Install Node.js and npm -Even if you have node and npm installed on your windows, it would not be accessible from the bash shell. You would have to install it again. Installing via [`nvm`](https://github.com/creationix/nvm#install-script) is recommended. +### Install Node.js and yarn +Even if you have node and yarn installed on your windows, it would not be accessible from the bash shell. You would have to install it again. Installing via [`nvm`](https://github.com/creationix/nvm#install-script) is recommended. ### Line endings @@ -119,11 +117,11 @@ By default git would use `CRLF` line endings which would cause the scripts to fa 4. Note that files in `packages/create-react-app` should be modified with extreme caution. Since it’s a global CLI, any version of `create-react-app` (global CLI) including very old ones should work with the latest version of `react-scripts`. 5. Create a change log entry for the release: * You'll need an [access token for the GitHub API](https://help.github.com/articles/creating-an-access-token-for-command-line-use/). Save it to this environment variable: `export GITHUB_AUTH="..."` - * Run `npm run changelog`. The command will find all the labeled pull requests merged since the last release and group them by the label and affected packages, and create a change log entry with all the changes and links to PRs and their authors. Copy and paste it to `CHANGELOG.md`. + * Run `yarn run changelog`. The command will find all the labeled pull requests merged since the last release and group them by the label and affected packages, and create a change log entry with all the changes and links to PRs and their authors. Copy and paste it to `CHANGELOG.md`. * Add a four-space indented paragraph after each non-trivial list item, explaining what changed and why. For each breaking change also write who it affects and instructions for migrating existing code. * Maybe add some newlines here and there. Preview the result on GitHub to get a feel for it. Changelog generator output is a bit too terse for my taste, so try to make it visually pleasing and well grouped. 6. Make sure to include “Migrating from ...” instructions for the previous release. Often you can copy and paste them. -7. **Do not run `npm publish`. Instead, run `npm run publish`.** +7. **Do not run `yarn publish`. Instead, run `yarn run publish`.** 8. Wait for a long time, and it will get published. Don’t worry that it’s stuck. In the end the publish script will prompt for versions before publishing the packages. 9. After publishing, create a GitHub Release with the same text as the changelog entry. See previous Releases for inspiration. diff --git a/bootstrap.js b/bootstrap.js deleted file mode 100644 index b54a1ed9f36..00000000000 --- a/bootstrap.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -const { execSync, spawn } = require('child_process'); -const { resolve } = require('path'); -const { existsSync } = require('fs'); -const { platform } = require('os'); - -function shouldUseYarn() { - try { - execSync('yarnpkg --version', { stdio: 'ignore' }); - return true; - } catch (e) { - return false; - } -} - -function shouldUseNpmConcurrently() { - try { - const versionString = execSync('npm --version'); - const m = /^(\d+)[.]/.exec(versionString); - // NPM >= 5 support concurrent installs - return Number(m[1]) >= 5; - } catch (e) { - return false; - } -} - -const yarn = shouldUseYarn(); -const windows = platform() === 'win32'; -const lerna = resolve( - __dirname, - 'node_modules', - '.bin', - windows ? 'lerna.cmd' : 'lerna' -); - -if (!existsSync(lerna)) { - if (yarn) { - console.log('Cannot find lerna. Please run `yarn --check-files`.'); - } else { - console.log( - 'Cannot find lerna. Please remove `node_modules` and run `npm install`.' - ); - } - process.exit(1); -} - -let child; -if (yarn) { - // Yarn does not support concurrency - child = spawn(lerna, ['bootstrap', '--npm-client=yarn', '--concurrency=1'], { - stdio: 'inherit', - }); -} else { - let args = ['bootstrap']; - if ( - // The Windows filesystem does not handle concurrency well - windows || - // Only newer npm versions support concurrency - !shouldUseNpmConcurrently() - ) { - args.push('--concurrency=1'); - } - child = spawn(lerna, args, { stdio: 'inherit' }); -} - -child.on('close', code => process.exit(code)); diff --git a/lerna.json b/lerna.json index 1673f8a3187..f1d78d84bae 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,7 @@ { - "lerna": "2.0.0", + "lerna": "2.6.0", + "npmClient": "yarn", + "useWorkspaces": true, "version": "independent", "changelog": { "repo": "facebookincubator/create-react-app", @@ -12,8 +14,5 @@ "tag: internal": ":house: Internal" }, "cacheDir": ".changelog" - }, - "packages": [ - "packages/*" - ] + } } diff --git a/package.json b/package.json index 9cf2f50f14f..5d70bac48fc 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,26 @@ { "private": true, + "workspaces": [ + "packages/*" + ], "scripts": { - "build": "node packages/react-scripts/scripts/build.js", + "build": "cd packages/react-scripts && node scripts/build.js", "changelog": "lerna-changelog", "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", - "publish": "tasks/release.sh", - "start": "node packages/react-scripts/scripts/start.js", + "postinstall": "cd packages/react-error-overlay/ && yarn build:prod", + "publish": "lerna publish --independent", + "start": "cd packages/react-scripts && node scripts/start.js", "screencast": "svg-term --cast hItN7sl5yfCPTHxvFg5glhhfp --out screencast.svg --window", - "test": "node packages/react-scripts/scripts/test.js --env=jsdom", + "test": "cd packages/react-scripts && node scripts/test.js --env=jsdom", "format": "prettier --trailing-comma es5 --single-quote --write 'packages/*/*.js' 'packages/*/!(node_modules)/**/*.js'", "precommit": "lint-staged" }, "devDependencies": { "eslint": "^4.4.1", "husky": "^0.13.2", - "lerna": "^2.0.0", + "lerna": "^2.6.0", "lerna-changelog": "^0.6.0", "lint-staged": "^3.3.1", "prettier": "1.6.1", diff --git a/tasks/release.sh b/tasks/release.sh deleted file mode 100755 index 0f11bb0d60c..00000000000 --- a/tasks/release.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright (c) 2015-present, Facebook, Inc. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# ****************************************************************************** -# This releases an update to the `react-scripts` package. -# Don't use `npm publish` for it. -# Read the release instructions: -# https://github.com/facebookincubator/create-react-app/blob/master/CONTRIBUTING.md#cutting-a-release -# ****************************************************************************** - -# Start in tasks/ even if run from root directory -cd "$(dirname "$0")" - -# Exit the script on any command with non 0 return code -# We assume that all the commands in the pipeline set their return code -# properly and that we do not need to validate that the output is correct -set -e - -# Echo every command being executed -set -x - -# Go to root -cd .. -root_path=$PWD - -# You can only release with npm >= 3 -if [ $(npm -v | head -c 1) -lt 3 ]; then - echo "Releasing requires npm >= 3. Aborting."; - exit 1; -fi; - -if [ -n "$(git status --porcelain)" ]; then - echo "Your git status is not clean. Aborting."; - exit 1; -fi - -cd "$root_path" -# Compile -cd packages/react-error-overlay/ -npm run build:prod -cd ../.. -# Go! -./node_modules/.bin/lerna publish --independent "$@" From 3ebc5250d6de29f6d6c027786041cb7b3543bad5 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 19:28:53 +0000 Subject: [PATCH 02/17] Feedback --- .yarnrc | 1 + CONTRIBUTING.md | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 .yarnrc diff --git a/.yarnrc b/.yarnrc new file mode 100644 index 00000000000..acaaffdb73e --- /dev/null +++ b/.yarnrc @@ -0,0 +1 @@ +--install.no-lockfile true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 10472909d5c..d64757f0a02 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,7 +82,7 @@ Once it is done, you can modify any file locally and run `yarn start`, `yarn tes If you want to try out the end-to-end flow with the global CLI, you can do this too: ``` -yarn run create-react-app my-app +yarn create-react-app my-app cd my-app ``` @@ -117,11 +117,11 @@ By default git would use `CRLF` line endings which would cause the scripts to fa 4. Note that files in `packages/create-react-app` should be modified with extreme caution. Since it’s a global CLI, any version of `create-react-app` (global CLI) including very old ones should work with the latest version of `react-scripts`. 5. Create a change log entry for the release: * You'll need an [access token for the GitHub API](https://help.github.com/articles/creating-an-access-token-for-command-line-use/). Save it to this environment variable: `export GITHUB_AUTH="..."` - * Run `yarn run changelog`. The command will find all the labeled pull requests merged since the last release and group them by the label and affected packages, and create a change log entry with all the changes and links to PRs and their authors. Copy and paste it to `CHANGELOG.md`. + * Run `yarn changelog`. The command will find all the labeled pull requests merged since the last release and group them by the label and affected packages, and create a change log entry with all the changes and links to PRs and their authors. Copy and paste it to `CHANGELOG.md`. * Add a four-space indented paragraph after each non-trivial list item, explaining what changed and why. For each breaking change also write who it affects and instructions for migrating existing code. * Maybe add some newlines here and there. Preview the result on GitHub to get a feel for it. Changelog generator output is a bit too terse for my taste, so try to make it visually pleasing and well grouped. 6. Make sure to include “Migrating from ...” instructions for the previous release. Often you can copy and paste them. -7. **Do not run `yarn publish`. Instead, run `yarn run publish`.** +7. Run `yarn run publish`. (Don’t forget the `run` there.) 8. Wait for a long time, and it will get published. Don’t worry that it’s stuck. In the end the publish script will prompt for versions before publishing the packages. 9. After publishing, create a GitHub Release with the same text as the changelog entry. See previous Releases for inspiration. From efc6da511723a3cb86eb1274f1f51ee3743e4137 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 19:35:17 +0000 Subject: [PATCH 03/17] Move flowconfig --- .flowconfig | 6 ++++++ packages/react-error-overlay/.flowconfig | 9 --------- 2 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 .flowconfig delete mode 100644 packages/react-error-overlay/.flowconfig diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 00000000000..ba65ad6317a --- /dev/null +++ b/.flowconfig @@ -0,0 +1,6 @@ +[include] +react-error-overlay/src/**/*.js + +[libs] + +[options] diff --git a/packages/react-error-overlay/.flowconfig b/packages/react-error-overlay/.flowconfig deleted file mode 100644 index 8d7de784e29..00000000000 --- a/packages/react-error-overlay/.flowconfig +++ /dev/null @@ -1,9 +0,0 @@ -[ignore] -.*/node_modules/eslint-plugin-jsx-a11y/.* - -[include] -src/**/*.js - -[libs] - -[options] From 651e29e9b342df149331bc1e763ab541b8591b6e Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 19:40:25 +0000 Subject: [PATCH 04/17] Use publish script --- tasks/e2e-installs.sh | 2 +- tasks/e2e-kitchensink.sh | 2 +- tasks/e2e-simple.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/e2e-installs.sh b/tasks/e2e-installs.sh index 73ca1c04b15..ce7d042c82e 100755 --- a/tasks/e2e-installs.sh +++ b/tasks/e2e-installs.sh @@ -95,7 +95,7 @@ npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://local # Publish the monorepo git clean -f -./tasks/release.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +yarn run publish --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest # ****************************************************************************** # Test --scripts-version with a version number diff --git a/tasks/e2e-kitchensink.sh b/tasks/e2e-kitchensink.sh index d12a3d645c0..4a63a4ea4a1 100755 --- a/tasks/e2e-kitchensink.sh +++ b/tasks/e2e-kitchensink.sh @@ -87,7 +87,7 @@ npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://local # Publish the monorepo git clean -f -./tasks/release.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +yarn run publish --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest # ****************************************************************************** # Now that we have published them, create a clean app folder and install them. diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 44ee14fb15c..850b9c91b7e 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -130,7 +130,7 @@ CI=true yarn test yarn start --smoke-test git clean -f -./tasks/release.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +yarn run publish --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest # ****************************************************************************** # Install react-scripts prerelease via create-react-app prerelease. From c47bcaf31d240ecb098c7f130dcb8bba4a55cc55 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 19:50:37 +0000 Subject: [PATCH 05/17] Keep git status check --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d70bac48fc..768ad0ab6ae 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "e2e": "tasks/e2e-simple.sh", "e2e:docker": "tasks/local-test.sh", "postinstall": "cd packages/react-error-overlay/ && yarn build:prod", - "publish": "lerna publish --independent", + "publish": "(git status --porcelain | grep -q ^ && echo '\nGit status is dirty.\n' && exit 1 || exit 0) && lerna publish --independent", "start": "cd packages/react-scripts && node scripts/start.js", "screencast": "svg-term --cast hItN7sl5yfCPTHxvFg5glhhfp --out screencast.svg --window", "test": "cd packages/react-scripts && node scripts/test.js --env=jsdom", From 0a6d95e17737697391b265000193d58c33d9df67 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 20:31:18 +0000 Subject: [PATCH 06/17] Fix Flow without perf penalty --- .flowconfig | 6 ------ packages/react-error-overlay/.flowconfig | 10 ++++++++++ packages/react-error-overlay/flow/env.js | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) delete mode 100644 .flowconfig create mode 100644 packages/react-error-overlay/.flowconfig create mode 100644 packages/react-error-overlay/flow/env.js diff --git a/.flowconfig b/.flowconfig deleted file mode 100644 index ba65ad6317a..00000000000 --- a/.flowconfig +++ /dev/null @@ -1,6 +0,0 @@ -[include] -react-error-overlay/src/**/*.js - -[libs] - -[options] diff --git a/packages/react-error-overlay/.flowconfig b/packages/react-error-overlay/.flowconfig new file mode 100644 index 00000000000..1910860ba99 --- /dev/null +++ b/packages/react-error-overlay/.flowconfig @@ -0,0 +1,10 @@ +[include] +/src/**/*.js + +[ignore] +.*/node_modules/.* + +[libs] +flow/ + +[options] \ No newline at end of file diff --git a/packages/react-error-overlay/flow/env.js b/packages/react-error-overlay/flow/env.js new file mode 100644 index 00000000000..dbcf689038f --- /dev/null +++ b/packages/react-error-overlay/flow/env.js @@ -0,0 +1,19 @@ +declare module 'anser' { + declare var exports: any; +} + +declare module 'babel-code-frame' { + declare var exports: any; +} + +declare module 'html-entities' { + declare var exports: any; +} + +declare module 'settle-promise' { + declare var exports: any; +} + +declare module 'source-map' { + declare var exports: any; +} From de7cd49d407e276fe4d8f6c9c4e6c4e6be90ca47 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 22:00:04 +0000 Subject: [PATCH 07/17] Remove Flow from package.json "test" --- packages/react-error-overlay/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-error-overlay/package.json b/packages/react-error-overlay/package.json index d4e528ea6c6..35cc70e7287 100644 --- a/packages/react-error-overlay/package.json +++ b/packages/react-error-overlay/package.json @@ -6,7 +6,7 @@ "scripts": { "prepublishOnly": "npm run build:prod && npm test", "start": "cross-env NODE_ENV=development node build.js --watch", - "test": "flow && cross-env NODE_ENV=test jest", + "test": "cross-env NODE_ENV=test jest", "build": "cross-env NODE_ENV=development node build.js", "build:prod": "cross-env NODE_ENV=production node build.js" }, From 3f852a56bb3ff06aaef624abfe6ec33939235f32 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 22:23:26 +0000 Subject: [PATCH 08/17] Try running it from script directly (?) --- tasks/e2e-simple.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 850b9c91b7e..13090f20005 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -102,6 +102,7 @@ npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://local cd packages/react-error-overlay/ ./node_modules/.bin/eslint --max-warnings 0 src/ yarn test +yarn run flow cd ../.. cd packages/react-dev-utils/ yarn test From 194b12afd47140156754ff3903b1c347ba876de3 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 11 Jan 2018 23:40:43 +0000 Subject: [PATCH 09/17] Try magic incantations --- packages/react-error-overlay/.flowconfig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/react-error-overlay/.flowconfig b/packages/react-error-overlay/.flowconfig index 1910860ba99..a044e67561c 100644 --- a/packages/react-error-overlay/.flowconfig +++ b/packages/react-error-overlay/.flowconfig @@ -3,8 +3,13 @@ [ignore] .*/node_modules/.* +.*/.git/.* +.*/__test__/.* +.*/fixtures/.* [libs] -flow/ +/flow/env.js -[options] \ No newline at end of file +[options] +module.file_ext=.js +sharedmemory.hash_table_pow=19 From f5a17bb0f8400568e3480285a842daad37e2d00d Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 12 Jan 2018 00:18:30 +0000 Subject: [PATCH 10/17] lol flow COME ON --- packages/react-error-overlay/.flowconfig | 2 +- packages/react-error-overlay/flow/env.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react-error-overlay/.flowconfig b/packages/react-error-overlay/.flowconfig index a044e67561c..c976167c2a9 100644 --- a/packages/react-error-overlay/.flowconfig +++ b/packages/react-error-overlay/.flowconfig @@ -8,7 +8,7 @@ .*/fixtures/.* [libs] -/flow/env.js +flow/ [options] module.file_ext=.js diff --git a/packages/react-error-overlay/flow/env.js b/packages/react-error-overlay/flow/env.js index dbcf689038f..12b151f5e4b 100644 --- a/packages/react-error-overlay/flow/env.js +++ b/packages/react-error-overlay/flow/env.js @@ -1,19 +1,19 @@ declare module 'anser' { - declare var exports: any; + declare module.exports: any; } declare module 'babel-code-frame' { - declare var exports: any; + declare module.exports: any; } declare module 'html-entities' { - declare var exports: any; + declare module.exports: any; } declare module 'settle-promise' { - declare var exports: any; + declare module.exports: any; } declare module 'source-map' { - declare var exports: any; + declare module.exports: any; } From a5d7b90e89f50811411ed92c9b48485e6f6a5bb7 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 12 Jan 2018 00:34:36 +0000 Subject: [PATCH 11/17] Try to skip Flow on AppVeyor --- tasks/e2e-simple.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 0b12be74dc4..4e15e8de382 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -107,7 +107,12 @@ npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_reg cd packages/react-error-overlay/ ./node_modules/.bin/eslint --max-warnings 0 src/ yarn test -yarn run flow + +if [ $APPVEYOR != 'True' ]; then + # Flow started hanging on AppVeyor after we moved to Yarn Workspaces :-( + yarn flow +fi + cd ../.. cd packages/react-dev-utils/ yarn test From ac267e786ceea9c11815a54d2ba981bc4603c5c1 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 12 Jan 2018 00:40:09 +0000 Subject: [PATCH 12/17] -df --- tasks/e2e-installs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/e2e-installs.sh b/tasks/e2e-installs.sh index 1f308a0fc4b..188b69f2e2e 100755 --- a/tasks/e2e-installs.sh +++ b/tasks/e2e-installs.sh @@ -99,7 +99,7 @@ yarn config set registry "$custom_registry_url" npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_registry_url" --quotes # Publish the monorepo -git clean -f +git clean -df yarn run publish --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest # ****************************************************************************** From 7f24b2ad1b5263a42c9c6e42c1b65ddb59b1d1eb Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 12 Jan 2018 00:40:25 +0000 Subject: [PATCH 13/17] -df --- tasks/e2e-kitchensink.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/e2e-kitchensink.sh b/tasks/e2e-kitchensink.sh index 758be4d249c..1e7bc94cea1 100755 --- a/tasks/e2e-kitchensink.sh +++ b/tasks/e2e-kitchensink.sh @@ -91,7 +91,7 @@ yarn config set registry "$custom_registry_url" npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_registry_url" --quotes # Publish the monorepo -git clean -f +git clean -df yarn run publish --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest # ****************************************************************************** From 8f233351e0de372bbd29bed2c80760efc63a5224 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 12 Jan 2018 00:40:43 +0000 Subject: [PATCH 14/17] -df --- tasks/e2e-simple.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 4e15e8de382..d32fa186f5a 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -140,7 +140,7 @@ CI=true yarn test # Test local start command yarn start --smoke-test -git clean -f +git clean -df yarn run publish --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest # ****************************************************************************** From aec37acf5f34c162753c006f972771c3728a2f5d Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 12 Jan 2018 00:50:16 +0000 Subject: [PATCH 15/17] Try to fix CI --- package.json | 2 +- tasks/publish.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 tasks/publish.sh diff --git a/package.json b/package.json index 768ad0ab6ae..15f463a10d5 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "e2e": "tasks/e2e-simple.sh", "e2e:docker": "tasks/local-test.sh", "postinstall": "cd packages/react-error-overlay/ && yarn build:prod", - "publish": "(git status --porcelain | grep -q ^ && echo '\nGit status is dirty.\n' && exit 1 || exit 0) && lerna publish --independent", + "publish": "tasks/publish.sh", "start": "cd packages/react-scripts && node scripts/start.js", "screencast": "svg-term --cast hItN7sl5yfCPTHxvFg5glhhfp --out screencast.svg --window", "test": "cd packages/react-scripts && node scripts/test.js --env=jsdom", diff --git a/tasks/publish.sh b/tasks/publish.sh new file mode 100755 index 00000000000..4336438fb99 --- /dev/null +++ b/tasks/publish.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright (c) 2015-present, Facebook, Inc. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +# ****************************************************************************** +# This releases an update to the `react-scripts` package. +# Don't use `npm publish` for it. +# Read the release instructions: +# https://github.com/facebookincubator/create-react-app/blob/master/CONTRIBUTING.md#cutting-a-release +# ****************************************************************************** + +# Start in tasks/ even if run from root directory +cd "$(dirname "$0")" + +# Exit the script on any command with non 0 return code +# We assume that all the commands in the pipeline set their return code +# properly and that we do not need to validate that the output is correct +set -e + +# Echo every command being executed +set -x + +# Go to root +cd .. +root_path=$PWD + +if [ -n "$(git status --porcelain)" ]; then + echo "Your git status is not clean. Aborting."; + exit 1; +fi + +cd "$root_path" +# Run postinstall +yarn +# Go! +./node_modules/.bin/lerna publish --independent "$@" \ No newline at end of file From 4a0c86cd9dc890645d8e437b0553618d598eda04 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 12 Jan 2018 00:56:47 +0000 Subject: [PATCH 16/17] Revert unrelated changes --- tasks/e2e-installs.sh | 2 +- tasks/e2e-kitchensink.sh | 2 +- tasks/e2e-simple.sh | 2 +- tasks/publish.sh | 7 ++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tasks/e2e-installs.sh b/tasks/e2e-installs.sh index 188b69f2e2e..bcd616f3601 100755 --- a/tasks/e2e-installs.sh +++ b/tasks/e2e-installs.sh @@ -100,7 +100,7 @@ npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_reg # Publish the monorepo git clean -df -yarn run publish --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest # ****************************************************************************** # Test --scripts-version with a version number diff --git a/tasks/e2e-kitchensink.sh b/tasks/e2e-kitchensink.sh index 1e7bc94cea1..d73c45ddbfa 100755 --- a/tasks/e2e-kitchensink.sh +++ b/tasks/e2e-kitchensink.sh @@ -92,7 +92,7 @@ npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_reg # Publish the monorepo git clean -df -yarn run publish --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest # ****************************************************************************** # Now that we have published them, create a clean app folder and install them. diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index d32fa186f5a..b566ae37a3d 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -141,7 +141,7 @@ CI=true yarn test yarn start --smoke-test git clean -df -yarn run publish --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest # ****************************************************************************** # Install react-scripts prerelease via create-react-app prerelease. diff --git a/tasks/publish.sh b/tasks/publish.sh index 4336438fb99..c1cae86c200 100755 --- a/tasks/publish.sh +++ b/tasks/publish.sh @@ -31,8 +31,9 @@ if [ -n "$(git status --porcelain)" ]; then exit 1; fi -cd "$root_path" -# Run postinstall -yarn +# Compile +cd packages/react-error-overlay/ +npm run build:prod +cd ../.. # Go! ./node_modules/.bin/lerna publish --independent "$@" \ No newline at end of file From 1075380367bc1b7b7b11dd2d050c9bcb0b2c75ea Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 12 Jan 2018 01:54:11 +0000 Subject: [PATCH 17/17] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d64757f0a02..62908c39b6b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,7 +75,7 @@ All functionality must be retained (and configuration given to the user) if they 1. Clone the repo with `git clone https://github.com/facebookincubator/create-react-app` -2. Run `yarn --no-lockfile` in the root `create-react-app` folder. +2. Run `yarn` in the root `create-react-app` folder. Once it is done, you can modify any file locally and run `yarn start`, `yarn test` or `yarn build` just like in a generated project.