Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Yarn Workspaces #3755

Merged
merged 18 commits into from
Jan 12, 2018
Merged
18 changes: 8 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

@Timer Timer Jan 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we made a .yarnrc with:

--install.no-lockfile true

This would keep things simple.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this file present we can now probably edit this command to be just yarn.


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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: drop the run

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

Expand All @@ -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

Expand All @@ -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`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: drop the run

* 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.

Expand Down
67 changes: 0 additions & 67 deletions bootstrap.js

This file was deleted.

9 changes: 4 additions & 5 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"lerna": "2.0.0",
"lerna": "2.6.0",
"npmClient": "yarn",
"useWorkspaces": true,
"version": "independent",
"changelog": {
"repo": "facebookincubator/create-react-app",
Expand All @@ -12,8 +14,5 @@
"tag: internal": ":house: Internal"
},
"cacheDir": ".changelog"
},
"packages": [
"packages/*"
]
}
}
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change in this PR? Do workspaces have an issue with working directories?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember. I think it might not be related to YW but to Yarn in general (which sets cwd to the project you run the script in).

"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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really like to see the git status --porcelain check back in here somehow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any ideas? I want to lose that file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(git status --porcelain | grep -q ^ && echo "Your git status is not clean. Aborting." && 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": "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",
Expand Down
46 changes: 0 additions & 46 deletions tasks/release.sh

This file was deleted.