@huoye/app-ship 0.1.0 → 0.1.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/index.js CHANGED
@@ -559,23 +559,38 @@ var UploadManager = class {
559
559
  };
560
560
  }
561
561
  const files = Array.isArray(filePaths) ? filePaths : [filePaths];
562
- logger.info(`Processing ${files.length} file(s) for ${validPlatforms.length} platform(s)`);
563
- const uploadPromises = validPlatforms.map((platform) => {
562
+ const tasks = [];
563
+ validPlatforms.forEach((platform) => {
564
564
  const uploader = this.uploaders.get(platform);
565
- const targetFile = files.find((f) => uploader.canHandle(f));
566
- if (!targetFile) {
565
+ const matchedFiles = files.filter((f) => uploader.canHandle(f));
566
+ if (matchedFiles.length === 0) {
567
567
  logger.warn(`[${platform}] No compatible file found in provided files`);
568
- return Promise.resolve({
569
- platform,
570
- success: false,
571
- message: `No compatible file found for ${platform}`
568
+ } else {
569
+ matchedFiles.forEach((file) => {
570
+ tasks.push({ platform, file });
572
571
  });
573
572
  }
574
- logger.info(`[${platform}] Matched file: ${path2.basename(targetFile)}`);
575
- return this.uploadToPlatform(platform, targetFile, config, metadata);
573
+ });
574
+ if (tasks.length === 0) {
575
+ logger.error("No valid platform-file matches found");
576
+ return {
577
+ totalUploads: validPlatforms.length,
578
+ successCount: 0,
579
+ failureCount: validPlatforms.length,
580
+ successPlatforms: [],
581
+ failurePlatforms: validPlatforms,
582
+ results: [],
583
+ totalDurationMs: Date.now() - startTime,
584
+ summary: "No compatible files found for any of the selected platforms"
585
+ };
586
+ }
587
+ logger.info(`Scheduled ${tasks.length} upload task(s) for ${validPlatforms.length} platform(s)`);
588
+ const uploadPromises = tasks.map((task) => {
589
+ logger.info(`[${task.platform}] Matched file: ${path2.basename(task.file)}`);
590
+ return this.uploadToPlatform(task.platform, task.file, config, metadata);
576
591
  });
577
592
  const results = await Promise.all(uploadPromises);
578
- const report = this.aggregateResults(results, validPlatforms.length, startTime);
593
+ const report = this.aggregateResults(results, tasks.length, startTime);
579
594
  this.printReport(report);
580
595
  return report;
581
596
  }