diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9d24774a4..2366e36fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,12 +20,26 @@ Repository is splitted into two packages: ## Testing your changes -You can test your changes by calling `cli.js` directly from the cloned repository. You need to make sure the version of React Native matches the one present in devDependencies of the CLI. Otherwise, you may get unexpected errors. +> Please make sure the version of React Native matches the one present in devDependencies of the CLI. Otherwise, you may get unexpected errors. + +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: ```sh -node /path/to/cloned/project/packages/cli/build/index.js +cd /path/to/cloned/project/ +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-types" "@react-native-community/cli-tools" + +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`. + ## Testing `init` command You can test your changes by installing local npm proxy - `verdaccio`, and publishing custom versions of `@react-native-community/cli` and `react-native`. diff --git a/README.md b/README.md index 2e29c9a9c..e9fd79660 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ _Note: CLI has been extracted from core `react-native` as a part of "[Lean Core] - [Using global CLI (_legacy_)](#using-global-cli-legacy) - [Usage in an existing React Native project](#usage-in-an-existing-react-native-project) - [Updating the CLI](#updating-the-cli) +- [Contributing](./CONTRIBUTING.md) - [Maintainers](#maintainers) - [License](#license) diff --git a/package.json b/package.json index 11c3597cb..2380a82b4 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "lint": "eslint --ext .js,.ts . --cache --report-unused-disable-directives", "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", "publish": "yarn build-clean-all && yarn install && lerna publish" }, "dependencies": {