@bacons/apple-targets 3.0.4 → 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 +5 -2
- package/build/config.d.ts +2 -0
- package/build/withWidget.js +1 -0
- package/build/withXcodeChanges.d.ts +2 -0
- package/build/withXcodeChanges.js +36 -31
- package/package.json +1 -1
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: "
|
|
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
|
-
|
|
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/withWidget.js
CHANGED
|
@@ -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,
|
|
@@ -478,7 +478,7 @@ function createAppClipConfigurationList(project, { name, cwd, bundleId, deployme
|
|
|
478
478
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad: "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight",
|
|
479
479
|
...getOrientationBuildSettings(orientation),
|
|
480
480
|
};
|
|
481
|
-
// Attempt to automatically set the build number to match the main app.
|
|
481
|
+
// Attempt to automatically set the build number to match the main app.
|
|
482
482
|
// This only works with EAS Build, other processes can simply set the number manually.
|
|
483
483
|
if (process.env.EAS_BUILD_IOS_BUILD_NUMBER) {
|
|
484
484
|
// NOTE: INFOPLIST_KEY_CFBundleVersion doesn't work here.
|
|
@@ -558,7 +558,7 @@ function getDeviceFamilyBuildSettings(deviceFamilies) {
|
|
|
558
558
|
TARGETED_DEVICE_FAMILY: families.join(","),
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
|
-
function createWidgetConfigurationList(project, { name, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
|
|
561
|
+
function createWidgetConfigurationList(project, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
|
|
562
562
|
const debugBuildConfig = xcode_1.XCBuildConfiguration.create(project, {
|
|
563
563
|
name: "Debug",
|
|
564
564
|
buildSettings: {
|
|
@@ -577,7 +577,7 @@ function createWidgetConfigurationList(project, { name, cwd, bundleId, deploymen
|
|
|
577
577
|
GCC_C_LANGUAGE_STANDARD: "gnu11",
|
|
578
578
|
GENERATE_INFOPLIST_FILE: "YES",
|
|
579
579
|
INFOPLIST_FILE: cwd + "/Info.plist",
|
|
580
|
-
INFOPLIST_KEY_CFBundleDisplayName: name,
|
|
580
|
+
INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
|
|
581
581
|
INFOPLIST_KEY_NSHumanReadableCopyright: "",
|
|
582
582
|
IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
|
|
583
583
|
LD_RUNPATH_SEARCH_PATHS: [
|
|
@@ -617,7 +617,7 @@ function createWidgetConfigurationList(project, { name, cwd, bundleId, deploymen
|
|
|
617
617
|
GCC_C_LANGUAGE_STANDARD: "gnu11",
|
|
618
618
|
GENERATE_INFOPLIST_FILE: "YES",
|
|
619
619
|
INFOPLIST_FILE: cwd + "/Info.plist",
|
|
620
|
-
INFOPLIST_KEY_CFBundleDisplayName: name,
|
|
620
|
+
INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
|
|
621
621
|
INFOPLIST_KEY_NSHumanReadableCopyright: "",
|
|
622
622
|
IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
|
|
623
623
|
LD_RUNPATH_SEARCH_PATHS: [
|
|
@@ -941,7 +941,8 @@ async function applyXcodeChanges(config, project, props) {
|
|
|
941
941
|
if (!globalSharedAssets.length)
|
|
942
942
|
return;
|
|
943
943
|
// Create or find the global shared synchronized root group
|
|
944
|
-
let globalSharedSyncGroup = protectedGroup.props.children.find((child) => child.props.path === "_shared" &&
|
|
944
|
+
let globalSharedSyncGroup = protectedGroup.props.children.find((child) => child.props.path === "_shared" &&
|
|
945
|
+
child instanceof xcode_1.PBXFileSystemSynchronizedRootGroup);
|
|
945
946
|
if (!globalSharedSyncGroup) {
|
|
946
947
|
globalSharedSyncGroup = xcode_1.PBXFileSystemSynchronizedRootGroup.create(project, {
|
|
947
948
|
path: "_shared",
|
|
@@ -979,27 +980,31 @@ async function applyXcodeChanges(config, project, props) {
|
|
|
979
980
|
let mainAppExceptionSet = globalSharedSyncGroup.props.exceptions.find((exception) => exception instanceof xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet &&
|
|
980
981
|
exception.props.target === mainAppTarget);
|
|
981
982
|
if (!mainAppExceptionSet) {
|
|
982
|
-
mainAppExceptionSet =
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
983
|
+
mainAppExceptionSet =
|
|
984
|
+
xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
985
|
+
target: mainAppTarget,
|
|
986
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
987
|
+
});
|
|
986
988
|
globalSharedSyncGroup.props.exceptions.push(mainAppExceptionSet);
|
|
987
989
|
}
|
|
988
990
|
else {
|
|
989
|
-
mainAppExceptionSet.props.membershipExceptions =
|
|
991
|
+
mainAppExceptionSet.props.membershipExceptions =
|
|
992
|
+
globalSharedAssets.sort();
|
|
990
993
|
}
|
|
991
994
|
// Update or create exception set for extension target
|
|
992
995
|
let extensionExceptionSet = globalSharedSyncGroup.props.exceptions.find((exception) => exception instanceof xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet &&
|
|
993
996
|
exception.props.target === target);
|
|
994
997
|
if (!extensionExceptionSet) {
|
|
995
|
-
extensionExceptionSet =
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
998
|
+
extensionExceptionSet =
|
|
999
|
+
xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
1000
|
+
target: target,
|
|
1001
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
1002
|
+
});
|
|
999
1003
|
globalSharedSyncGroup.props.exceptions.push(extensionExceptionSet);
|
|
1000
1004
|
}
|
|
1001
1005
|
else {
|
|
1002
|
-
extensionExceptionSet.props.membershipExceptions =
|
|
1006
|
+
extensionExceptionSet.props.membershipExceptions =
|
|
1007
|
+
globalSharedAssets.sort();
|
|
1003
1008
|
}
|
|
1004
1009
|
// Ensure the current target has the synchronized group in its fileSystemSynchronizedGroups
|
|
1005
1010
|
if (!target.props.fileSystemSynchronizedGroups) {
|