Skip to content

Commit 768b19f

Browse files
authored
Alternative git-monorepo-usage-trick (#532)
* Alternative git-monorepo-usage-trick Closes #358 * fix
1 parent 3b4a55e commit 768b19f

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ If you use this bindings from the git repo, be sure to use
3737
// and will just need to be removed when you won't use git directly anymore
3838
"js-post-build": {
3939
"cmd": "./node_modules/bs-react-native-monorepo/git-monorepo-usage-trick"
40+
// if this tricky script doesn't work for you correctly, try
41+
// "cmd": "./node_modules/bs-react-native-monorepo/git-monorepo-usage-trick-node"
4042
}
4143
}
4244
```

‎git-monorepo-usage-trick-node‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env node
2+
3+
// alt version of the bash script
4+
5+
const fs = require("fs");
6+
const file = process.argv[2];
7+
const guts = fs
8+
.readFileSync(file)
9+
.toString()
10+
.replace(
11+
/require\(\"bs-react-native\//g,
12+
'require("bs-react-native-monorepo/bs-react-native/',
13+
)
14+
.replace(
15+
/from \"bs-react-native\//g,
16+
'from "bs-react-native-monorepo/bs-react-native/',
17+
)
18+
.replace(
19+
/require\(\"bs-react-native-jsx3-compat\//g,
20+
'require("bs-react-native-monorepo/bs-react-native-jsx3-compat/',
21+
)
22+
.replace(
23+
/from \"bs-react-native-jsx3-compat\//g,
24+
'from "bs-react-native-monorepo/bs-react-native-jsx3-compat/',
25+
)
26+
.replace(
27+
/require\(\"reason-react-native\//g,
28+
'require("bs-react-native-monorepo/reason-react-native/',
29+
)
30+
.replace(
31+
/from \"reason-react-native\//g,
32+
'from "bs-react-native-monorepo/reason-react-native/',
33+
);
34+
fs.writeFileSync(file, guts);

0 commit comments

Comments
 (0)