@bacons/apple-targets 3.0.2 → 3.0.3
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/withXcodeChanges.js +84 -0
- 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.
|
|
@@ -877,6 +877,12 @@ async function applyXcodeChanges(config, project, props) {
|
|
|
877
877
|
absolute: false,
|
|
878
878
|
cwd: magicCwd,
|
|
879
879
|
});
|
|
880
|
+
// Also look for global shared assets in the parent targets/_shared directory
|
|
881
|
+
const targetsDir = path_1.default.dirname(magicCwd);
|
|
882
|
+
const globalSharedAssets = (0, glob_1.globSync)("_shared/*", {
|
|
883
|
+
absolute: false,
|
|
884
|
+
cwd: targetsDir,
|
|
885
|
+
});
|
|
880
886
|
let syncRootGroup = protectedGroup.props.children.find((child) => child.props.path === path_1.default.basename(props.cwd));
|
|
881
887
|
if (!syncRootGroup) {
|
|
882
888
|
syncRootGroup = xcode_1.PBXFileSystemSynchronizedRootGroup.create(project, {
|
|
@@ -923,6 +929,84 @@ async function applyXcodeChanges(config, project, props) {
|
|
|
923
929
|
// Remove the exception set if there are no shared assets.
|
|
924
930
|
existingExceptionSet === null || existingExceptionSet === void 0 ? void 0 : existingExceptionSet.removeFromProject();
|
|
925
931
|
}
|
|
932
|
+
function configureTargetWithGlobalSharedAssets(target) {
|
|
933
|
+
var _a;
|
|
934
|
+
var _b;
|
|
935
|
+
if (!globalSharedAssets.length)
|
|
936
|
+
return;
|
|
937
|
+
// 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);
|
|
939
|
+
if (!globalSharedSyncGroup) {
|
|
940
|
+
globalSharedSyncGroup = xcode_1.PBXFileSystemSynchronizedRootGroup.create(project, {
|
|
941
|
+
path: "_shared",
|
|
942
|
+
exceptions: [
|
|
943
|
+
// Create exception set for the main app target
|
|
944
|
+
xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
945
|
+
target: mainAppTarget,
|
|
946
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
947
|
+
}),
|
|
948
|
+
// Create exception set for the extension target
|
|
949
|
+
xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
950
|
+
target: target,
|
|
951
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
952
|
+
}),
|
|
953
|
+
],
|
|
954
|
+
explicitFileTypes: {},
|
|
955
|
+
explicitFolders: [],
|
|
956
|
+
sourceTree: "<group>",
|
|
957
|
+
});
|
|
958
|
+
// Add to both targets' fileSystemSynchronizedGroups
|
|
959
|
+
if (!mainAppTarget.props.fileSystemSynchronizedGroups) {
|
|
960
|
+
mainAppTarget.props.fileSystemSynchronizedGroups = [];
|
|
961
|
+
}
|
|
962
|
+
mainAppTarget.props.fileSystemSynchronizedGroups.push(globalSharedSyncGroup);
|
|
963
|
+
if (!target.props.fileSystemSynchronizedGroups) {
|
|
964
|
+
target.props.fileSystemSynchronizedGroups = [];
|
|
965
|
+
}
|
|
966
|
+
target.props.fileSystemSynchronizedGroups.push(globalSharedSyncGroup);
|
|
967
|
+
protectedGroup.props.children.push(globalSharedSyncGroup);
|
|
968
|
+
}
|
|
969
|
+
else {
|
|
970
|
+
// Update existing synchronized group with current global shared assets
|
|
971
|
+
(_a = (_b = globalSharedSyncGroup.props).exceptions) !== null && _a !== void 0 ? _a : (_b.exceptions = []);
|
|
972
|
+
// Update or create exception set for main app target
|
|
973
|
+
let mainAppExceptionSet = globalSharedSyncGroup.props.exceptions.find((exception) => exception instanceof xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet &&
|
|
974
|
+
exception.props.target === mainAppTarget);
|
|
975
|
+
if (!mainAppExceptionSet) {
|
|
976
|
+
mainAppExceptionSet = xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
977
|
+
target: mainAppTarget,
|
|
978
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
979
|
+
});
|
|
980
|
+
globalSharedSyncGroup.props.exceptions.push(mainAppExceptionSet);
|
|
981
|
+
}
|
|
982
|
+
else {
|
|
983
|
+
mainAppExceptionSet.props.membershipExceptions = globalSharedAssets.sort();
|
|
984
|
+
}
|
|
985
|
+
// Update or create exception set for extension target
|
|
986
|
+
let extensionExceptionSet = globalSharedSyncGroup.props.exceptions.find((exception) => exception instanceof xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet &&
|
|
987
|
+
exception.props.target === target);
|
|
988
|
+
if (!extensionExceptionSet) {
|
|
989
|
+
extensionExceptionSet = xcode_1.PBXFileSystemSynchronizedBuildFileExceptionSet.create(project, {
|
|
990
|
+
target: target,
|
|
991
|
+
membershipExceptions: globalSharedAssets.sort(),
|
|
992
|
+
});
|
|
993
|
+
globalSharedSyncGroup.props.exceptions.push(extensionExceptionSet);
|
|
994
|
+
}
|
|
995
|
+
else {
|
|
996
|
+
extensionExceptionSet.props.membershipExceptions = globalSharedAssets.sort();
|
|
997
|
+
}
|
|
998
|
+
// Ensure the current target has the synchronized group in its fileSystemSynchronizedGroups
|
|
999
|
+
if (!target.props.fileSystemSynchronizedGroups) {
|
|
1000
|
+
target.props.fileSystemSynchronizedGroups = [];
|
|
1001
|
+
}
|
|
1002
|
+
// Check if this target already has the synchronized group
|
|
1003
|
+
const hasGroup = target.props.fileSystemSynchronizedGroups.some((group) => group === globalSharedSyncGroup);
|
|
1004
|
+
if (!hasGroup) {
|
|
1005
|
+
target.props.fileSystemSynchronizedGroups.push(globalSharedSyncGroup);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
configureTargetWithGlobalSharedAssets(targetToUpdate);
|
|
926
1010
|
applyDevelopmentTeamIdToTargets();
|
|
927
1011
|
syncMarketingVersions();
|
|
928
1012
|
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.3",
|
|
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"
|