@gfean/react-native-bundle-drop 0.1.34 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLIENT_README.md +22 -0
- package/README.md +22 -0
- package/lib/loadConfig.js +5 -7
- package/package.json +1 -1
package/CLIENT_README.md
CHANGED
|
@@ -8,6 +8,28 @@ yarn add @gfean/react-native-bundle-drop
|
|
|
8
8
|
cd ios && pod install && cd ..
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Add the Android bootstrap side-effect import (resolver patches):
|
|
12
|
+
```js
|
|
13
|
+
// index.js (entry)
|
|
14
|
+
import '@gfean/react-native-bundle-drop/bootstrap';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Metro config (resolve bundle.drop.config.js from node_modules)
|
|
18
|
+
If Metro can’t find `bundle.drop.config.js` when a package requires it, add an alias:
|
|
19
|
+
```js
|
|
20
|
+
// metro.config.js
|
|
21
|
+
const path = require('path');
|
|
22
|
+
|
|
23
|
+
module.exports = {
|
|
24
|
+
resolver: {
|
|
25
|
+
extraNodeModules: {
|
|
26
|
+
// Lets packages do: require('bundle-drop-config')
|
|
27
|
+
'bundle-drop-config': path.resolve(__dirname, 'bundle.drop.config.js'),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
11
33
|
## 2) App config
|
|
12
34
|
Add `bundle.drop.config.js` to your project root:
|
|
13
35
|
```js
|
package/README.md
CHANGED
|
@@ -8,6 +8,28 @@ yarn add @gfean/react-native-bundle-drop
|
|
|
8
8
|
cd ios && pod install && cd ..
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Add the Android bootstrap side-effect import once (images resolver patch):
|
|
12
|
+
```js
|
|
13
|
+
// index.js (or entry file)
|
|
14
|
+
import '@gfean/react-native-bundle-drop/bootstrap';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Metro config (to resolve bundle.drop.config.js from node_modules)
|
|
18
|
+
If Metro cannot resolve `bundle.drop.config.js` from within `node_modules`, add an alias in `metro.config.js`:
|
|
19
|
+
```js
|
|
20
|
+
// metro.config.js
|
|
21
|
+
const path = require('path');
|
|
22
|
+
|
|
23
|
+
module.exports = {
|
|
24
|
+
resolver: {
|
|
25
|
+
extraNodeModules: {
|
|
26
|
+
// Allows packages to do: require('bundle-drop-config')
|
|
27
|
+
'bundle-drop-config': path.resolve(__dirname, 'bundle.drop.config.js'),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
11
33
|
## Prerequisites
|
|
12
34
|
- `bundle.drop.config.js` in your app root:
|
|
13
35
|
```js
|
package/lib/loadConfig.js
CHANGED
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadConfig = loadConfig;
|
|
4
4
|
const react_native_1 = require("react-native");
|
|
5
|
-
// Simpler, fixed path load to match the prior behavior.
|
|
6
5
|
function loadConfig() {
|
|
7
6
|
try {
|
|
8
|
-
//
|
|
9
|
-
|
|
7
|
+
// ✅ Resolved via Metro alias in the host app (extraNodeModules)
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
9
|
+
const cfg = require('bundle-drop-config');
|
|
10
10
|
if (!cfg?.serverUrl || !cfg?.project?.slug || !cfg?.org?.slug) {
|
|
11
11
|
throw new Error('bundle.drop.config.js missing serverUrl, org.slug or project.slug');
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
if (debugLocal) {
|
|
13
|
+
if (cfg.debugLocal === true) {
|
|
15
14
|
return {
|
|
16
15
|
...cfg,
|
|
17
16
|
serverUrl: react_native_1.Platform.OS === 'android' ? 'http://10.0.2.2:4000' : 'http://localhost:4000',
|
|
@@ -21,8 +20,7 @@ function loadConfig() {
|
|
|
21
20
|
return cfg;
|
|
22
21
|
}
|
|
23
22
|
catch (e) {
|
|
24
|
-
console.log(e);
|
|
25
|
-
// In production this should fail fast; for now return localhost defaults.
|
|
23
|
+
console.log('[BundleDrop] loadConfig failed:', e);
|
|
26
24
|
return {
|
|
27
25
|
serverUrl: 'http://localhost:4000',
|
|
28
26
|
org: { slug: 'default-org' },
|