@upfluxhq/cli 0.1.0-beta.5 → 1.0.1
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/dist/commands/release.js +38 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/commands/release.js
CHANGED
|
@@ -271,9 +271,46 @@ function writeUpfluxConfig(outputDir, releaseLabel, appId) {
|
|
|
271
271
|
appId,
|
|
272
272
|
createdAt: new Date().toISOString(),
|
|
273
273
|
};
|
|
274
|
+
const configContent = JSON.stringify(config, null, 2);
|
|
274
275
|
const configPath = path.join(outputDir, "upflux.json");
|
|
275
|
-
fs.writeFileSync(configPath,
|
|
276
|
+
fs.writeFileSync(configPath, configContent);
|
|
276
277
|
console.log(chalk_1.default.gray(` Created upflux.json with version: ${releaseLabel}`));
|
|
278
|
+
// Also copy to native asset directories so the SDK can read the
|
|
279
|
+
// embedded version at runtime and skip unnecessary OTA downloads
|
|
280
|
+
copyUpfluxConfigToNativeAssets(configContent);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Copy upflux.json to native platform asset directories
|
|
284
|
+
*
|
|
285
|
+
* The React Native SDK reads upflux.json from native assets at runtime to detect
|
|
286
|
+
* which OTA version is embedded in the binary. Without this file in the right place,
|
|
287
|
+
* the SDK cannot compare embedded vs server versions, causing unnecessary downloads
|
|
288
|
+
* even when the Play Store / App Store binary already has the latest code.
|
|
289
|
+
*
|
|
290
|
+
* Android: android/app/src/main/assets/upflux.json
|
|
291
|
+
* iOS: ios/ (added to Xcode project bundle resources manually by developer)
|
|
292
|
+
*
|
|
293
|
+
* @param configContent - The JSON string content of upflux.json
|
|
294
|
+
*/
|
|
295
|
+
function copyUpfluxConfigToNativeAssets(configContent) {
|
|
296
|
+
// Android: copy to assets directory where UpfluxModule.readAsset() can find it
|
|
297
|
+
const androidAssetsDir = path.resolve("android", "app", "src", "main", "assets");
|
|
298
|
+
if (fs.existsSync(path.resolve("android"))) {
|
|
299
|
+
// Ensure assets directory exists
|
|
300
|
+
if (!fs.existsSync(androidAssetsDir)) {
|
|
301
|
+
fs.mkdirSync(androidAssetsDir, { recursive: true });
|
|
302
|
+
}
|
|
303
|
+
const androidConfigPath = path.join(androidAssetsDir, "upflux.json");
|
|
304
|
+
fs.writeFileSync(androidConfigPath, configContent);
|
|
305
|
+
console.log(chalk_1.default.gray(` Copied upflux.json → android/app/src/main/assets/`));
|
|
306
|
+
}
|
|
307
|
+
// iOS: copy to ios/ project root (developer adds to Xcode bundle resources)
|
|
308
|
+
const iosDir = path.resolve("ios");
|
|
309
|
+
if (fs.existsSync(iosDir)) {
|
|
310
|
+
const iosConfigPath = path.join(iosDir, "upflux.json");
|
|
311
|
+
fs.writeFileSync(iosConfigPath, configContent);
|
|
312
|
+
console.log(chalk_1.default.gray(` Copied upflux.json → ios/`));
|
|
313
|
+
}
|
|
277
314
|
}
|
|
278
315
|
const release = new commander_1.Command("release")
|
|
279
316
|
.description("Bundle and upload a new release to Upflux")
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ const program = new commander_1.Command();
|
|
|
14
14
|
program
|
|
15
15
|
.name("upflux")
|
|
16
16
|
.description("Upflux CLI for OTA updates")
|
|
17
|
-
.version("
|
|
17
|
+
.version("1.0.0");
|
|
18
18
|
program.addCommand(login_1.default);
|
|
19
19
|
program.addCommand(logout_1.default);
|
|
20
20
|
program.addCommand(release_1.default);
|