@bacons/apple-targets 3.0.2 → 3.0.4
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 +2 -0
- package/build/target.js +0 -1
- package/build/withXcodeChanges.js +93 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -178,6 +178,8 @@ The name of the target must match the name of the target directory.
|
|
|
178
178
|
|
|
179
179
|
Some files are required to be linked to both your target and the main target. To support this, you can add a top-level `_shared` directory. Any file in this directory will be linked to both the main target and the sub-target. You'll need to re-run prebuild every time you add, rename, or remove a file in this directory.
|
|
180
180
|
|
|
181
|
+
You can additionally add a `_shared` directory inside of the root `targets/_shared` directory. This will link files to all targets in your project.
|
|
182
|
+
|
|
181
183
|
## `exportJs`
|
|
182
184
|
|
|
183
185
|
The `exportJs` option should be used when the target uses React Native (App Clip, Share extension). It works by linking the main target's `Bundle React Native code and images` build phase to the target. This will ensure that production builds (`Release`) bundle the main JS entry file with Metro, and embed the bundle/assets for offline use.
|
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)",
|
|
@@ -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) {
|
|
@@ -877,6 +883,12 @@ async function applyXcodeChanges(config, project, props) {
|
|
|
877
883
|
absolute: false,
|
|
878
884
|
cwd: magicCwd,
|
|
879
885
|
});
|
|
886
|
+
// Also look for global shared assets in the parent targets/_shared directory
|
|
887
|
+
const targetsDir = path_1.default.dirname(magicCwd);
|
|
888
|
+
const globalSharedAssets = (0, glob_1.globSync)("_shared/*", {
|
|
889
|
+
absolute: false,
|
|
890
|
+
cwd: targetsDir,
|
|
891
|
+
});
|
|
880
892
|
let syncRootGroup = protectedGroup.props.children.find((child) => child.props.path === path_1.default.basename(props.cwd));
|
|
881
893
|
if (!syncRootGroup) {
|
|
882
894
|
syncRootGroup = xcode_1.PBXFileSystemSynchronizedRootGroup.create(project, {
|
|
@@ -923,6 +935,84 @@ async function applyXcodeChanges(config, project, props) {
|
|
|
923
935
|
// Remove the exception set if there are no shared assets.
|
|
924
936
|
existingExceptionSet === null || existingExceptionSet === void 0 ? void 0 : existingExceptionSet.removeFromProject();
|
|
925
937
|
}
|
|
938
|
+
function configureTargetWithGlobalSharedAssets(target) {
|
|
939
|
+
var _a;
|
|
940
|
+
var _b;
|
|
941
|
+
if (!globalSharedAssets.length)
|
|
942
|
+
return;
|
|
943
|
+
// Create or find the global shared synchronized root group
|
|
944
|
+
let globalSharedSyncGroup = protectedGroup.props.children.find((child) => child.props.path === "_shared" && child instanceof xcode_1.PBXFileSystemSynchronizedRootGroup);
|
|
945
|
+
if (!globalSharedSyncGroup) {
|
|
946
|
+
globalSharedSyncGroup = xcode_1.PBXFileSystemSynchronizedRootGroup.create(project, {
|
|
947
|
+
path: "_shared",
|
|
948
|
+
exceptions: [
|
|
949
|
+
// Create exception set for the main app target
|
|
950
|
+
xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
951
|
+
target: mainAppTarget,
|
|
952
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
953
|
+
}),
|
|
954
|
+
// Create exception set for the extension target
|
|
955
|
+
xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
956
|
+
target: target,
|
|
957
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
958
|
+
}),
|
|
959
|
+
],
|
|
960
|
+
explicitFileTypes: {},
|
|
961
|
+
explicitFolders: [],
|
|
962
|
+
sourceTree: "<group>",
|
|
963
|
+
});
|
|
964
|
+
// Add to both targets' fileSystemSynchronizedGroups
|
|
965
|
+
if (!mainAppTarget.props.fileSystemSynchronizedGroups) {
|
|
966
|
+
mainAppTarget.props.fileSystemSynchronizedGroups = [];
|
|
967
|
+
}
|
|
968
|
+
mainAppTarget.props.fileSystemSynchronizedGroups.push(globalSharedSyncGroup);
|
|
969
|
+
if (!target.props.fileSystemSynchronizedGroups) {
|
|
970
|
+
target.props.fileSystemSynchronizedGroups = [];
|
|
971
|
+
}
|
|
972
|
+
target.props.fileSystemSynchronizedGroups.push(globalSharedSyncGroup);
|
|
973
|
+
protectedGroup.props.children.push(globalSharedSyncGroup);
|
|
974
|
+
}
|
|
975
|
+
else {
|
|
976
|
+
// Update existing synchronized group with current global shared assets
|
|
977
|
+
(_a = (_b = globalSharedSyncGroup.props).exceptions) !== null && _a !== void 0 ? _a : (_b.exceptions = []);
|
|
978
|
+
// Update or create exception set for main app target
|
|
979
|
+
let mainAppExceptionSet = globalSharedSyncGroup.props.exceptions.find((exception) => exception instanceof xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet &&
|
|
980
|
+
exception.props.target === mainAppTarget);
|
|
981
|
+
if (!mainAppExceptionSet) {
|
|
982
|
+
mainAppExceptionSet = xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
983
|
+
target: mainAppTarget,
|
|
984
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
985
|
+
});
|
|
986
|
+
globalSharedSyncGroup.props.exceptions.push(mainAppExceptionSet);
|
|
987
|
+
}
|
|
988
|
+
else {
|
|
989
|
+
mainAppExceptionSet.props.membershipExceptions = globalSharedAssets.sort();
|
|
990
|
+
}
|
|
991
|
+
// Update or create exception set for extension target
|
|
992
|
+
let extensionExceptionSet = globalSharedSyncGroup.props.exceptions.find((exception) => exception instanceof xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet &&
|
|
993
|
+
exception.props.target === target);
|
|
994
|
+
if (!extensionExceptionSet) {
|
|
995
|
+
extensionExceptionSet = xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
996
|
+
target: target,
|
|
997
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
998
|
+
});
|
|
999
|
+
globalSharedSyncGroup.props.exceptions.push(extensionExceptionSet);
|
|
1000
|
+
}
|
|
1001
|
+
else {
|
|
1002
|
+
extensionExceptionSet.props.membershipExceptions = globalSharedAssets.sort();
|
|
1003
|
+
}
|
|
1004
|
+
// Ensure the current target has the synchronized group in its fileSystemSynchronizedGroups
|
|
1005
|
+
if (!target.props.fileSystemSynchronizedGroups) {
|
|
1006
|
+
target.props.fileSystemSynchronizedGroups = [];
|
|
1007
|
+
}
|
|
1008
|
+
// Check if this target already has the synchronized group
|
|
1009
|
+
const hasGroup = target.props.fileSystemSynchronizedGroups.some((group) => group === globalSharedSyncGroup);
|
|
1010
|
+
if (!hasGroup) {
|
|
1011
|
+
target.props.fileSystemSynchronizedGroups.push(globalSharedSyncGroup);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
configureTargetWithGlobalSharedAssets(targetToUpdate);
|
|
926
1016
|
applyDevelopmentTeamIdToTargets();
|
|
927
1017
|
syncMarketingVersions();
|
|
928
1018
|
return project;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bacons/apple-targets",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Generate Apple Targets with Expo Prebuild",
|
|
5
5
|
"main": "build/ExtensionStorage.js",
|
|
6
6
|
"types": "build/ExtensionStorage.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"author": "Evan Bacon",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@bacons/xcode": "1.0.0-alpha.
|
|
36
|
+
"@bacons/xcode": "1.0.0-alpha.27",
|
|
37
37
|
"@react-native/normalize-colors": "^0.79.2",
|
|
38
38
|
"glob": "^10.4.2",
|
|
39
39
|
"debug": "^4.3.4"
|