@hot-updater/apple-helper 0.28.0 → 0.29.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/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
- //#region rolldown:runtime
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19,44 +20,36 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
19
20
  value: mod,
20
21
  enumerable: true
21
22
  }) : target, mod));
22
-
23
23
  //#endregion
24
- let __hot_updater_cli_tools = require("@hot-updater/cli-tools");
25
- __hot_updater_cli_tools = __toESM(__hot_updater_cli_tools);
24
+ let _hot_updater_cli_tools = require("@hot-updater/cli-tools");
26
25
  let fs = require("fs");
27
26
  fs = __toESM(fs);
28
27
  let path = require("path");
29
28
  path = __toESM(path);
30
- let __hot_updater_plugin_core = require("@hot-updater/plugin-core");
31
- __hot_updater_plugin_core = __toESM(__hot_updater_plugin_core);
29
+ let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
32
30
  let execa = require("execa");
33
- execa = __toESM(execa);
34
31
  let node_fs_promises = require("node:fs/promises");
35
- node_fs_promises = __toESM(node_fs_promises);
36
32
  let node_os = require("node:os");
37
33
  node_os = __toESM(node_os);
38
34
  let node_path = require("node:path");
39
- node_path = __toESM(node_path);
40
35
  let stream_promises = require("stream/promises");
41
- stream_promises = __toESM(stream_promises);
42
-
43
36
  //#region src/utils/cocoapods.ts
44
37
  const installPodsIfNeeded = async (sourceDir) => {
45
38
  const podfilePath = path.default.join(sourceDir, "Podfile");
46
39
  if (!fs.default.existsSync(podfilePath)) {
47
- __hot_updater_cli_tools.p.log.info("No Podfile found, skipping CocoaPods installation");
40
+ _hot_updater_cli_tools.p.log.info("No Podfile found, skipping CocoaPods installation");
48
41
  return;
49
42
  }
50
- const gemfilePaths = [path.default.join(sourceDir, "Gemfile"), path.default.join((0, __hot_updater_cli_tools.getCwd)(), "Gemfile")];
43
+ const gemfilePaths = [path.default.join(sourceDir, "Gemfile"), path.default.join((0, _hot_updater_cli_tools.getCwd)(), "Gemfile")];
51
44
  const shouldUseBundler = (await Promise.all(gemfilePaths.map(checkShouldUseBundler))).some(Boolean);
52
45
  try {
53
46
  if (shouldUseBundler) {
54
- __hot_updater_cli_tools.p.log.info("Using bundler for CocoaPods installation");
55
- const bundleSpinner = __hot_updater_cli_tools.p.spinner();
47
+ _hot_updater_cli_tools.p.log.info("Using bundler for CocoaPods installation");
48
+ const bundleSpinner = _hot_updater_cli_tools.p.spinner();
56
49
  bundleSpinner.start("Installing Ruby gems");
57
50
  await (0, execa.execa)("bundle", ["install"], { cwd: sourceDir });
58
51
  bundleSpinner.stop("Ruby gems installed");
59
- const podSpinner = __hot_updater_cli_tools.p.spinner();
52
+ const podSpinner = _hot_updater_cli_tools.p.spinner();
60
53
  podSpinner.start("Installing CocoaPods dependencies");
61
54
  await (0, execa.execa)("bundle", [
62
55
  "exec",
@@ -68,7 +61,7 @@ const installPodsIfNeeded = async (sourceDir) => {
68
61
  });
69
62
  podSpinner.stop("CocoaPods dependencies installed");
70
63
  } else {
71
- const spinner = __hot_updater_cli_tools.p.spinner();
64
+ const spinner = _hot_updater_cli_tools.p.spinner();
72
65
  spinner.start("Installing CocoaPods dependencies");
73
66
  await (0, execa.execa)("pod", ["install"], {
74
67
  cwd: sourceDir,
@@ -89,7 +82,7 @@ const checkShouldUseBundler = async (gemfilePath) => {
89
82
  }
90
83
  };
91
84
  const preparePodInstallEnvVars = () => {
92
- const { minor } = (0, __hot_updater_cli_tools.getReactNativeMetadatas)().version;
85
+ const { minor } = (0, _hot_updater_cli_tools.getReactNativeMetadatas)().version;
93
86
  const usePrebuiltReactNative = minor >= 81;
94
87
  return {
95
88
  RCT_IGNORE_PODS_DEPRECATION: "1",
@@ -97,13 +90,11 @@ const preparePodInstallEnvVars = () => {
97
90
  RCT_USE_PREBUILT_RNCORE: process.env["RCT_USE_PREBUILT_RNCORE"] !== void 0 ? String(process.env["RCT_USE_PREBUILT_RNCORE"]) : usePrebuiltReactNative ? "1" : "0"
98
91
  };
99
92
  };
100
-
101
93
  //#endregion
102
94
  //#region src/utils/createRandomTmpDir.ts
103
95
  const createRandomTmpDir = async (prefix = "apple-helper-") => {
104
96
  return await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), prefix));
105
97
  };
106
-
107
98
  //#endregion
108
99
  //#region src/utils/platform.ts
109
100
  /**
@@ -117,7 +108,6 @@ const platformConfigs = { ios: {
117
108
  deviceDestination: "platform=iOS",
118
109
  simulatorDestination: "platform=iOS Simulator"
119
110
  } };
120
-
121
111
  //#endregion
122
112
  //#region src/utils/destination.ts
123
113
  const buildDestinationString = ({ deviceType, platform, useGeneric }) => `${useGeneric ? "generic/" : ""}${deviceType === "device" ? platformConfigs[platform].deviceDestination : platformConfigs[platform].simulatorDestination}`;
@@ -155,7 +145,6 @@ const getDefaultDestination = ({ platform, useGeneric, deviceType }) => {
155
145
  useGeneric
156
146
  });
157
147
  };
158
-
159
148
  //#endregion
160
149
  //#region src/utils/parseXcodeProjectInfo.ts
161
150
  const parseXcodeProjectInfo = async (sourceDir) => {
@@ -174,7 +163,6 @@ const parseXcodeProjectInfo = async (sourceDir) => {
174
163
  };
175
164
  throw new Error(`No Xcode project or workspace found in ${sourceDir}`);
176
165
  };
177
-
178
166
  //#endregion
179
167
  //#region src/utils/prettifyXcodebuildError.ts
180
168
  const prettifyXcodebuildError = (error) => {
@@ -183,10 +171,9 @@ const prettifyXcodebuildError = (error) => {
183
171
  if (errorString.includes("error: No profiles for") || errorString.includes("error: Provisioning profile")) return /* @__PURE__ */ new Error("Xcodebuild failed: Not valid provisioning profile is set in the project. Check out Singing & Capabilities tab in the Xcode.");
184
172
  return /* @__PURE__ */ new Error(`Xcodebuild failed: ${error}`);
185
173
  };
186
-
187
174
  //#endregion
188
175
  //#region src/utils/createXcodebuildLogger.ts
189
- const createXcodebuildLogger = ({ logPrefix }) => new __hot_updater_cli_tools.BuildLogger({
176
+ const createXcodebuildLogger = ({ logPrefix }) => new _hot_updater_cli_tools.BuildLogger({
190
177
  logPrefix,
191
178
  importantLogPatterns: [
192
179
  "error:",
@@ -226,7 +213,6 @@ const createXcodebuildLogger = ({ logPrefix }) => new __hot_updater_cli_tools.Bu
226
213
  ]
227
214
  ]
228
215
  });
229
-
230
216
  //#endregion
231
217
  //#region src/utils/runXcodebuildWithLogging.ts
232
218
  let cachedXcbeautifyAvailability = null;
@@ -335,7 +321,6 @@ const runXcodebuildWithLogging = async ({ args, sourceDir, successMessage, failu
335
321
  await logger.close();
336
322
  }
337
323
  };
338
-
339
324
  //#endregion
340
325
  //#region src/builder/archiveXcodeProject.ts
341
326
  const archiveXcodeProject = async ({ sourceDir, platform, installPods, destination, extraParams, configuration, xcodeScheme, xcconfig, logPrefix }) => {
@@ -355,7 +340,7 @@ const archiveXcodeProject = async ({ sourceDir, platform, installPods, destinati
355
340
  xcconfig,
356
341
  xcodeScheme
357
342
  });
358
- __hot_updater_cli_tools.p.log.info(`Xcode Archive Settings:
343
+ _hot_updater_cli_tools.p.log.info(`Xcode Archive Settings:
359
344
  Project ${xcodeProject.name}
360
345
  Scheme ${xcodeScheme}
361
346
  Platform ${platform}
@@ -385,7 +370,7 @@ const prepareArchiveArgs = ({ xcodeScheme, archivePath, platform, sourceDir, xco
385
370
  "archive",
386
371
  "-archivePath",
387
372
  archivePath,
388
- `HOT_UPDATER_MIN_BUNDLE_ID=${(0, __hot_updater_plugin_core.generateMinBundleId)()}`
373
+ `HOT_UPDATER_MIN_BUNDLE_ID=${(0, _hot_updater_plugin_core.generateMinBundleId)()}`
389
374
  ];
390
375
  if (xcconfig) args.push("-xcconfig", xcconfig);
391
376
  if (extraParams) args.push(...extraParams);
@@ -398,10 +383,9 @@ const prepareArchiveArgs = ({ xcodeScheme, archivePath, platform, sourceDir, xco
398
383
  platform,
399
384
  useGeneric: true
400
385
  }));
401
- for (const destination$1 of resolvedDestinations) args.push("-destination", destination$1);
386
+ for (const destination of resolvedDestinations) args.push("-destination", destination);
402
387
  return args;
403
388
  };
404
-
405
389
  //#endregion
406
390
  //#region src/builder/buildXcodeProject.ts
407
391
  const buildXcodeProject = async ({ sourceDir, platform, xcodeScheme, configuration, deviceType, logPrefix, destination = [], useGenericDestination = false, installPods, extraParams }) => {
@@ -428,7 +412,7 @@ const buildXcodeProject = async ({ sourceDir, platform, xcodeScheme, configurati
428
412
  sourceDir,
429
413
  xcodeProject
430
414
  });
431
- __hot_updater_cli_tools.p.log.info(`Xcode Build Settings:
415
+ _hot_updater_cli_tools.p.log.info(`Xcode Build Settings:
432
416
  Project ${xcodeProject.name}
433
417
  Scheme ${xcodeScheme}
434
418
  Configuration ${configuration}
@@ -469,7 +453,7 @@ const prepareBuildArgs = ({ xcodeProject, sourceDir, platform, xcodeScheme, conf
469
453
  sdk,
470
454
  "-derivedDataPath",
471
455
  derivedDataPath,
472
- `HOT_UPDATER_MIN_BUNDLE_ID=${(0, __hot_updater_plugin_core.generateMinBundleId)()}`,
456
+ `HOT_UPDATER_MIN_BUNDLE_ID=${(0, _hot_updater_plugin_core.generateMinBundleId)()}`,
473
457
  "build"
474
458
  ];
475
459
  if (extraParams) args.push(...extraParams);
@@ -506,7 +490,6 @@ const getBuildSettings = async ({ xcodeProject, sourceDir, xcodeScheme, configur
506
490
  infoPlistPath: path.default.join(targetBuildDir, infoPlistPath)
507
491
  };
508
492
  };
509
-
510
493
  //#endregion
511
494
  //#region src/builder/exportXcodeArchive.ts
512
495
  const exportXcodeArchive = async ({ archivePath, sourceDir, exportExtraParams, exportOptionsPlist, logPrefix }) => {
@@ -542,30 +525,28 @@ const prepareExportArgs = ({ exportPath, archivePath, exportExtraParams, exportO
542
525
  args.push("-exportOptionsPlist", exportOptionsPlist);
543
526
  return args;
544
527
  };
545
-
546
528
  //#endregion
547
529
  //#region src/utils/assertXcodebuildExist.ts
548
530
  const assertXcodebuildExist = async () => {
549
531
  try {
550
532
  await (0, execa.execa)("which", ["xcodebuild"]);
551
533
  } catch {
552
- __hot_updater_cli_tools.p.log.error(`${__hot_updater_cli_tools.colors.blueBright("xcodebuild")} resolve failed. Ensure that xcode is installed on your machine or xcodebuild is included in your path`);
534
+ _hot_updater_cli_tools.p.log.error(`${_hot_updater_cli_tools.colors.blueBright("xcodebuild")} resolve failed. Ensure that xcode is installed on your machine or xcodebuild is included in your path`);
553
535
  process.exit(1);
554
536
  }
555
537
  };
556
-
557
538
  //#endregion
558
539
  //#region src/buildIos.ts
559
540
  const buildIos = async ({ schemeConfig }) => {
560
541
  await assertXcodebuildExist();
561
- const iosProjectRoot = path.default.join((0, __hot_updater_cli_tools.getCwd)(), "ios");
542
+ const iosProjectRoot = path.default.join((0, _hot_updater_cli_tools.getCwd)(), "ios");
562
543
  const buildDirectory = await createRandomTmpDir();
563
544
  const archiveDir = path.default.join(buildDirectory, "archive");
564
545
  const exportDir = path.default.join(buildDirectory, "export");
565
546
  await fs.default.promises.mkdir(archiveDir, { recursive: true });
566
547
  if (schemeConfig.simulator) {
567
548
  if (schemeConfig.destination.length) {
568
- __hot_updater_cli_tools.p.log.error("The scheme option 'simulator' is not compatible with the 'destination' option.");
549
+ _hot_updater_cli_tools.p.log.error("The scheme option 'simulator' is not compatible with the 'destination' option.");
569
550
  process.exit(1);
570
551
  }
571
552
  const appDir = path.default.join(buildDirectory, "app");
@@ -583,7 +564,7 @@ const buildIos = async ({ schemeConfig }) => {
583
564
  });
584
565
  const finalAppPath = path.default.join(appDir, path.default.basename(appPath));
585
566
  await fs.default.promises.cp(appPath, finalAppPath, { recursive: true });
586
- __hot_updater_cli_tools.p.log.success(`.app file created: ${path.default.basename(appPath)}`);
567
+ _hot_updater_cli_tools.p.log.success(`.app file created: ${path.default.basename(appPath)}`);
587
568
  return {
588
569
  buildDirectory,
589
570
  buildArtifactPath: finalAppPath
@@ -605,7 +586,7 @@ const buildIos = async ({ schemeConfig }) => {
605
586
  const appFromArchive = extractAppFromXcarchive(finalArchivePath);
606
587
  if (appFromArchive) {
607
588
  await fs.default.promises.cp(appFromArchive, path.default.join(archiveDir, path.default.basename(appFromArchive)), { recursive: true });
608
- __hot_updater_cli_tools.p.log.success(".app extracted from .xcarchive");
589
+ _hot_updater_cli_tools.p.log.success(".app extracted from .xcarchive");
609
590
  }
610
591
  if (schemeConfig.exportOptionsPlist) {
611
592
  await fs.default.promises.mkdir(exportDir, { recursive: true });
@@ -635,9 +616,8 @@ const extractAppFromXcarchive = (archivePath) => {
635
616
  if (!fs.default.existsSync(productsPath)) return;
636
617
  const appFile = fs.default.readdirSync(productsPath).find((file) => file.endsWith(".app"));
637
618
  if (appFile) return path.default.join(productsPath, appFile);
638
- __hot_updater_cli_tools.p.log.warn("Failed to extract .app from xcarchive");
619
+ _hot_updater_cli_tools.p.log.warn("Failed to extract .app from xcarchive");
639
620
  };
640
-
641
621
  //#endregion
642
622
  //#region src/runner/deviceRunner.ts
643
623
  const installAndLaunchOnDevice = async ({ device, appPath, options }) => {
@@ -661,7 +641,7 @@ const installOnDevice = async ({ device, appPath, options }) => {
661
641
  device.udid,
662
642
  appPath
663
643
  ];
664
- const spinner = __hot_updater_cli_tools.p.spinner();
644
+ const spinner = _hot_updater_cli_tools.p.spinner();
665
645
  spinner.start(`Installing app on ${device.name}`);
666
646
  try {
667
647
  await (0, execa.execa)("xcrun", deviceCtlArgs, { cwd: options.sourceDir });
@@ -681,7 +661,7 @@ const launchAppOnDevice = async ({ device, options }) => {
681
661
  device.udid,
682
662
  options.bundleIdentifier
683
663
  ];
684
- const spinner = __hot_updater_cli_tools.p.spinner();
664
+ const spinner = _hot_updater_cli_tools.p.spinner();
685
665
  spinner.start(`Launching app on ${device.name}`);
686
666
  try {
687
667
  await (0, execa.execa)("xcrun", deviceCtlArgs, { cwd: options.sourceDir });
@@ -691,7 +671,6 @@ const launchAppOnDevice = async ({ device, options }) => {
691
671
  throw new Error(`Failed to launch the app on ${device.name}: ${error}`);
692
672
  }
693
673
  };
694
-
695
674
  //#endregion
696
675
  //#region src/runner/simulatorRunner.ts
697
676
  const installAndLaunchOnSimulator = async ({ device, appPath, options }) => {
@@ -718,7 +697,7 @@ const launchSimulator = async ({ device }) => {
718
697
  if (device.state !== "Booted") await bootSimulator({ device });
719
698
  };
720
699
  const installOnSimulator = async ({ device, appPath, options }) => {
721
- const spinner = __hot_updater_cli_tools.p.spinner();
700
+ const spinner = _hot_updater_cli_tools.p.spinner();
722
701
  spinner.start(`Installing app on "${device.name}"`);
723
702
  try {
724
703
  await (0, execa.execa)("xcrun", [
@@ -734,7 +713,7 @@ const installOnSimulator = async ({ device, appPath, options }) => {
734
713
  }
735
714
  };
736
715
  const launchAppOnSimulator = async ({ device, options }) => {
737
- const spinner = __hot_updater_cli_tools.p.spinner();
716
+ const spinner = _hot_updater_cli_tools.p.spinner();
738
717
  spinner.start(`Launching app on "${device.name}"`);
739
718
  try {
740
719
  await (0, execa.execa)("xcrun", [
@@ -758,13 +737,12 @@ const bootSimulator = async ({ device }) => {
758
737
  ]);
759
738
  } catch (error) {
760
739
  if ((error instanceof Error ? error.message : String(error)).includes("Unable to boot device in current state: Booted")) {
761
- __hot_updater_cli_tools.p.log.info(`Simulator ${device.udid} already booted. Skipping.`);
740
+ _hot_updater_cli_tools.p.log.info(`Simulator ${device.udid} already booted. Skipping.`);
762
741
  return;
763
742
  }
764
743
  throw new Error(`Failed to boot simulator: ${error}`);
765
744
  }
766
745
  };
767
-
768
746
  //#endregion
769
747
  //#region src/utils/device.ts
770
748
  /**
@@ -855,7 +833,7 @@ const getPlatformFromOsVersion = (osVersion) => {
855
833
  * @returns Array of devices filtered by options
856
834
  */
857
835
  const listDevices = async (platform, options = {}) => {
858
- const spinner = __hot_updater_cli_tools.p.spinner();
836
+ const spinner = _hot_updater_cli_tools.p.spinner();
859
837
  spinner.start(`Discovering ${platform} devices`);
860
838
  try {
861
839
  const [simulators, devices] = await Promise.all([getSimulators(), getDevices().catch(() => [])]);
@@ -886,23 +864,23 @@ const formatDeviceName = (device) => {
886
864
  const selectTargetDevice = async ({ platform, interactive, deviceOption }) => {
887
865
  const availableDevices = await listDevices(platform);
888
866
  if (deviceOption === true && !interactive) {
889
- __hot_updater_cli_tools.p.log.error("you can't select device manually with non-interactive cli mode(without -i option).");
867
+ _hot_updater_cli_tools.p.log.error("you can't select device manually with non-interactive cli mode(without -i option).");
890
868
  process.exit(1);
891
869
  }
892
870
  if (typeof deviceOption === "string") {
893
871
  const matchedDevice = matchingDevice(availableDevices, deviceOption);
894
872
  if (!matchedDevice) {
895
- __hot_updater_cli_tools.p.log.error(`device '${deviceOption}' isn't included in the attached devices.`);
873
+ _hot_updater_cli_tools.p.log.error(`device '${deviceOption}' isn't included in the attached devices.`);
896
874
  process.exit(1);
897
875
  }
898
876
  return matchedDevice;
899
877
  }
900
878
  if (interactive) {
901
879
  if (!availableDevices.length) {
902
- __hot_updater_cli_tools.p.log.error("you passed -d option but there is no attached devices.");
880
+ _hot_updater_cli_tools.p.log.error("you passed -d option but there is no attached devices.");
903
881
  process.exit(1);
904
882
  }
905
- const device = await __hot_updater_cli_tools.p.select({
883
+ const device = await _hot_updater_cli_tools.p.select({
906
884
  message: "Target Device",
907
885
  options: availableDevices.map((d) => ({
908
886
  value: d,
@@ -910,7 +888,7 @@ const selectTargetDevice = async ({ platform, interactive, deviceOption }) => {
910
888
  hint: d.udid
911
889
  }))
912
890
  });
913
- if (__hot_updater_cli_tools.p.isCancel(device)) process.exit(1);
891
+ if (_hot_updater_cli_tools.p.isCancel(device)) process.exit(1);
914
892
  return device;
915
893
  }
916
894
  const bootedDevices = await listDevices(platform, { state: "Booted" });
@@ -920,12 +898,11 @@ const Device = {
920
898
  listDevices,
921
899
  selectTargetDevice
922
900
  };
923
-
924
901
  //#endregion
925
902
  //#region src/runIos.ts
926
903
  const runIos = async ({ schemeConfig, runOption }) => {
927
904
  const { interactive, device: deviceOption } = runOption;
928
- const iosProjectPath = path.default.join((0, __hot_updater_cli_tools.getCwd)(), "ios");
905
+ const iosProjectPath = path.default.join((0, _hot_updater_cli_tools.getCwd)(), "ios");
929
906
  const device = await Device.selectTargetDevice({
930
907
  platform: "ios",
931
908
  deviceOption,
@@ -934,13 +911,13 @@ const runIos = async ({ schemeConfig, runOption }) => {
934
911
  if (!device) {
935
912
  const simulators = await Device.listDevices("ios", { deviceType: "simulator" });
936
913
  if (simulators.length === 0) {
937
- __hot_updater_cli_tools.p.log.error("No simulators found. Please create a simulator in Xcode.");
914
+ _hot_updater_cli_tools.p.log.error("No simulators found. Please create a simulator in Xcode.");
938
915
  process.exit(1);
939
916
  }
940
- __hot_updater_cli_tools.p.log.info(`Using first available simulator: ${simulators[0].name}`);
917
+ _hot_updater_cli_tools.p.log.info(`Using first available simulator: ${simulators[0].name}`);
941
918
  const selectedDevice = simulators[0];
942
- __hot_updater_cli_tools.p.log.info(`Building for ${selectedDevice.name}...`);
943
- const result$1 = await buildXcodeProject({
919
+ _hot_updater_cli_tools.p.log.info(`Building for ${selectedDevice.name}...`);
920
+ const result = await buildXcodeProject({
944
921
  sourceDir: iosProjectPath,
945
922
  platform: schemeConfig.platform,
946
923
  xcodeScheme: schemeConfig.scheme,
@@ -951,21 +928,21 @@ const runIos = async ({ schemeConfig, runOption }) => {
951
928
  extraParams: schemeConfig.extraParams,
952
929
  logPrefix: `ios-${schemeConfig.hotUpdaterSchemeName}-run`
953
930
  });
954
- const runnerOptions$1 = {
931
+ const runnerOptions = {
955
932
  bundleIdentifier: schemeConfig.bundleIdentifier,
956
933
  sourceDir: iosProjectPath,
957
934
  launch: true,
958
- infoPlistPath: result$1.infoPlistPath
935
+ infoPlistPath: result.infoPlistPath
959
936
  };
960
937
  await installAndLaunchOnSimulator({
961
938
  device: selectedDevice,
962
- appPath: result$1.appPath,
963
- options: runnerOptions$1
939
+ appPath: result.appPath,
940
+ options: runnerOptions
964
941
  });
965
- __hot_updater_cli_tools.p.outro("Success 🎉");
966
- return result$1;
942
+ _hot_updater_cli_tools.p.outro("Success 🎉");
943
+ return result;
967
944
  }
968
- __hot_updater_cli_tools.p.log.info(`Building for ${device.name}...`);
945
+ _hot_updater_cli_tools.p.log.info(`Building for ${device.name}...`);
969
946
  const result = await buildXcodeProject({
970
947
  sourceDir: iosProjectPath,
971
948
  platform: schemeConfig.platform,
@@ -995,16 +972,15 @@ const runIos = async ({ schemeConfig, runOption }) => {
995
972
  appPath: result.appPath,
996
973
  options: runnerOptions
997
974
  });
998
- __hot_updater_cli_tools.p.outro("Success 🎉");
975
+ _hot_updater_cli_tools.p.outro("Success 🎉");
999
976
  return result;
1000
977
  };
1001
-
1002
978
  //#endregion
1003
979
  //#region src/utils/enrichNativeBuildIosScheme.ts
1004
980
  const resolveExportOptionsPlist = (exportOptionsPlist) => {
1005
- const resolvedExportOptionsPlist = exportOptionsPlist ? path.default.isAbsolute(exportOptionsPlist) ? exportOptionsPlist : path.default.resolve((0, __hot_updater_cli_tools.getCwd)(), exportOptionsPlist) : void 0;
981
+ const resolvedExportOptionsPlist = exportOptionsPlist ? path.default.isAbsolute(exportOptionsPlist) ? exportOptionsPlist : path.default.resolve((0, _hot_updater_cli_tools.getCwd)(), exportOptionsPlist) : void 0;
1006
982
  if (resolvedExportOptionsPlist && !fs.default.existsSync(resolvedExportOptionsPlist)) {
1007
- __hot_updater_cli_tools.p.log.error(`exportOptionsPlist doesn't exist in ${resolvedExportOptionsPlist}`);
983
+ _hot_updater_cli_tools.p.log.error(`exportOptionsPlist doesn't exist in ${resolvedExportOptionsPlist}`);
1008
984
  process.exit(1);
1009
985
  }
1010
986
  return resolvedExportOptionsPlist;
@@ -1021,8 +997,7 @@ const enrichNativeBuildIosScheme = async ({ scheme, hotUpdaterSchemeName }) => {
1021
997
  hotUpdaterSchemeName
1022
998
  };
1023
999
  };
1024
-
1025
1000
  //#endregion
1026
1001
  exports.buildIos = buildIos;
1027
1002
  exports.enrichNativeBuildIosScheme = enrichNativeBuildIosScheme;
1028
- exports.runIos = runIos;
1003
+ exports.runIos = runIos;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ApplePlatform, NativeBuildIosScheme, NativeBuildOptions } from "@hot-updater/plugin-core";
2
2
 
3
3
  //#region src/utils/enrichNativeBuildIosScheme.d.ts
4
-
5
4
  /**
6
5
  * Validated scheme filled nullish values with default values.
7
6
  */
@@ -1,7 +1,6 @@
1
1
  import { ApplePlatform, NativeBuildIosScheme, NativeBuildOptions } from "@hot-updater/plugin-core";
2
2
 
3
3
  //#region src/utils/enrichNativeBuildIosScheme.d.ts
4
-
5
4
  /**
6
5
  * Validated scheme filled nullish values with default values.
7
6
  */
@@ -7,7 +7,6 @@ import { mkdtemp } from "node:fs/promises";
7
7
  import os, { tmpdir } from "node:os";
8
8
  import { join } from "node:path";
9
9
  import { pipeline } from "stream/promises";
10
-
11
10
  //#region src/utils/cocoapods.ts
12
11
  const installPodsIfNeeded = async (sourceDir) => {
13
12
  const podfilePath = path.join(sourceDir, "Podfile");
@@ -65,13 +64,11 @@ const preparePodInstallEnvVars = () => {
65
64
  RCT_USE_PREBUILT_RNCORE: process.env["RCT_USE_PREBUILT_RNCORE"] !== void 0 ? String(process.env["RCT_USE_PREBUILT_RNCORE"]) : usePrebuiltReactNative ? "1" : "0"
66
65
  };
67
66
  };
68
-
69
67
  //#endregion
70
68
  //#region src/utils/createRandomTmpDir.ts
71
69
  const createRandomTmpDir = async (prefix = "apple-helper-") => {
72
70
  return await mkdtemp(join(tmpdir(), prefix));
73
71
  };
74
-
75
72
  //#endregion
76
73
  //#region src/utils/platform.ts
77
74
  /**
@@ -85,7 +82,6 @@ const platformConfigs = { ios: {
85
82
  deviceDestination: "platform=iOS",
86
83
  simulatorDestination: "platform=iOS Simulator"
87
84
  } };
88
-
89
85
  //#endregion
90
86
  //#region src/utils/destination.ts
91
87
  const buildDestinationString = ({ deviceType, platform, useGeneric }) => `${useGeneric ? "generic/" : ""}${deviceType === "device" ? platformConfigs[platform].deviceDestination : platformConfigs[platform].simulatorDestination}`;
@@ -123,7 +119,6 @@ const getDefaultDestination = ({ platform, useGeneric, deviceType }) => {
123
119
  useGeneric
124
120
  });
125
121
  };
126
-
127
122
  //#endregion
128
123
  //#region src/utils/parseXcodeProjectInfo.ts
129
124
  const parseXcodeProjectInfo = async (sourceDir) => {
@@ -142,7 +137,6 @@ const parseXcodeProjectInfo = async (sourceDir) => {
142
137
  };
143
138
  throw new Error(`No Xcode project or workspace found in ${sourceDir}`);
144
139
  };
145
-
146
140
  //#endregion
147
141
  //#region src/utils/prettifyXcodebuildError.ts
148
142
  const prettifyXcodebuildError = (error) => {
@@ -151,7 +145,6 @@ const prettifyXcodebuildError = (error) => {
151
145
  if (errorString.includes("error: No profiles for") || errorString.includes("error: Provisioning profile")) return /* @__PURE__ */ new Error("Xcodebuild failed: Not valid provisioning profile is set in the project. Check out Singing & Capabilities tab in the Xcode.");
152
146
  return /* @__PURE__ */ new Error(`Xcodebuild failed: ${error}`);
153
147
  };
154
-
155
148
  //#endregion
156
149
  //#region src/utils/createXcodebuildLogger.ts
157
150
  const createXcodebuildLogger = ({ logPrefix }) => new BuildLogger({
@@ -194,7 +187,6 @@ const createXcodebuildLogger = ({ logPrefix }) => new BuildLogger({
194
187
  ]
195
188
  ]
196
189
  });
197
-
198
190
  //#endregion
199
191
  //#region src/utils/runXcodebuildWithLogging.ts
200
192
  let cachedXcbeautifyAvailability = null;
@@ -303,7 +295,6 @@ const runXcodebuildWithLogging = async ({ args, sourceDir, successMessage, failu
303
295
  await logger.close();
304
296
  }
305
297
  };
306
-
307
298
  //#endregion
308
299
  //#region src/builder/archiveXcodeProject.ts
309
300
  const archiveXcodeProject = async ({ sourceDir, platform, installPods, destination, extraParams, configuration, xcodeScheme, xcconfig, logPrefix }) => {
@@ -366,10 +357,9 @@ const prepareArchiveArgs = ({ xcodeScheme, archivePath, platform, sourceDir, xco
366
357
  platform,
367
358
  useGeneric: true
368
359
  }));
369
- for (const destination$1 of resolvedDestinations) args.push("-destination", destination$1);
360
+ for (const destination of resolvedDestinations) args.push("-destination", destination);
370
361
  return args;
371
362
  };
372
-
373
363
  //#endregion
374
364
  //#region src/builder/buildXcodeProject.ts
375
365
  const buildXcodeProject = async ({ sourceDir, platform, xcodeScheme, configuration, deviceType, logPrefix, destination = [], useGenericDestination = false, installPods, extraParams }) => {
@@ -474,7 +464,6 @@ const getBuildSettings = async ({ xcodeProject, sourceDir, xcodeScheme, configur
474
464
  infoPlistPath: path.join(targetBuildDir, infoPlistPath)
475
465
  };
476
466
  };
477
-
478
467
  //#endregion
479
468
  //#region src/builder/exportXcodeArchive.ts
480
469
  const exportXcodeArchive = async ({ archivePath, sourceDir, exportExtraParams, exportOptionsPlist, logPrefix }) => {
@@ -510,7 +499,6 @@ const prepareExportArgs = ({ exportPath, archivePath, exportExtraParams, exportO
510
499
  args.push("-exportOptionsPlist", exportOptionsPlist);
511
500
  return args;
512
501
  };
513
-
514
502
  //#endregion
515
503
  //#region src/utils/assertXcodebuildExist.ts
516
504
  const assertXcodebuildExist = async () => {
@@ -521,7 +509,6 @@ const assertXcodebuildExist = async () => {
521
509
  process.exit(1);
522
510
  }
523
511
  };
524
-
525
512
  //#endregion
526
513
  //#region src/buildIos.ts
527
514
  const buildIos = async ({ schemeConfig }) => {
@@ -605,7 +592,6 @@ const extractAppFromXcarchive = (archivePath) => {
605
592
  if (appFile) return path.join(productsPath, appFile);
606
593
  p.log.warn("Failed to extract .app from xcarchive");
607
594
  };
608
-
609
595
  //#endregion
610
596
  //#region src/runner/deviceRunner.ts
611
597
  const installAndLaunchOnDevice = async ({ device, appPath, options }) => {
@@ -659,7 +645,6 @@ const launchAppOnDevice = async ({ device, options }) => {
659
645
  throw new Error(`Failed to launch the app on ${device.name}: ${error}`);
660
646
  }
661
647
  };
662
-
663
648
  //#endregion
664
649
  //#region src/runner/simulatorRunner.ts
665
650
  const installAndLaunchOnSimulator = async ({ device, appPath, options }) => {
@@ -732,7 +717,6 @@ const bootSimulator = async ({ device }) => {
732
717
  throw new Error(`Failed to boot simulator: ${error}`);
733
718
  }
734
719
  };
735
-
736
720
  //#endregion
737
721
  //#region src/utils/device.ts
738
722
  /**
@@ -888,7 +872,6 @@ const Device = {
888
872
  listDevices,
889
873
  selectTargetDevice
890
874
  };
891
-
892
875
  //#endregion
893
876
  //#region src/runIos.ts
894
877
  const runIos = async ({ schemeConfig, runOption }) => {
@@ -908,7 +891,7 @@ const runIos = async ({ schemeConfig, runOption }) => {
908
891
  p.log.info(`Using first available simulator: ${simulators[0].name}`);
909
892
  const selectedDevice = simulators[0];
910
893
  p.log.info(`Building for ${selectedDevice.name}...`);
911
- const result$1 = await buildXcodeProject({
894
+ const result = await buildXcodeProject({
912
895
  sourceDir: iosProjectPath,
913
896
  platform: schemeConfig.platform,
914
897
  xcodeScheme: schemeConfig.scheme,
@@ -919,19 +902,19 @@ const runIos = async ({ schemeConfig, runOption }) => {
919
902
  extraParams: schemeConfig.extraParams,
920
903
  logPrefix: `ios-${schemeConfig.hotUpdaterSchemeName}-run`
921
904
  });
922
- const runnerOptions$1 = {
905
+ const runnerOptions = {
923
906
  bundleIdentifier: schemeConfig.bundleIdentifier,
924
907
  sourceDir: iosProjectPath,
925
908
  launch: true,
926
- infoPlistPath: result$1.infoPlistPath
909
+ infoPlistPath: result.infoPlistPath
927
910
  };
928
911
  await installAndLaunchOnSimulator({
929
912
  device: selectedDevice,
930
- appPath: result$1.appPath,
931
- options: runnerOptions$1
913
+ appPath: result.appPath,
914
+ options: runnerOptions
932
915
  });
933
916
  p.outro("Success 🎉");
934
- return result$1;
917
+ return result;
935
918
  }
936
919
  p.log.info(`Building for ${device.name}...`);
937
920
  const result = await buildXcodeProject({
@@ -966,7 +949,6 @@ const runIos = async ({ schemeConfig, runOption }) => {
966
949
  p.outro("Success 🎉");
967
950
  return result;
968
951
  };
969
-
970
952
  //#endregion
971
953
  //#region src/utils/enrichNativeBuildIosScheme.ts
972
954
  const resolveExportOptionsPlist = (exportOptionsPlist) => {
@@ -989,6 +971,5 @@ const enrichNativeBuildIosScheme = async ({ scheme, hotUpdaterSchemeName }) => {
989
971
  hotUpdaterSchemeName
990
972
  };
991
973
  };
992
-
993
974
  //#endregion
994
- export { buildIos, enrichNativeBuildIosScheme, runIos };
975
+ export { buildIos, enrichNativeBuildIosScheme, runIos };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@hot-updater/apple-helper",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.cts",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/index.js",
10
+ "import": "./dist/index.mjs",
11
11
  "require": "./dist/index.cjs"
12
12
  },
13
13
  "./package.json": "./package.json"
@@ -26,8 +26,8 @@
26
26
  "dependencies": {
27
27
  "execa": "9.5.2",
28
28
  "fast-xml-parser": "5.4.1",
29
- "@hot-updater/cli-tools": "0.28.0",
30
- "@hot-updater/plugin-core": "0.28.0"
29
+ "@hot-updater/plugin-core": "0.29.0",
30
+ "@hot-updater/cli-tools": "0.29.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^20"