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

Add linkage instructions for yarn v2 #1237

Merged
merged 2 commits into from
Aug 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ Repository is splitted into two packages:

Because of a modular design of the CLI, we recommend developing using symbolic links to its packages. This way you can use it seamlessly in the tested project, as you'd use the locally installed CLI. Here's what you need to run in the terminal:

If you use `yarn` v1, run
```sh
cd /path/to/cloned/cli/
yarn link-packages
```

And then:

```sh
cd /my/new/react-native/project/
yarn link "@react-native-community/cli-platform-ios" "@react-native-community/cli-platform-android" "@react-native-community/cli" "@react-native-community/cli-server-api" "@react-native-community/cli-types" "@react-native-community/cli-tools" "@react-native-community/cli-debugger-ui"
Expand All @@ -39,9 +38,20 @@ npx react-native start --watchFolders /path/to/cloned/cli/
npx react-native run-android
```

Once you're done with testing and you'd like to get back to regular setup, run `yarn unlink` instead of `yarn link` from above command. Then `yarn install --force`.

If you use `yarn` v2, run
```sh
cd /my/new/react-native/project/
yarn link /path/to/cloned/cli/ --all

npx react-native start --watchFolders /path/to/cloned/cli/
npx react-native run-android
SConaway marked this conversation as resolved.
Show resolved Hide resolved
```
When you'd like to revert to a regular setup, you will need to revert the changes made to the `resolutions` field of `package.json`.

_Note: you must use the `--watchFolders` flag with the `start` command when testing the CLI with `yarn link` like this. Otherwise Metro can't find the symlinked folder and this may result in errors such as `ReferenceError: SHA-1 for file ... is not computed`._

Once you're done with testing and you'd like to get back to regular setup, run `yarn unlink` instead of `yarn link` from above command. Then `yarn install --force`.

## Testing `init` command

Expand Down