@bacons/apple-targets 3.0.3 → 3.0.5

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 CHANGED
@@ -56,7 +56,10 @@ module.exports = {
56
56
  type: "widget",
57
57
 
58
58
  // Name of the target/product. Defaults to the directory name.
59
- name: "My Widget",
59
+ name: "my_widget",
60
+
61
+ // Optional override for CFBundleDisplayName. Defaults to `name` if not provided.
62
+ displayName: "My Widget",
60
63
 
61
64
  // Generates colorset files for the target.
62
65
  colors: {
@@ -230,7 +233,7 @@ These show up in the share sheet. The icon should be transparent as it will be m
230
233
  /** @type {import('@bacons/apple-targets/app.plugin').Config} */
231
234
  module.exports = {
232
235
  type: "action",
233
- name: "Inspect Element",
236
+ displayName: "Inspect Element",
234
237
  icon: "./assets/icon.png",
235
238
  colors: {
236
239
  TouchBarBezel: "#DB739C",
package/build/config.d.ts CHANGED
@@ -69,6 +69,8 @@ export type Config = {
69
69
  type: ExtensionType;
70
70
  /** Name of the target. Will default to a sanitized version of the directory name. */
71
71
  name?: string;
72
+ /** Optional custom name for `CFBundleDisplayName`. */
73
+ displayName?: string;
72
74
  /**
73
75
  * Bundle identifier for the target. Will default to a sanitized version of the root project + name.
74
76
  * If the specified bundle identifier is prefixed with a dot (.), the bundle identifier will be appended to the main app's bundle identifier.
package/build/target.js CHANGED
@@ -90,7 +90,6 @@ function getTargetInfoPlistForType(type) {
90
90
  return plist_1.default.build({
91
91
  CFBundleName: "$(PRODUCT_NAME)",
92
92
  CFBundleIdentifier: "$(PRODUCT_BUNDLE_IDENTIFIER)",
93
- CFBundleVersion: "$(CURRENT_PROJECT_VERSION)",
94
93
  CFBundleExecutable: "$(EXECUTABLE_NAME)",
95
94
  CFBundlePackageType: "$(PRODUCT_BUNDLE_PACKAGE_TYPE)",
96
95
  CFBundleShortVersionString: "$(MARKETING_VERSION)",
@@ -247,6 +247,7 @@ const withWidget = (config, props) => {
247
247
  productName,
248
248
  configPath: props.configPath,
249
249
  name: targetDisplayName,
250
+ displayName: props.displayName,
250
251
  cwd: "../" +
251
252
  path_1.default.relative(config._internal.projectRoot, path_1.default.resolve(props.directory)),
252
253
  deploymentTarget: (_f = props.deploymentTarget) !== null && _f !== void 0 ? _f : DEFAULT_DEPLOYMENT_TARGET,
@@ -2,6 +2,8 @@ import { ConfigPlugin } from "@expo/config-plugins";
2
2
  import { ExtensionType } from "./target";
3
3
  export type XcodeSettings = {
4
4
  name: string;
5
+ /** Optional custom value for CFBundleDisplayName */
6
+ displayName?: string;
5
7
  /** Name used for internal purposes. This has more strict rules and should be generated. */
6
8
  productName: string;
7
9
  /** Directory relative to the project root, (i.e. outside of the `ios` directory) where the widget code should live. */
@@ -20,7 +20,7 @@ const withXcodeChanges = (config, props) => {
20
20
  });
21
21
  };
22
22
  exports.withXcodeChanges = withXcodeChanges;
23
- function createNotificationContentConfigurationList(project, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
23
+ function createNotificationContentConfigurationList(project, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
24
24
  const common = {
25
25
  CLANG_ANALYZER_NONNULL: "YES",
26
26
  CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION: "YES_AGGRESSIVE",
@@ -36,7 +36,7 @@ function createNotificationContentConfigurationList(project, { name, cwd, bundle
36
36
  GENERATE_INFOPLIST_FILE: "YES",
37
37
  CURRENT_PROJECT_VERSION: currentProjectVersion,
38
38
  INFOPLIST_FILE: cwd + "/Info.plist",
39
- INFOPLIST_KEY_CFBundleDisplayName: name,
39
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
40
40
  INFOPLIST_KEY_NSHumanReadableCopyright: "",
41
41
  IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
42
42
  LD_RUNPATH_SEARCH_PATHS: [
@@ -82,7 +82,7 @@ function createNotificationContentConfigurationList(project, { name, cwd, bundle
82
82
  }
83
83
  function createExtensionConfigurationListFromTemplate(project,
84
84
  // NSExtensionPointIdentifier
85
- extensionType, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, icon, }) {
85
+ extensionType, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, icon, }) {
86
86
  if (!TemplateBuildSettings[extensionType]) {
87
87
  throw new Error(`No template for extension type ${extensionType}. Add it to the xcode project and re-run the generation script.`);
88
88
  }
@@ -90,7 +90,7 @@ extensionType, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, i
90
90
  const dynamic = {
91
91
  CURRENT_PROJECT_VERSION: currentProjectVersion,
92
92
  INFOPLIST_FILE: cwd + "/Info.plist",
93
- INFOPLIST_KEY_CFBundleDisplayName: name,
93
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
94
94
  IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
95
95
  PRODUCT_BUNDLE_IDENTIFIER: bundleId,
96
96
  };
@@ -121,7 +121,7 @@ extensionType, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, i
121
121
  });
122
122
  return configurationList;
123
123
  }
124
- function createAppIntentConfigurationList(project, { name, cwd, bundleId }) {
124
+ function createAppIntentConfigurationList(project, { name, displayName, cwd, bundleId }) {
125
125
  const commonBuildSettings = {
126
126
  // @ts-expect-error
127
127
  ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: "YES",
@@ -139,7 +139,7 @@ function createAppIntentConfigurationList(project, { name, cwd, bundleId }) {
139
139
  GCC_C_LANGUAGE_STANDARD: "gnu17",
140
140
  GENERATE_INFOPLIST_FILE: "YES",
141
141
  INFOPLIST_FILE: cwd + "/Info.plist",
142
- INFOPLIST_KEY_CFBundleDisplayName: name,
142
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
143
143
  INFOPLIST_KEY_NSHumanReadableCopyright: "",
144
144
  IPHONEOS_DEPLOYMENT_TARGET: "17.0",
145
145
  LD_RUNPATH_SEARCH_PATHS: [
@@ -183,7 +183,7 @@ function createAppIntentConfigurationList(project, { name, cwd, bundleId }) {
183
183
  });
184
184
  return configurationList;
185
185
  }
186
- function createShareConfigurationList(project, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
186
+ function createShareConfigurationList(project, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
187
187
  const common = {
188
188
  CLANG_ANALYZER_NONNULL: "YES",
189
189
  CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION: "YES_AGGRESSIVE",
@@ -198,7 +198,7 @@ function createShareConfigurationList(project, { name, cwd, bundleId, deployment
198
198
  GENERATE_INFOPLIST_FILE: "YES",
199
199
  CURRENT_PROJECT_VERSION: currentProjectVersion,
200
200
  INFOPLIST_FILE: cwd + "/Info.plist",
201
- INFOPLIST_KEY_CFBundleDisplayName: name,
201
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
202
202
  INFOPLIST_KEY_NSHumanReadableCopyright: "",
203
203
  IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
204
204
  LD_RUNPATH_SEARCH_PATHS: [
@@ -253,7 +253,7 @@ function getMainMarketingVersion(project) {
253
253
  }
254
254
  return version;
255
255
  }
256
- function createIMessageConfigurationList(project, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
256
+ function createIMessageConfigurationList(project, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
257
257
  const common = {
258
258
  ASSETCATALOG_COMPILER_APPICON_NAME: "iMessage App Icon",
259
259
  CLANG_ANALYZER_NONNULL: "YES",
@@ -269,7 +269,7 @@ function createIMessageConfigurationList(project, { name, cwd, bundleId, deploym
269
269
  GENERATE_INFOPLIST_FILE: "YES",
270
270
  CURRENT_PROJECT_VERSION: currentProjectVersion,
271
271
  INFOPLIST_FILE: cwd + "/Info.plist",
272
- INFOPLIST_KEY_CFBundleDisplayName: name,
272
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
273
273
  INFOPLIST_KEY_NSHumanReadableCopyright: "",
274
274
  IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
275
275
  LD_RUNPATH_SEARCH_PATHS: [
@@ -311,7 +311,7 @@ function createIMessageConfigurationList(project, { name, cwd, bundleId, deploym
311
311
  });
312
312
  return configurationList;
313
313
  }
314
- function createWatchAppConfigurationList(project, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, hasAccentColor, }) {
314
+ function createWatchAppConfigurationList(project, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, hasAccentColor, }) {
315
315
  const mainAppTarget = (0, target_1.getMainAppTarget)(project).getDefaultConfiguration();
316
316
  // NOTE: No base Info.plist needed.
317
317
  const common = {
@@ -329,7 +329,7 @@ function createWatchAppConfigurationList(project, { name, cwd, bundleId, deploym
329
329
  GCC_C_LANGUAGE_STANDARD: "gnu11",
330
330
  INFOPLIST_FILE: cwd + "/Info.plist",
331
331
  GENERATE_INFOPLIST_FILE: "YES",
332
- INFOPLIST_KEY_CFBundleDisplayName: name,
332
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
333
333
  INFOPLIST_KEY_UISupportedInterfaceOrientations: "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown",
334
334
  INFOPLIST_KEY_WKCompanionAppBundleIdentifier: mainAppTarget.props.buildSettings.PRODUCT_BUNDLE_IDENTIFIER,
335
335
  // INFOPLIST_KEY_WKCompanionAppBundleIdentifier: "$(BUNDLE_IDENTIFIER)",
@@ -379,7 +379,7 @@ function createWatchAppConfigurationList(project, { name, cwd, bundleId, deploym
379
379
  });
380
380
  return configurationList;
381
381
  }
382
- function createSafariConfigurationList(project, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
382
+ function createSafariConfigurationList(project, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
383
383
  const common = {
384
384
  CLANG_ANALYZER_NONNULL: "YES",
385
385
  CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION: "YES_AGGRESSIVE",
@@ -393,7 +393,7 @@ function createSafariConfigurationList(project, { name, cwd, bundleId, deploymen
393
393
  GENERATE_INFOPLIST_FILE: "YES",
394
394
  CURRENT_PROJECT_VERSION: currentProjectVersion,
395
395
  INFOPLIST_FILE: cwd + "/Info.plist",
396
- INFOPLIST_KEY_CFBundleDisplayName: name,
396
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
397
397
  INFOPLIST_KEY_NSHumanReadableCopyright: "",
398
398
  IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
399
399
  LD_RUNPATH_SEARCH_PATHS: [
@@ -440,12 +440,12 @@ function createSafariConfigurationList(project, { name, cwd, bundleId, deploymen
440
440
  });
441
441
  return configurationList;
442
442
  }
443
- function createAppClipConfigurationList(project, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, hasAccentColor, orientation, deviceFamilies, }) {
443
+ function createAppClipConfigurationList(project, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, hasAccentColor, orientation, deviceFamilies, }) {
444
444
  // TODO: Unify AppIcon and AccentColor logic
445
445
  const dynamic = {
446
446
  CURRENT_PROJECT_VERSION: currentProjectVersion,
447
447
  INFOPLIST_FILE: cwd + "/Info.plist",
448
- INFOPLIST_KEY_CFBundleDisplayName: name,
448
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
449
449
  IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
450
450
  MARKETING_VERSION: "1.0",
451
451
  PRODUCT_BUNDLE_IDENTIFIER: bundleId,
@@ -475,8 +475,15 @@ function createAppClipConfigurationList(project, { name, cwd, bundleId, deployme
475
475
  INFOPLIST_KEY_UIApplicationSceneManifest_Generation: "YES",
476
476
  INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents: "YES",
477
477
  INFOPLIST_KEY_UILaunchScreen_Generation: "YES",
478
+ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad: "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight",
478
479
  ...getOrientationBuildSettings(orientation),
479
480
  };
481
+ // Attempt to automatically set the build number to match the main app.
482
+ // This only works with EAS Build, other processes can simply set the number manually.
483
+ if (process.env.EAS_BUILD_IOS_BUILD_NUMBER) {
484
+ // NOTE: INFOPLIST_KEY_CFBundleVersion doesn't work here.
485
+ infoPlist.CURRENT_PROJECT_VERSION = process.env.EAS_BUILD_IOS_BUILD_NUMBER;
486
+ }
480
487
  // @ts-expect-error
481
488
  const common = {
482
489
  ...dynamic,
@@ -517,22 +524,21 @@ function createAppClipConfigurationList(project, { name, cwd, bundleId, deployme
517
524
  return configurationList;
518
525
  }
519
526
  function getOrientationBuildSettings(orientation) {
527
+ // NOTE: The requiresFullScreen support is deprecated in iOS 26+
528
+ // https://developer.apple.com/documentation/BundleResources/Information-Property-List/UIRequiresFullScreen
520
529
  // Try to align the orientation with the main app.
521
530
  if (orientation === "landscape") {
522
531
  return {
523
532
  INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone: "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight",
524
- INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad: "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight",
525
533
  };
526
534
  }
527
535
  else if (orientation === "portrait") {
528
536
  return {
529
537
  INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone: "UIInterfaceOrientationPortrait",
530
- INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad: "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown",
531
538
  };
532
539
  }
533
540
  return {
534
541
  INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone: "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight",
535
- INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad: "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight",
536
542
  };
537
543
  }
538
544
  function getDeviceFamilyBuildSettings(deviceFamilies) {
@@ -552,7 +558,7 @@ function getDeviceFamilyBuildSettings(deviceFamilies) {
552
558
  TARGETED_DEVICE_FAMILY: families.join(","),
553
559
  };
554
560
  }
555
- function createWidgetConfigurationList(project, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
561
+ function createWidgetConfigurationList(project, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
556
562
  const debugBuildConfig = xcode_1.XCBuildConfiguration.create(project, {
557
563
  name: "Debug",
558
564
  buildSettings: {
@@ -571,7 +577,7 @@ function createWidgetConfigurationList(project, { name, cwd, bundleId, deploymen
571
577
  GCC_C_LANGUAGE_STANDARD: "gnu11",
572
578
  GENERATE_INFOPLIST_FILE: "YES",
573
579
  INFOPLIST_FILE: cwd + "/Info.plist",
574
- INFOPLIST_KEY_CFBundleDisplayName: name,
580
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
575
581
  INFOPLIST_KEY_NSHumanReadableCopyright: "",
576
582
  IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
577
583
  LD_RUNPATH_SEARCH_PATHS: [
@@ -611,7 +617,7 @@ function createWidgetConfigurationList(project, { name, cwd, bundleId, deploymen
611
617
  GCC_C_LANGUAGE_STANDARD: "gnu11",
612
618
  GENERATE_INFOPLIST_FILE: "YES",
613
619
  INFOPLIST_FILE: cwd + "/Info.plist",
614
- INFOPLIST_KEY_CFBundleDisplayName: name,
620
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
615
621
  INFOPLIST_KEY_NSHumanReadableCopyright: "",
616
622
  IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
617
623
  LD_RUNPATH_SEARCH_PATHS: [
@@ -935,7 +941,8 @@ async function applyXcodeChanges(config, project, props) {
935
941
  if (!globalSharedAssets.length)
936
942
  return;
937
943
  // Create or find the global shared synchronized root group
938
- let globalSharedSyncGroup = protectedGroup.props.children.find((child) => child.props.path === "_shared" && child instanceof xcode_1.PBXFileSystemSynchronizedRootGroup);
944
+ let globalSharedSyncGroup = protectedGroup.props.children.find((child) => child.props.path === "_shared" &&
945
+ child instanceof xcode_1.PBXFileSystemSynchronizedRootGroup);
939
946
  if (!globalSharedSyncGroup) {
940
947
  globalSharedSyncGroup = xcode_1.PBXFileSystemSynchronizedRootGroup.create(project, {
941
948
  path: "_shared",
@@ -973,27 +980,31 @@ async function applyXcodeChanges(config, project, props) {
973
980
  let mainAppExceptionSet = globalSharedSyncGroup.props.exceptions.find((exception) => exception instanceof xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet &&
974
981
  exception.props.target === mainAppTarget);
975
982
  if (!mainAppExceptionSet) {
976
- mainAppExceptionSet = xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
977
- target: mainAppTarget,
978
- membershipExceptions: globalSharedAssets.sort(),
979
- });
983
+ mainAppExceptionSet =
984
+ xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
985
+ target: mainAppTarget,
986
+ membershipExceptions: globalSharedAssets.sort(),
987
+ });
980
988
  globalSharedSyncGroup.props.exceptions.push(mainAppExceptionSet);
981
989
  }
982
990
  else {
983
- mainAppExceptionSet.props.membershipExceptions = globalSharedAssets.sort();
991
+ mainAppExceptionSet.props.membershipExceptions =
992
+ globalSharedAssets.sort();
984
993
  }
985
994
  // Update or create exception set for extension target
986
995
  let extensionExceptionSet = globalSharedSyncGroup.props.exceptions.find((exception) => exception instanceof xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet &&
987
996
  exception.props.target === target);
988
997
  if (!extensionExceptionSet) {
989
- extensionExceptionSet = xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
990
- target: target,
991
- membershipExceptions: globalSharedAssets.sort(),
992
- });
998
+ extensionExceptionSet =
999
+ xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
1000
+ target: target,
1001
+ membershipExceptions: globalSharedAssets.sort(),
1002
+ });
993
1003
  globalSharedSyncGroup.props.exceptions.push(extensionExceptionSet);
994
1004
  }
995
1005
  else {
996
- extensionExceptionSet.props.membershipExceptions = globalSharedAssets.sort();
1006
+ extensionExceptionSet.props.membershipExceptions =
1007
+ globalSharedAssets.sort();
997
1008
  }
998
1009
  // Ensure the current target has the synchronized group in its fileSystemSynchronizedGroups
999
1010
  if (!target.props.fileSystemSynchronizedGroups) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bacons/apple-targets",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "description": "Generate Apple Targets with Expo Prebuild",
5
5
  "main": "build/ExtensionStorage.js",
6
6
  "types": "build/ExtensionStorage.d.ts",