Skip to content

Commit 3da01bd

Browse files
committed
README: Update "Usage from Git repo"
1 parent 3e4a914 commit 3da01bd

File tree

3 files changed

+31
-84
lines changed

3 files changed

+31
-84
lines changed

README.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
**🎟 [Reason Conf US](https://www.reason-conf.us) is happening October 7-8th in Chicago 🎉**
2-
Buy tickets or sponsor the event by visiting [https://www.reason-conf.us](https://www.reason-conf.us)
1+
#### 🎟 [Reason Conf US](https://www.reason-conf.us) is happening October 7-8th in Chicago 🎉
2+
3+
Buy tickets or sponsor the event by visiting
4+
[https://www.reason-conf.us](https://www.reason-conf.us)
35

46
---
57

@@ -44,27 +46,36 @@ so that you can understand what actions will and will not be tolerated.
4446

4547
## 🚨 Usage from Git repo
4648

47-
If you use this bindings from the git repo, be sure to use
49+
If you use things unreleased from the git repo, you will need to link all
50+
folders (packages) that you need at the root of node_modules. The easiest way is
51+
to create the symlink you need in your `package.json` `prepare` step:
52+
53+
First add this repo as a dep
54+
55+
```console
56+
yarn add https://github.com/reasonml-community/reason-react-native
57+
```
58+
59+
Next, add this cross-platform symlink tool
60+
61+
```console
62+
yarn add --dev symlink-dir
63+
```
64+
65+
Then add to you `package.json`
4866

4967
```js
5068
{
51-
// ...
52-
"bs-dependencies": [
53-
// bs-react-native, but compatible with jsx3
54-
"reason-react-native-monorepo/bs-react-native-jsx3-compat",
55-
// new ReactNative, WIP on zero-cost bindings
56-
"reason-react-native-monorepo/reason-react-native"
57-
},
58-
// When used from git with the following path, bs-platform will use path that won't be working
59-
// (because deps are pointing to folder in folder)`
60-
// Your bundler (metro or webpack) will say that it can find and/or `reason-react-native/whatever`
61-
// which is correct because it should be `reason-react-native-monorepo/reason-react-native/whatever`
62-
// the trick below will correct path in generated JavaScript files
63-
// and will just need to be removed when you won't use git directly anymore
64-
"js-post-build": {
65-
"cmd": "./node_modules/reason-react-native-monorepo/git-monorepo-usage-trick"
66-
// if this tricky script doesn't work for you correctly, try
67-
// "cmd": "./node_modules/reason-react-native-monorepo/git-monorepo-usage-trick-node"
69+
"scripts": {
70+
"reason-react-native-monorepo-trick": "symlink-dir ./node_modules/reason-react-native-monorepo/reason-react-native node_modules/reason-react-native && symlink-dir ./node_modules/reason-react-native-monorepo/bs-react-native-jsx3-compat node_modules/bs-react-native-jsx3-compat",
71+
"prepare": "yarn reason-react-native-monorepo-trick"
6872
}
6973
}
7074
```
75+
76+
⚠️ In the example above, we only linked `reason-react-native` and
77+
`bs-react-native-jsx3-compat`. Be sure to link all the package you have in your
78+
`bsconfig.json` that need to be used from git.
79+
80+
👀 If you find a trick more easy to read/maintain (and still cross-platform),
81+
please share it with us via Discord, an issue, or a PR!

git-monorepo-usage-trick

Lines changed: 0 additions & 22 deletions
This file was deleted.

git-monorepo-usage-trick-node

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)