-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 31f80cd
Showing
15 changed files
with
10,031 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = crlf | ||
charset = utf-8 | ||
|
||
[{src,scripts}/**.{ts,json,js,tsx}] | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Example Contributing Guidelines | ||
|
||
This is an example of GitHub's contributing guidelines file. Check out GitHub's [CONTRIBUTING.md help center article](https://help.github.com/articles/setting-guidelines-for-repository-contributors/) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
* **I'm submitting a ...** | ||
[ ] bug report | ||
[ ] feature request | ||
[ ] question about the decisions made in the repository | ||
[ ] question about how to use this project | ||
|
||
* **Summary** | ||
|
||
|
||
|
||
* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
* **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) | ||
|
||
|
||
|
||
* **What is the current behavior?** (You can also link to an open issue here) | ||
|
||
|
||
|
||
* **What is the new behavior (if this is a feature change)?** | ||
|
||
|
||
|
||
* **Other information**: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
node_modules | ||
build | ||
test | ||
src/**.js | ||
.idea/* | ||
|
||
coverage | ||
.nyc_output | ||
*.log | ||
|
||
yarn.lock | ||
|
||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
src | ||
test | ||
tsconfig.json | ||
tsconfig.module.json | ||
tslint.json | ||
.travis.yml | ||
.github | ||
.prettierignore | ||
.vscode | ||
build/docs | ||
**/*.spec.* | ||
coverage | ||
.nyc_output | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# package.json is formatted by package managers, so we ignore it here | ||
package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Flávio Lisbôa | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# react-native-monorepo-helper | ||
|
||
A helper library that makes React Native development in monorepo projects easier. | ||
|
||
If you're having problems with Metro/Haste not finding your files and/or | ||
dependencies, or that your `nohoist` config is becoming a bit unwieldly, | ||
this tool can help you out! It'll provide a `CustomResolver` and setup | ||
project roots and watch folders for your `rn-cli.config.js`. TypeScript | ||
configuration automation is also optionally provided. | ||
|
||
P.S.: The tool itself is developed in TypeScript, so no need for a `@types` | ||
package, fellow TypeScript programmers! :) | ||
|
||
|
||
## Installation | ||
|
||
For NPM users: | ||
|
||
```sh | ||
npm install --save-dev react-native-monorepo-helper | ||
``` | ||
|
||
For Yarn users: | ||
|
||
```sh | ||
yarn add --dev react-native-monorepo-helper | ||
``` | ||
|
||
## Usage | ||
|
||
Considering a project with a structure similar to the following: | ||
|
||
``` | ||
myproj/ | ||
├── package.json | ||
├── node_modules/ | ||
└── packages/ | ||
├── myproj-react-native-app/ | ||
├── node_modules/ | ||
│ ├── android/ | ||
│ ├── ios/ | ||
│ ├── index.js | ||
│ ├── package.json | ||
│ └── rn-cli.config.js | ||
└── myproj-lib | ||
├── index.js | ||
└── package.json | ||
``` | ||
|
||
First, be sure to `nohoist` React Native and any dependency that needs to be | ||
`react-native link`ed. You can either use Lerna or Yarn Workspaces to configure | ||
your monorepo project. | ||
|
||
In your `rn-cli.config.js`: | ||
|
||
```js | ||
const projectRoot = __dirname; | ||
const metroConfig = require('react-native-monorepo-helper').default; | ||
|
||
module.exports = metroConfig(projectRoot); | ||
``` | ||
|
||
Optionally, you can use a configuration helper, and tweak the options for your | ||
needs, e.g. setting up TypeScript: | ||
|
||
```js | ||
const projectRoot = __dirname; | ||
const metroConfigHelper = require('react-native-monorepo-helper') | ||
.metroConfigHelper; | ||
|
||
module.exports = metroConfigHelper(projectRoot) | ||
.typeScript(true) | ||
.watchFolder("external/folder/a", "external/folder/b") | ||
.defaultConfig({ | ||
// Documentation: https://facebook.github.io/metro/docs/en/configuration | ||
port: 9091 | ||
}) | ||
.generate(); | ||
``` | ||
|
||
|
||
## License | ||
|
||
MIT. |
Oops, something went wrong.