@gfean/react-native-bundle-drop 0.9.0 → 0.10.0
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/README.md +17 -0
- package/lib/CLI/cli.js +3 -0
- package/lib/CLI/scripts/upload-cli.d.ts +2 -0
- package/lib/CLI/scripts/upload-cli.js +204 -107
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -678,6 +678,23 @@ npx bundle-drop upload ios --plist-file ios/Info.plist --channel develop
|
|
|
678
678
|
Add `--sourcemap` to produce source maps for error tracking. In CI/CD, pass a
|
|
679
679
|
Personal Access Token with `--token <PAT>` instead of using an interactive login.
|
|
680
680
|
|
|
681
|
+
To attach multiline Markdown release notes, save them in a file and pass its path
|
|
682
|
+
relative to the project directory:
|
|
683
|
+
|
|
684
|
+
```bash
|
|
685
|
+
npx bundle-drop upload android --channel develop --release-notes-file ./release-notes.md
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
`--release-notes "<text>"` remains available for inline notes. Use only one notes
|
|
689
|
+
option per upload. Notes longer than 2,000 characters are truncated with a
|
|
690
|
+
warning. After a successful upload, the CLI prints the bundle identity, ZIP size,
|
|
691
|
+
source-map and retained-artifact status, bundling/packaging and upload timings,
|
|
692
|
+
and a project dashboard link for the exact production or staging API. Custom
|
|
693
|
+
servers show the dashboard as unavailable; the CLI has no verified dashboard
|
|
694
|
+
origin for them.
|
|
695
|
+
The summary confirms the upload; channel publishing and rollout still control
|
|
696
|
+
delivery.
|
|
697
|
+
|
|
681
698
|
## Update Policies
|
|
682
699
|
|
|
683
700
|
`policy` controls what happens after Bundle Drop hydrates its local state on startup:
|
package/lib/CLI/cli.js
CHANGED
|
@@ -117,6 +117,7 @@ ${chalk_1.default.bold.cyan('Common Usage:')}
|
|
|
117
117
|
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel develop')}
|
|
118
118
|
${chalk_1.default.gray('bundle-drop upload ios --plist-file ios/Info.plist --channel develop')}
|
|
119
119
|
${chalk_1.default.gray('bundle-drop upload android --buildgradle-path android/app/build.gradle --channel develop --release-notes "Fixes"')}
|
|
120
|
+
${chalk_1.default.gray('bundle-drop upload android --channel develop --release-notes-file ./release-notes.md')}
|
|
120
121
|
|
|
121
122
|
${chalk_1.default.gray('Docs →')} ${chalk_1.default.underline.gray(DOCS_CLI_URL)}
|
|
122
123
|
${chalk_1.default.gray('Uploading →')} ${chalk_1.default.underline.gray(DOCS_UPLOADING_URL)}
|
|
@@ -152,6 +153,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
152
153
|
.option('--buildgradle-path <path>', 'Optional Android build.gradle path to read versionName')
|
|
153
154
|
.option('--channel <name>', 'Target channel name to associate the bundle')
|
|
154
155
|
.option('--release-notes <text>', 'Release notes (max 2000 chars)')
|
|
156
|
+
.option('--release-notes-file <path>', 'Read UTF-8 release notes from a file (max 2000 chars)')
|
|
155
157
|
.option('--token <token>', 'Personal Access Token (alternative to `bundle-drop login`)')
|
|
156
158
|
.option('--author <name>', 'Override the author name stored with the bundle')
|
|
157
159
|
.option('--sourcemap', 'Generate source maps alongside the bundle for error tracking')
|
|
@@ -163,6 +165,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
163
165
|
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel develop')}
|
|
164
166
|
${chalk_1.default.gray('bundle-drop upload ios --plist-file ios/Info.plist --channel develop')}
|
|
165
167
|
${chalk_1.default.gray('bundle-drop upload android --buildgradle-path android/app/build.gradle --channel beta --release-notes "Bug fixes"')}
|
|
168
|
+
${chalk_1.default.gray('bundle-drop upload android --channel develop --release-notes-file ./release-notes.md')}
|
|
166
169
|
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel develop --token bdp_pat_xxx')}
|
|
167
170
|
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel develop --sourcemap --artifact-dir ./build/bundledrop')}
|
|
168
171
|
|
|
@@ -6,6 +6,7 @@ type UploadOptions = {
|
|
|
6
6
|
channel?: string;
|
|
7
7
|
buildGradlePath?: string;
|
|
8
8
|
releaseNotes?: string;
|
|
9
|
+
releaseNotesFile?: string;
|
|
9
10
|
token?: string;
|
|
10
11
|
author?: string;
|
|
11
12
|
sourcemap?: boolean;
|
|
@@ -16,6 +17,7 @@ type UploadDependencies = {
|
|
|
16
17
|
packageRoot: string;
|
|
17
18
|
spawnProcess: typeof spawnSync;
|
|
18
19
|
resolveModule: ModuleResolver;
|
|
20
|
+
nowMs?: () => number;
|
|
19
21
|
};
|
|
20
22
|
export declare function runUpload(platform: string, options: UploadOptions, dependencies?: UploadDependencies): Promise<void>;
|
|
21
23
|
export default function upload(platform: string, options: UploadOptions): Promise<void>;
|
|
@@ -43,6 +43,8 @@ const child_process_1 = require("child_process");
|
|
|
43
43
|
const form_data_1 = __importDefault(require("form-data"));
|
|
44
44
|
const fs = __importStar(require("fs"));
|
|
45
45
|
const path = __importStar(require("path"));
|
|
46
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
47
|
+
const logo_1 = require("../logo");
|
|
46
48
|
const ui_1 = require("../utils/ui");
|
|
47
49
|
const read_xml_plist_1 = require("../utils/read-xml-plist");
|
|
48
50
|
const resolve_ios_version_1 = require("../../scripts/resolve-ios-version");
|
|
@@ -62,7 +64,37 @@ const defaultUploadDependencies = () => ({
|
|
|
62
64
|
packageRoot: path.resolve(__dirname, '..', '..', '..'),
|
|
63
65
|
spawnProcess: child_process_1.spawnSync,
|
|
64
66
|
resolveModule: resolveModule_1.resolveModuleFrom,
|
|
67
|
+
nowMs: () => perf_hooks_1.performance.now(),
|
|
65
68
|
});
|
|
69
|
+
const MAX_RELEASE_NOTES_LENGTH = 2000;
|
|
70
|
+
const STAGING_SERVER_URL = 'https://api-staging.bundledrop.app';
|
|
71
|
+
const dashboardProjectUrl = (serverUrl, orgSlug, projectSlug) => {
|
|
72
|
+
const projectPath = `/organizations/${encodeURIComponent(orgSlug)}/projects/${encodeURIComponent(projectSlug)}`;
|
|
73
|
+
const normalizedServerUrl = (0, serverUrl_1.normalizeServerUrl)(serverUrl);
|
|
74
|
+
if (normalizedServerUrl === serverUrl_1.DEFAULT_SERVER_URL) {
|
|
75
|
+
return `https://developer.bundledrop.app${projectPath}`;
|
|
76
|
+
}
|
|
77
|
+
if (normalizedServerUrl === STAGING_SERVER_URL) {
|
|
78
|
+
return `https://develop.bundle-drop-web.pages.dev${projectPath}`;
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
};
|
|
82
|
+
const elapsedMs = (startMs, endMs) => Math.round(endMs - startMs);
|
|
83
|
+
const formatSeconds = (milliseconds) => `${(milliseconds / 1000).toFixed(1)}s`;
|
|
84
|
+
const errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
85
|
+
const warnAfterUpload = (message) => {
|
|
86
|
+
try {
|
|
87
|
+
ui_1.log.warn(message);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
try {
|
|
91
|
+
process.stderr.write(`Warning: ${message}\n`);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Output is unavailable, but the server upload still succeeded.
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
66
98
|
const assertPathInside = (targetPath, parentPath, label) => {
|
|
67
99
|
const resolvedParent = path.resolve(parentPath);
|
|
68
100
|
const resolvedTarget = path.resolve(targetPath);
|
|
@@ -133,12 +165,67 @@ const bareArtifactPaths = (packageRoot, platform) => {
|
|
|
133
165
|
zipPath: path.join(outputDir, `bundle-${platform}.zip`),
|
|
134
166
|
};
|
|
135
167
|
};
|
|
168
|
+
const cleanupUploadArtifacts = (artifact, projectRoot, packageRoot, platform, isExpoProject) => {
|
|
169
|
+
const generatedRoot = isExpoProject
|
|
170
|
+
? path.join(projectRoot, '.bundle-drop', 'artifacts')
|
|
171
|
+
: path.join(packageRoot, 'dist');
|
|
172
|
+
assertPathInside(artifact.outputDir, generatedRoot, 'Artifact output');
|
|
173
|
+
const cleanupFiles = [
|
|
174
|
+
artifact.zipPath,
|
|
175
|
+
artifact.metadataPath,
|
|
176
|
+
artifact.manifestPath,
|
|
177
|
+
artifact.bundlePath,
|
|
178
|
+
artifact.sourceMapPath,
|
|
179
|
+
];
|
|
180
|
+
for (const file of cleanupFiles) {
|
|
181
|
+
if (!file)
|
|
182
|
+
continue;
|
|
183
|
+
assertPathInside(file, artifact.outputDir, 'Artifact file');
|
|
184
|
+
if (fs.existsSync(file))
|
|
185
|
+
fs.unlinkSync(file);
|
|
186
|
+
}
|
|
187
|
+
const assetsPath = path.join(artifact.outputDir, 'assets');
|
|
188
|
+
assertPathInside(assetsPath, artifact.outputDir, 'Artifact assets');
|
|
189
|
+
if (fs.existsSync(assetsPath))
|
|
190
|
+
fs.rmSync(assetsPath, { recursive: true, force: true });
|
|
191
|
+
const expoExportDirectory = artifact.expoExportDirectory ??
|
|
192
|
+
path.join(packageRoot, 'dist', `expo-export-${platform}`);
|
|
193
|
+
assertPathInside(expoExportDirectory, generatedRoot, 'Expo export');
|
|
194
|
+
if (fs.existsSync(expoExportDirectory)) {
|
|
195
|
+
fs.rmSync(expoExportDirectory, { recursive: true, force: true });
|
|
196
|
+
}
|
|
197
|
+
};
|
|
136
198
|
async function runUpload(platform, options, dependencies = defaultUploadDependencies()) {
|
|
199
|
+
const nowMs = dependencies.nowMs ?? (() => perf_hooks_1.performance.now());
|
|
200
|
+
const commandStartMs = nowMs();
|
|
137
201
|
console.log(); // blank line
|
|
138
202
|
ui_1.log.info('🚀 React Native OTA Upload Initialized');
|
|
139
203
|
const projectRoot = process.cwd();
|
|
140
204
|
const artifactDir = options.artifactDir ? path.resolve(options.artifactDir) : undefined;
|
|
141
205
|
prepareArtifactDirForRun(artifactDir);
|
|
206
|
+
if (options.releaseNotes !== undefined && options.releaseNotesFile !== undefined) {
|
|
207
|
+
ui_1.log.error('❌ Use either --release-notes or --release-notes-file, not both.');
|
|
208
|
+
process.exit(1);
|
|
209
|
+
}
|
|
210
|
+
let releaseNotes = options.releaseNotes;
|
|
211
|
+
if (options.releaseNotesFile !== undefined) {
|
|
212
|
+
const notesPath = path.resolve(projectRoot, options.releaseNotesFile);
|
|
213
|
+
try {
|
|
214
|
+
releaseNotes = fs.readFileSync(notesPath, 'utf8');
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
ui_1.log.error(`❌ Cannot read release notes file ${notesPath}: ${errorMessage(error)}`);
|
|
218
|
+
process.exit(1);
|
|
219
|
+
}
|
|
220
|
+
if (!releaseNotes?.trim()) {
|
|
221
|
+
ui_1.log.error(`❌ Release notes file is empty: ${notesPath}`);
|
|
222
|
+
process.exit(1);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (releaseNotes && releaseNotes.length > MAX_RELEASE_NOTES_LENGTH) {
|
|
226
|
+
ui_1.log.warn(`Release notes too long (${releaseNotes.length}); truncating to ${MAX_RELEASE_NOTES_LENGTH} chars.`);
|
|
227
|
+
releaseNotes = releaseNotes.slice(0, MAX_RELEASE_NOTES_LENGTH);
|
|
228
|
+
}
|
|
142
229
|
const configPath = path.resolve(projectRoot, 'bundle.drop.config.js');
|
|
143
230
|
//eslint-disable-next-line
|
|
144
231
|
const authPath = path.join(require('os').homedir(), '.bundle-drop', 'auth.json');
|
|
@@ -175,6 +262,7 @@ async function runUpload(platform, options, dependencies = defaultUploadDependen
|
|
|
175
262
|
ui_1.log.error(`❌ Missing "serverUrl", "org.slug" or "project.slug" in config\nSee ${DOCS_INSTALLATION_URL}`);
|
|
176
263
|
process.exit(1);
|
|
177
264
|
}
|
|
265
|
+
const dashboardUrl = dashboardProjectUrl(serverUrl, orgSlug, projectSlug);
|
|
178
266
|
// Resolve auth token: --token flag takes priority over auth.json
|
|
179
267
|
let token = options.token;
|
|
180
268
|
if (!token) {
|
|
@@ -218,12 +306,6 @@ async function runUpload(platform, options, dependencies = defaultUploadDependen
|
|
|
218
306
|
let version = options.version;
|
|
219
307
|
let expoBuildIdentity;
|
|
220
308
|
const buildGradlePath = options.buildGradlePath || options.buildgradlePath;
|
|
221
|
-
let releaseNotes = options.releaseNotes;
|
|
222
|
-
const MAX_NOTES = 2000;
|
|
223
|
-
if (releaseNotes && releaseNotes.length > MAX_NOTES) {
|
|
224
|
-
ui_1.log.warn(`Release notes too long (${releaseNotes.length}); truncating to ${MAX_NOTES} chars.`);
|
|
225
|
-
releaseNotes = releaseNotes.slice(0, MAX_NOTES);
|
|
226
|
-
}
|
|
227
309
|
const parseAndroidVersionFromGradle = (filePath) => {
|
|
228
310
|
if (!fs.existsSync(filePath)) {
|
|
229
311
|
ui_1.log.error(`❌ build.gradle not found at ${filePath}`);
|
|
@@ -312,7 +394,9 @@ async function runUpload(platform, options, dependencies = defaultUploadDependen
|
|
|
312
394
|
}
|
|
313
395
|
ui_1.log.label('App Version', version);
|
|
314
396
|
console.log();
|
|
397
|
+
console.log((0, logo_1.buildBundleDropLogo)());
|
|
315
398
|
ui_1.log.arrow(`Bundling ${platform} app...`);
|
|
399
|
+
const bundlingStartMs = nowMs();
|
|
316
400
|
const packageRoot = dependencies.packageRoot;
|
|
317
401
|
const packageVersion = readPackageVersion(packageRoot);
|
|
318
402
|
const compiledBundleScript = path.join(packageRoot, 'lib', 'scripts', 'bundle.js');
|
|
@@ -376,6 +460,8 @@ async function runUpload(platform, options, dependencies = defaultUploadDependen
|
|
|
376
460
|
ui_1.log.error(`❌ Bundle ZIP not found at: ${artifact.zipPath}`);
|
|
377
461
|
process.exit(1);
|
|
378
462
|
}
|
|
463
|
+
const zipSizeBytes = fs.statSync(artifact.zipPath).size;
|
|
464
|
+
const bundlingAndPackagingMs = elapsedMs(bundlingStartMs, nowMs());
|
|
379
465
|
// Build form data
|
|
380
466
|
const form = new form_data_1.default();
|
|
381
467
|
form.append('orgSlug', orgSlug);
|
|
@@ -395,7 +481,9 @@ async function runUpload(platform, options, dependencies = defaultUploadDependen
|
|
|
395
481
|
}
|
|
396
482
|
form.append('file', fs.createReadStream(artifact.zipPath));
|
|
397
483
|
const uploadLoader = (0, ui_1.startLoadingStatus)('Uploading bundle to server');
|
|
398
|
-
|
|
484
|
+
const uploadStartMs = nowMs();
|
|
485
|
+
let uploadMs = 0;
|
|
486
|
+
let responseData = {};
|
|
399
487
|
try {
|
|
400
488
|
const res = await axios_1.default.post(`${serverUrl}/bundle/upload`, form, {
|
|
401
489
|
headers: {
|
|
@@ -405,120 +493,129 @@ async function runUpload(platform, options, dependencies = defaultUploadDependen
|
|
|
405
493
|
maxContentLength: Infinity,
|
|
406
494
|
maxBodyLength: Infinity,
|
|
407
495
|
});
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
const result = {
|
|
411
|
-
platform,
|
|
412
|
-
appVersion: version,
|
|
413
|
-
channel,
|
|
414
|
-
orgSlug,
|
|
415
|
-
projectSlug,
|
|
416
|
-
runtimeVersion: res.data?.runtimeVersion ?? runtimeVersion ?? null,
|
|
417
|
-
packageVersion: res.data?.packageVersion ?? packageVersion ?? null,
|
|
418
|
-
bundleId: res.data?.bundleId ?? null,
|
|
419
|
-
bundleVersion: res.data?.bundleVersion ?? null,
|
|
420
|
-
bundleVersionLabel: res.data?.bundleVersionLabel ?? null,
|
|
421
|
-
hash: res.data?.hash ?? null,
|
|
422
|
-
releaseNotes: releaseNotes ?? null,
|
|
423
|
-
author: options.author ?? null,
|
|
424
|
-
};
|
|
425
|
-
if (artifactDir) {
|
|
426
|
-
try {
|
|
427
|
-
fs.mkdirSync(artifactDir, { recursive: true });
|
|
428
|
-
if (fs.existsSync(artifact.bundlePath)) {
|
|
429
|
-
fs.copyFileSync(artifact.bundlePath, path.join(artifactDir, 'main.jsbundle'));
|
|
430
|
-
result.bundlePath = path.join(artifactDir, 'main.jsbundle');
|
|
431
|
-
}
|
|
432
|
-
if (hasSourceMap && artifact.sourceMapPath) {
|
|
433
|
-
fs.copyFileSync(artifact.sourceMapPath, path.join(artifactDir, 'main.jsbundle.map'));
|
|
434
|
-
result.sourceMapPath = path.join(artifactDir, 'main.jsbundle.map');
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
catch (copyErr) {
|
|
438
|
-
ui_1.log.warn(`Upload succeeded but artifact copy failed: ${copyErr.message}`);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
uploadLoader.stop();
|
|
442
|
-
ui_1.log.success(`✅ Upload complete`);
|
|
443
|
-
if (result.bundleVersion != null)
|
|
444
|
-
ui_1.log.label('Bundle Version', `${result.bundleVersion}`);
|
|
445
|
-
if (result.bundleVersionLabel)
|
|
446
|
-
ui_1.log.label('Bundle Label', `${result.bundleVersionLabel}`);
|
|
447
|
-
if (result.hash)
|
|
448
|
-
ui_1.log.label('Hash', `${result.hash}`);
|
|
449
|
-
const resultDir = artifactDir ?? artifact.outputDir;
|
|
450
|
-
if (!fs.existsSync(resultDir))
|
|
451
|
-
fs.mkdirSync(resultDir, { recursive: true });
|
|
452
|
-
const resultPath = path.join(resultDir, 'bundle-drop-result.json');
|
|
453
|
-
fs.writeFileSync(resultPath, JSON.stringify(result, null, 2));
|
|
454
|
-
ui_1.log.label('Result file', resultPath);
|
|
455
|
-
if (artifactDir) {
|
|
456
|
-
ui_1.log.label('Artifact dir', artifactDir);
|
|
457
|
-
}
|
|
458
|
-
uploadSucceeded = true;
|
|
496
|
+
uploadMs = elapsedMs(uploadStartMs, nowMs());
|
|
497
|
+
responseData = res.data ?? {};
|
|
459
498
|
}
|
|
460
499
|
catch (err) {
|
|
461
|
-
uploadLoader.stop();
|
|
462
500
|
const uploadError = stringifyUploadError(err);
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
501
|
+
try {
|
|
502
|
+
writeArtifactResult(artifactDir, {
|
|
503
|
+
success: false,
|
|
504
|
+
status: 'failed',
|
|
505
|
+
error: uploadError,
|
|
506
|
+
platform,
|
|
507
|
+
appVersion: version,
|
|
508
|
+
channel,
|
|
509
|
+
orgSlug,
|
|
510
|
+
projectSlug,
|
|
511
|
+
runtimeVersion,
|
|
512
|
+
packageVersion: packageVersion ?? null,
|
|
513
|
+
releaseNotes: releaseNotes ?? null,
|
|
514
|
+
author: options.author ?? null,
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
catch (writeError) {
|
|
518
|
+
ui_1.log.warn(`Could not write failed upload result: ${errorMessage(writeError)}`);
|
|
519
|
+
}
|
|
477
520
|
ui_1.log.error(`Upload failed: ${uploadError}`);
|
|
478
521
|
process.exitCode = 1;
|
|
522
|
+
try {
|
|
523
|
+
cleanupUploadArtifacts(artifact, projectRoot, packageRoot, platform, isExpoProject);
|
|
524
|
+
}
|
|
525
|
+
catch (cleanupError) {
|
|
526
|
+
ui_1.log.warn(`Cleanup failed: ${errorMessage(cleanupError)}`);
|
|
527
|
+
}
|
|
479
528
|
return;
|
|
480
529
|
}
|
|
481
530
|
finally {
|
|
482
531
|
try {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
532
|
+
uploadLoader.stop();
|
|
533
|
+
}
|
|
534
|
+
catch (loaderError) {
|
|
535
|
+
warnAfterUpload(`Could not stop upload status: ${errorMessage(loaderError)}`);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
const hasSourceMap = Boolean(options.sourcemap && artifact.sourceMapPath &&
|
|
539
|
+
fs.existsSync(artifact.sourceMapPath));
|
|
540
|
+
const result = {
|
|
541
|
+
platform,
|
|
542
|
+
appVersion: version,
|
|
543
|
+
channel,
|
|
544
|
+
orgSlug,
|
|
545
|
+
projectSlug,
|
|
546
|
+
runtimeVersion: responseData.runtimeVersion ?? runtimeVersion ?? null,
|
|
547
|
+
packageVersion: responseData.packageVersion ?? packageVersion ?? null,
|
|
548
|
+
bundleId: responseData.bundleId ?? null,
|
|
549
|
+
bundleVersion: responseData.bundleVersion ?? null,
|
|
550
|
+
bundleVersionLabel: responseData.bundleVersionLabel ?? null,
|
|
551
|
+
hash: responseData.hash ?? null,
|
|
552
|
+
releaseNotes: releaseNotes ?? null,
|
|
553
|
+
author: options.author ?? null,
|
|
554
|
+
zipSizeBytes,
|
|
555
|
+
bundlingAndPackagingMs,
|
|
556
|
+
uploadMs,
|
|
557
|
+
dashboardUrl,
|
|
558
|
+
};
|
|
559
|
+
if (artifactDir) {
|
|
560
|
+
try {
|
|
561
|
+
fs.mkdirSync(artifactDir, { recursive: true });
|
|
562
|
+
if (fs.existsSync(artifact.bundlePath)) {
|
|
563
|
+
fs.copyFileSync(artifact.bundlePath, path.join(artifactDir, 'main.jsbundle'));
|
|
564
|
+
result.bundlePath = path.join(artifactDir, 'main.jsbundle');
|
|
511
565
|
}
|
|
512
|
-
if (
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
console.log();
|
|
566
|
+
if (hasSourceMap && artifact.sourceMapPath) {
|
|
567
|
+
fs.copyFileSync(artifact.sourceMapPath, path.join(artifactDir, 'main.jsbundle.map'));
|
|
568
|
+
result.sourceMapPath = path.join(artifactDir, 'main.jsbundle.map');
|
|
516
569
|
}
|
|
517
570
|
}
|
|
518
|
-
catch (
|
|
519
|
-
|
|
571
|
+
catch (copyError) {
|
|
572
|
+
warnAfterUpload(`Upload succeeded but artifact copy failed: ${errorMessage(copyError)}`);
|
|
520
573
|
}
|
|
521
574
|
}
|
|
575
|
+
try {
|
|
576
|
+
cleanupUploadArtifacts(artifact, projectRoot, packageRoot, platform, isExpoProject);
|
|
577
|
+
}
|
|
578
|
+
catch (cleanupError) {
|
|
579
|
+
warnAfterUpload(`Cleanup failed: ${errorMessage(cleanupError)}`);
|
|
580
|
+
}
|
|
581
|
+
const totalMs = elapsedMs(commandStartMs, nowMs());
|
|
582
|
+
result.totalMs = totalMs;
|
|
583
|
+
const resultDir = artifactDir ?? artifact.outputDir;
|
|
584
|
+
const resultPath = path.join(resultDir, 'bundle-drop-result.json');
|
|
585
|
+
let resultWritten = false;
|
|
586
|
+
try {
|
|
587
|
+
if (!fs.existsSync(resultDir))
|
|
588
|
+
fs.mkdirSync(resultDir, { recursive: true });
|
|
589
|
+
fs.writeFileSync(resultPath, JSON.stringify(result, null, 2));
|
|
590
|
+
resultWritten = true;
|
|
591
|
+
}
|
|
592
|
+
catch (writeError) {
|
|
593
|
+
warnAfterUpload(`Upload succeeded but local result writing failed: ${errorMessage(writeError)}`);
|
|
594
|
+
}
|
|
595
|
+
try {
|
|
596
|
+
const summary = [
|
|
597
|
+
` Organization / project: ${orgSlug} / ${projectSlug}`,
|
|
598
|
+
` Channel / platform: ${channel} / ${platform}`,
|
|
599
|
+
` App / runtime: ${version} / ${result.runtimeVersion}`,
|
|
600
|
+
...(result.bundleVersion != null ? [` Bundle version: ${result.bundleVersion}`] : []),
|
|
601
|
+
...(result.bundleVersionLabel ? [` Bundle label: ${result.bundleVersionLabel}`] : []),
|
|
602
|
+
...(result.hash ? [` Hash: ${result.hash}`] : []),
|
|
603
|
+
` Uploaded ZIP: ${zipSizeBytes} bytes`,
|
|
604
|
+
` Source map: ${!options.sourcemap ? 'not requested' : !hasSourceMap ? 'not generated' :
|
|
605
|
+
result.sourceMapPath ? `generated; retained at ${result.sourceMapPath}` : 'generated; not retained'}`,
|
|
606
|
+
...(result.bundlePath ? [` Retained bundle: ${result.bundlePath}`] : []),
|
|
607
|
+
` Timings: bundle/package ${formatSeconds(bundlingAndPackagingMs)} · upload ${formatSeconds(uploadMs)} · total ${formatSeconds(totalMs)}`,
|
|
608
|
+
...(resultWritten ? [` Result file: ${resultPath}`] : []),
|
|
609
|
+
` Dashboard: ${dashboardUrl ?? 'unavailable for this server'}`,
|
|
610
|
+
];
|
|
611
|
+
console.log();
|
|
612
|
+
ui_1.log.success('Upload complete.');
|
|
613
|
+
console.log(summary.join('\n'));
|
|
614
|
+
console.log();
|
|
615
|
+
}
|
|
616
|
+
catch (summaryError) {
|
|
617
|
+
warnAfterUpload(`Upload succeeded but summary rendering failed: ${errorMessage(summaryError)}`);
|
|
618
|
+
}
|
|
522
619
|
}
|
|
523
620
|
function upload(platform, options) {
|
|
524
621
|
return runUpload(platform, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gfean/react-native-bundle-drop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"nativeVersion": "0.6.0",
|
|
5
5
|
"description": "Over-the-air updates for Expo and bare React Native apps, with channels, staged rollouts, patch delivery, and rollback.",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/adm-zip": "^0.5.8",
|
|
63
63
|
"@types/jest": "^29.5.14",
|
|
64
|
-
"@types/node": "^24.
|
|
64
|
+
"@types/node": "^24.19.1",
|
|
65
65
|
"@types/react": "^18.2.66",
|
|
66
66
|
"@types/react-native": "^0.73.0",
|
|
67
67
|
"expo-autolinking-sdk55": "npm:expo-modules-autolinking@55.0.8",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"react-test-renderer": "^18.3.1",
|
|
74
74
|
"rimraf": "^6.1.3",
|
|
75
75
|
"rn-cli-platform-android-078": "npm:@react-native-community/cli-platform-android@15.0.1",
|
|
76
|
-
"ts-jest": "^29.4.
|
|
76
|
+
"ts-jest": "^29.4.14",
|
|
77
77
|
"ts-node": "^10.9.2",
|
|
78
78
|
"typescript": "^5.9.3"
|
|
79
79
|
},
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"diff": "9.0.0",
|
|
179
179
|
"figures": "3.2.0",
|
|
180
180
|
"form-data": "4.0.6",
|
|
181
|
-
"fs-extra": "11.4.
|
|
181
|
+
"fs-extra": "11.4.1",
|
|
182
182
|
"plist": "5.0.0",
|
|
183
183
|
"prompts": "2.4.2"
|
|
184
184
|
},
|