@gfean/react-native-bundle-drop 0.1.37 → 0.1.38
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/lib/CLI/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const commander_1 = require("commander");
|
|
9
9
|
const figures_1 = __importDefault(require("figures"));
|
|
10
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
10
11
|
const upload_cli_1 = __importDefault(require("./scripts/upload-cli"));
|
|
11
12
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
12
13
|
const program = new commander_1.Command();
|
|
@@ -68,7 +69,7 @@ program
|
|
|
68
69
|
program
|
|
69
70
|
.command('init')
|
|
70
71
|
.description('Generate bundle.drop.config.js from your logged-in account context')
|
|
71
|
-
.action(() => {
|
|
72
|
+
.action(async () => {
|
|
72
73
|
//eslint-disable-next-line
|
|
73
74
|
const fs = require('fs');
|
|
74
75
|
//eslint-disable-next-line
|
|
@@ -91,6 +92,39 @@ program
|
|
|
91
92
|
organizations,
|
|
92
93
|
downloadApiKey,
|
|
93
94
|
});
|
|
95
|
+
// Offer to set up Metro alias for bundle.drop.config.js resolution
|
|
96
|
+
const { runMetro } = await (0, prompts_1.default)({
|
|
97
|
+
type: 'confirm',
|
|
98
|
+
name: 'runMetro',
|
|
99
|
+
message: 'Also add the Metro alias for bundle.drop.config.js (recommended)?',
|
|
100
|
+
initial: true,
|
|
101
|
+
});
|
|
102
|
+
if (runMetro) {
|
|
103
|
+
try {
|
|
104
|
+
//eslint-disable-next-line
|
|
105
|
+
await require('../CLI/scripts/init-metro-config').initMetroConfig();
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
console.log(`⚠️ Failed to initialize Metro config; please refer to manual setup instructions. (${err?.message || err})`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Offer to patch native entrypoints
|
|
112
|
+
const { runNative } = await (0, prompts_1.default)({
|
|
113
|
+
type: 'confirm',
|
|
114
|
+
name: 'runNative',
|
|
115
|
+
message: 'Patch native entrypoints (MainApplication/AppDelegate) to prefer OTA? (Standard RN setups only)',
|
|
116
|
+
initial: false,
|
|
117
|
+
});
|
|
118
|
+
if (runNative) {
|
|
119
|
+
try {
|
|
120
|
+
//eslint-disable-next-line
|
|
121
|
+
await require('../CLI/scripts/init-native-config').initNativeConfig();
|
|
122
|
+
console.log('⚠️ Please double-check the native changes in MainApplication/AppDelegate.');
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
console.log(`⚠️ Failed to initialize native config; please refer to manual setup instructions. (${err?.message || err})`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
94
128
|
});
|
|
95
129
|
program
|
|
96
130
|
.command('init-native')
|
|
@@ -56,7 +56,7 @@ function patchAndroidMainApplication(filePath) {
|
|
|
56
56
|
}
|
|
57
57
|
content = content.replace(methodRegex, match => {
|
|
58
58
|
return (match +
|
|
59
|
-
` val bundlePath = BundleDropModule.getDownloadedBundlePath(
|
|
59
|
+
` val bundlePath = BundleDropModule.getDownloadedBundlePath(application)\n` +
|
|
60
60
|
` if (bundlePath != null) {\n` +
|
|
61
61
|
` return bundlePath\n` +
|
|
62
62
|
` }\n`);
|