Skip to content

Conversation

@adrienthiery
Copy link
Contributor

Summary:

I had a little bit of a hard time testing my changes, because I didn't have the reflex to look for the CONTRIBUTING.md file.
Also, not sure why, but the method described to test your changes directly does not seem to work for me, nothing happens, so I added the way to test it using yarn link

Test Plan:

This is documentation only :)

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Thank you for your efforts, this is much appreciated! If running the CLI directly doesn't work (I remember using it for init, which doesn't interoperate with platform-related packages), maybe we should remove it, or only show it for init?

yarn link "@react-native-community/cli-platform-android"

npx react-native run-android
```
Copy link
Member

Choose a reason for hiding this comment

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

You can see this gets pretty complicated and only affects a single package. We need an npm-script that would cd to every package and run yarn link there, so that folks can then run:

yarn link @react-native-community/cli-tools @react-native-community/cli-platform-ios  @react-native-community/cli-platform-android @react-native-community/cli @react-native-community/cli-types

Then we could write something like:

Using yarn link

CLI is a monorepo with multiple packages interacting with each-other. In order to effortlessly test your changes you'll need to "link" them using yarn link for every package. You can do so with this command:

yarn link-packages

And then, in your test project, run:

yarn link @react-native-community/cli-tools @react-native-community/cli-platform-ios  @react-native-community/cli-platform-android @react-native-community/cli @react-native-community/cli-types

From now on, your test project will transparently use the CLI from symlinked packages.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I remember running into it when I did link/cli and ended up not seeing my Android changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll work on that !

CONTRIBUTING.md Outdated

## Testing your changes

### Directly
Copy link
Member

Choose a reason for hiding this comment

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

I would get rid of this setup entirely. I think it's potentially confusing. When you run the CLI directly from a different folder, you're still going to be loading "platform-android" and "platform-ios" packages from the "node_modules" of your project.

This is because CLI itself doesn't load Android/iOS specific commands anymore. It finds React Native dependency and that's the package that depends on cli-platform-android and cli-platform-ios.

So in order to see your changes in these two, you'd have to link them anyway.

Copy link
Member

Choose a reason for hiding this comment

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

(writing as I've run into this issue myself right now haha)

Copy link
Member

Choose a reason for hiding this comment

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

Yes please. I think it only makes sense for detached commands like init

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I'll remove this part then :)

@adrienthiery adrienthiery force-pushed the documentation/update-contributing-section branch from 55847d5 to 75b228f Compare October 19, 2019 19:41
@adrienthiery
Copy link
Contributor Author

Updated the PR!

package.json Outdated
"test:ci:cocoapods": "ruby packages/platform-ios/native_modules.rb",
"postinstall": "yarn build",
"link-packages": "PACKAGES=('tools' 'platform-ios' 'platform-android' 'cli' 'cli-types' 'global-cli') && cd packages && for PACKAGE in \"${PACKAGES[@]}\"; do cd $PACKAGE && yarn link && cd ..; done",
"unlink-packages": "PACKAGES=('tools' 'platform-ios' 'platform-android' 'cli' 'cli-types' 'global-cli') && cd packages && for PACKAGE in \"${PACKAGES[@]}\"; do cd $PACKAGE && yarn unlink && cd ..; done",
Copy link
Member

Choose a reason for hiding this comment

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

I don't see this necessary. yarn link only marks a dependency as "linkable", no need to unlink these. Also, please remove global-cli here and in link-packages, we don't want anybody to touch it for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could be useful in a very few cases where you have several clone of the cli on your machine? 😅 Ok, very small chance.
Do you still want me to remove it? 🙂

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Almost there :)

adrienthiery and others added 3 commits October 22, 2019 10:04
Co-Authored-By: Michał Pierzchała <thymikee@gmail.com>
Co-Authored-By: Michał Pierzchała <thymikee@gmail.com>
@thymikee thymikee merged commit 0d77e98 into react-native-community:master Oct 24, 2019
@adrienthiery adrienthiery deleted the documentation/update-contributing-section branch October 24, 2019 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants