react-native-ios-widget 0.0.11 → 0.0.12
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/build/index.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +4 -4
- package/plugin/build/lib/getWidgetExtensionEntitlements.d.ts +1 -1
- package/plugin/build/lib/getWidgetFiles.d.ts +1 -1
- package/plugin/build/lib/getWidgetFiles.js +31 -12
- package/plugin/build/tsconfig.tsbuildinfo +1 -0
- package/plugin/build/withPodfile.js +17 -7
- package/plugin/build/withWidgetExtensionEntitlements.js +17 -7
- package/plugin/build/withXcode.js +21 -10
- package/plugin/build/xcode/addBuildPhases.js +18 -9
- package/plugin/build/xcode/addPbxGroup.js +1 -2
- package/plugin/build/xcode/addProductFile.js +1 -2
- package/plugin/build/xcode/addTargetDependency.js +1 -2
- package/plugin/build/xcode/addToPbxNativeTargetSection.js +1 -2
- package/plugin/build/xcode/addToPbxProjectSection.js +1 -2
- package/plugin/build/xcode/addXCConfigurationList.js +1 -2
- package/plugin/src/lib/getWidgetFiles.ts +22 -8
- package/plugin/src/withXcode.ts +10 -4
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE;IAC3B,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE;IAC3B,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,EAAE,CAAC;AAEL,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;IAC3C,IAAI,CAAC,cAAc,IAAI,CAAC,UAAU,EAAE,CAAC;QACnC,OAAO;IACT,CAAC;IAED,MAAM,UAAU,CAAC,kBAAkB,EAAE,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import { Platform } from \"react-native\";\nimport ExpoWidget from \"./ExpoModule\";\n\nconst supportWidgets = (() => {\n if (Platform.OS === \"ios\") {\n return parseInt(Platform.Version, 10) >= 14;\n }\n\n return false;\n})();\n\nexport const reloadAllTimelines = async () => {\n if (!supportWidgets || !ExpoWidget) {\n return;\n }\n\n await ExpoWidget.reloadAllTimelines();\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/expomodule.ts","../src/index.ts"],"version":"5.9.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ios-widget",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Expo config plugin to add widgets to a React Native app",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"homepage": "https://github.com/adrianso/react-native-ios-widget",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@expo/config-plugins": "~
|
|
25
|
+
"@expo/config-plugins": "~54.0.4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/jest": "^29.5.2",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"jest": "^29.6.1",
|
|
36
36
|
"react": "18.2.0",
|
|
37
37
|
"react-native": "0.72.3",
|
|
38
|
-
"typescript": "5.
|
|
38
|
+
"typescript": "5.9.3"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"expo": "*",
|
|
@@ -45,4 +45,4 @@
|
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=18.16.0"
|
|
47
47
|
}
|
|
48
|
-
}
|
|
48
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportedConfig, InfoPlist } from "expo/config-plugins";
|
|
2
2
|
export declare const getWidgetExtensionEntitlements: (iosConfig: ExportedConfig["ios"], { groupIdentifier, }: {
|
|
3
|
-
groupIdentifier?: string
|
|
3
|
+
groupIdentifier?: string;
|
|
4
4
|
}) => InfoPlist;
|
|
5
5
|
export declare const addApplicationGroupsEntitlement: (entitlements: InfoPlist, groupIdentifier?: string) => InfoPlist;
|
|
@@ -5,4 +5,4 @@ export type WidgetFiles = {
|
|
|
5
5
|
fontFiles: string[];
|
|
6
6
|
assetDirectories: string[];
|
|
7
7
|
};
|
|
8
|
-
export declare const getWidgetFiles: (widgetsPath: string, targetPath: string) => WidgetFiles;
|
|
8
|
+
export declare const getWidgetFiles: (widgetsPath: string, targetPath: string, moduleRoot: string) => WidgetFiles;
|
|
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.getWidgetFiles = void 0;
|
|
27
37
|
const fs = __importStar(require("fs"));
|
|
28
38
|
const path = __importStar(require("path"));
|
|
29
|
-
const getWidgetFiles = (widgetsPath, targetPath) => {
|
|
39
|
+
const getWidgetFiles = (widgetsPath, targetPath, moduleRoot) => {
|
|
30
40
|
const widgetFiles = {
|
|
31
41
|
swiftFiles: [],
|
|
32
42
|
entitlementFiles: [],
|
|
@@ -37,6 +47,16 @@ const getWidgetFiles = (widgetsPath, targetPath) => {
|
|
|
37
47
|
if (!fs.existsSync(targetPath)) {
|
|
38
48
|
fs.mkdirSync(targetPath, { recursive: true });
|
|
39
49
|
}
|
|
50
|
+
// Ensure moduleRoot directory exists
|
|
51
|
+
if (!fs.existsSync(moduleRoot)) {
|
|
52
|
+
fs.mkdirSync(moduleRoot, { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
// Check if Module.swift exists before proceeding
|
|
55
|
+
const moduleSwiftPath = path.join(widgetsPath, "Module.swift");
|
|
56
|
+
if (!fs.existsSync(moduleSwiftPath)) {
|
|
57
|
+
throw new Error(`Module.swift not found at ${moduleSwiftPath}. ` +
|
|
58
|
+
`The widgets folder must contain a Module.swift file for the ReactNativeWidgetExtension module to build correctly.`);
|
|
59
|
+
}
|
|
40
60
|
if (fs.lstatSync(widgetsPath).isDirectory()) {
|
|
41
61
|
const files = fs.readdirSync(widgetsPath);
|
|
42
62
|
files.forEach((file) => {
|
|
@@ -70,9 +90,8 @@ const getWidgetFiles = (widgetsPath, targetPath) => {
|
|
|
70
90
|
const source = path.join(widgetsPath, file);
|
|
71
91
|
copyFileSync(source, targetPath);
|
|
72
92
|
});
|
|
73
|
-
// Copy Module.swift
|
|
74
|
-
|
|
75
|
-
copyFileSync(path.join(widgetsPath, "Module.swift"), path.join(modulePath, "Module.swift"));
|
|
93
|
+
// Copy Module.swift to moduleRoot (package ios directory)
|
|
94
|
+
copyFileSync(moduleSwiftPath, path.join(moduleRoot, "Module.swift"));
|
|
76
95
|
// Copy directories
|
|
77
96
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
78
97
|
const imagesXcassetsSource = path.join(widgetsPath, directory);
|
|
@@ -86,7 +105,7 @@ const copyFileSync = (source, target) => {
|
|
|
86
105
|
if (fs.existsSync(target) && fs.lstatSync(target).isDirectory()) {
|
|
87
106
|
targetFile = path.join(target, path.basename(source));
|
|
88
107
|
}
|
|
89
|
-
fs.
|
|
108
|
+
fs.copyFileSync(source, targetFile);
|
|
90
109
|
};
|
|
91
110
|
const copyDirectorySync = (source, target) => {
|
|
92
111
|
const targetPath = path.join(target, path.basename(source));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/index.ts","../src/types.ts","../src/withconfig.ts","../src/withpodfile.ts","../src/withwidgetextensionentitlements.ts","../src/withxcode.ts","../src/lib/getwidgetextensionentitlements.ts","../src/lib/getwidgetfiles.ts","../src/xcode/addbuildphases.ts","../src/xcode/addpbxgroup.ts","../src/xcode/addproductfile.ts","../src/xcode/addtargetdependency.ts","../src/xcode/addtopbxnativetargetsection.ts","../src/xcode/addtopbxprojectsection.ts","../src/xcode/addxcconfigurationlist.ts"],"version":"5.9.3"}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.withPodfile = void 0;
|
|
27
37
|
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.withXcode = void 0;
|
|
27
37
|
const config_plugins_1 = require("expo/config-plugins");
|
|
@@ -37,12 +47,13 @@ const getWidgetFiles_1 = require("./lib/getWidgetFiles");
|
|
|
37
47
|
const withXcode = (config, { enabled, targetName, bundleIdentifier, deploymentTarget, widgetsFolder }) => {
|
|
38
48
|
return (0, config_plugins_1.withXcodeProject)(config, (config) => {
|
|
39
49
|
const { platformProjectRoot, projectRoot } = config.modRequest;
|
|
40
|
-
const widgetsPath = path.join(projectRoot, widgetsFolder);
|
|
41
|
-
const targetPath = path.join(platformProjectRoot, targetName);
|
|
42
|
-
const widgetFiles = (0, getWidgetFiles_1.getWidgetFiles)(widgetsPath, targetPath);
|
|
43
50
|
if (!enabled) {
|
|
44
51
|
return config;
|
|
45
52
|
}
|
|
53
|
+
const widgetsPath = path.join(projectRoot, widgetsFolder);
|
|
54
|
+
const targetPath = path.join(platformProjectRoot, targetName);
|
|
55
|
+
const moduleRoot = path.join(projectRoot, "node_modules", "react-native-ios-widget", "ios");
|
|
56
|
+
const widgetFiles = (0, getWidgetFiles_1.getWidgetFiles)(widgetsPath, targetPath, moduleRoot);
|
|
46
57
|
const xcodeProject = config.modResults;
|
|
47
58
|
const marketingVersion = config.version;
|
|
48
59
|
const xCConfigurationList = (0, addXCConfigurationList_1.addXCConfigurationList)(xcodeProject, {
|
|
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.addBuildPhases =
|
|
36
|
+
exports.addBuildPhases = addBuildPhases;
|
|
27
37
|
const util = __importStar(require("util"));
|
|
28
38
|
function addBuildPhases(xcodeProject, { targetUuid, groupName, productFile, widgetFiles, }) {
|
|
29
39
|
const buildPath = `""`;
|
|
@@ -45,4 +55,3 @@ function addBuildPhases(xcodeProject, { targetUuid, groupName, productFile, widg
|
|
|
45
55
|
// Resources build phase
|
|
46
56
|
xcodeProject.addBuildPhase([...assetDirectories, ...fontFiles], "PBXResourcesBuildPhase", groupName, targetUuid, folderType, buildPath);
|
|
47
57
|
}
|
|
48
|
-
exports.addBuildPhases = addBuildPhases;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addPbxGroup =
|
|
3
|
+
exports.addPbxGroup = addPbxGroup;
|
|
4
4
|
function addPbxGroup(xcodeProject, { targetName, widgetFiles, }) {
|
|
5
5
|
const { swiftFiles, assetDirectories, entitlementFiles, plistFiles, fontFiles, } = widgetFiles;
|
|
6
6
|
// Add PBX group
|
|
@@ -22,4 +22,3 @@ function addPbxGroup(xcodeProject, { targetName, widgetFiles, }) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
exports.addPbxGroup = addPbxGroup;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addProductFile =
|
|
3
|
+
exports.addProductFile = addProductFile;
|
|
4
4
|
function addProductFile(xcodeProject, { targetName, groupName }) {
|
|
5
5
|
const options = {
|
|
6
6
|
basename: `${targetName}.appex`,
|
|
@@ -19,4 +19,3 @@ function addProductFile(xcodeProject, { targetName, groupName }) {
|
|
|
19
19
|
const productFile = xcodeProject.addProductFile(targetName, options);
|
|
20
20
|
return productFile;
|
|
21
21
|
}
|
|
22
|
-
exports.addProductFile = addProductFile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addTargetDependency =
|
|
3
|
+
exports.addTargetDependency = addTargetDependency;
|
|
4
4
|
function addTargetDependency(xcodeProject, target) {
|
|
5
5
|
if (!xcodeProject.hash.project.objects["PBXTargetDependency"]) {
|
|
6
6
|
xcodeProject.hash.project.objects["PBXTargetDependency"] = {};
|
|
@@ -12,4 +12,3 @@ function addTargetDependency(xcodeProject, target) {
|
|
|
12
12
|
target.uuid,
|
|
13
13
|
]);
|
|
14
14
|
}
|
|
15
|
-
exports.addTargetDependency = addTargetDependency;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addToPbxNativeTargetSection =
|
|
3
|
+
exports.addToPbxNativeTargetSection = addToPbxNativeTargetSection;
|
|
4
4
|
function addToPbxNativeTargetSection(xcodeProject, { targetName, targetUuid, productFile, xCConfigurationList, }) {
|
|
5
5
|
const target = {
|
|
6
6
|
uuid: targetUuid,
|
|
@@ -27,4 +27,3 @@ function addToPbxNativeTargetSection(xcodeProject, { targetName, targetUuid, pro
|
|
|
27
27
|
); */
|
|
28
28
|
return target;
|
|
29
29
|
}
|
|
30
|
-
exports.addToPbxNativeTargetSection = addToPbxNativeTargetSection;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addToPbxProjectSection =
|
|
3
|
+
exports.addToPbxProjectSection = addToPbxProjectSection;
|
|
4
4
|
function addToPbxProjectSection(xcodeProject, target) {
|
|
5
5
|
xcodeProject.addToPbxProjectSection(target);
|
|
6
6
|
// Add target attributes to project section
|
|
@@ -12,4 +12,3 @@ function addToPbxProjectSection(xcodeProject, target) {
|
|
|
12
12
|
LastSwiftMigration: 1250,
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
exports.addToPbxProjectSection = addToPbxProjectSection;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addXCConfigurationList =
|
|
3
|
+
exports.addXCConfigurationList = addXCConfigurationList;
|
|
4
4
|
function addXCConfigurationList(xcodeProject, { targetName, currentProjectVersion, bundleIdentifier, deploymentTarget, marketingVersion, }) {
|
|
5
5
|
const commonBuildSettings = {
|
|
6
6
|
/* ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
|
@@ -59,4 +59,3 @@ function addXCConfigurationList(xcodeProject, { targetName, currentProjectVersio
|
|
|
59
59
|
const xCConfigurationList = xcodeProject.addXCConfigurationList(buildConfigurationsList, "Release", `Build configuration list for PBXNativeTarget "${targetName}"`);
|
|
60
60
|
return xCConfigurationList;
|
|
61
61
|
}
|
|
62
|
-
exports.addXCConfigurationList = addXCConfigurationList;
|
|
@@ -9,7 +9,11 @@ export type WidgetFiles = {
|
|
|
9
9
|
assetDirectories: string[];
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export const getWidgetFiles = (
|
|
12
|
+
export const getWidgetFiles = (
|
|
13
|
+
widgetsPath: string,
|
|
14
|
+
targetPath: string,
|
|
15
|
+
moduleRoot: string
|
|
16
|
+
) => {
|
|
13
17
|
const widgetFiles: WidgetFiles = {
|
|
14
18
|
swiftFiles: [],
|
|
15
19
|
entitlementFiles: [],
|
|
@@ -22,6 +26,20 @@ export const getWidgetFiles = (widgetsPath: string, targetPath: string) => {
|
|
|
22
26
|
fs.mkdirSync(targetPath, { recursive: true });
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
// Ensure moduleRoot directory exists
|
|
30
|
+
if (!fs.existsSync(moduleRoot)) {
|
|
31
|
+
fs.mkdirSync(moduleRoot, { recursive: true });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Check if Module.swift exists before proceeding
|
|
35
|
+
const moduleSwiftPath = path.join(widgetsPath, "Module.swift");
|
|
36
|
+
if (!fs.existsSync(moduleSwiftPath)) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`Module.swift not found at ${moduleSwiftPath}. ` +
|
|
39
|
+
`The widgets folder must contain a Module.swift file for the ReactNativeWidgetExtension module to build correctly.`
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
25
43
|
if (fs.lstatSync(widgetsPath).isDirectory()) {
|
|
26
44
|
const files = fs.readdirSync(widgetsPath);
|
|
27
45
|
|
|
@@ -55,12 +73,8 @@ export const getWidgetFiles = (widgetsPath: string, targetPath: string) => {
|
|
|
55
73
|
copyFileSync(source, targetPath);
|
|
56
74
|
});
|
|
57
75
|
|
|
58
|
-
// Copy Module.swift
|
|
59
|
-
|
|
60
|
-
copyFileSync(
|
|
61
|
-
path.join(widgetsPath, "Module.swift"),
|
|
62
|
-
path.join(modulePath, "Module.swift")
|
|
63
|
-
);
|
|
76
|
+
// Copy Module.swift to moduleRoot (package ios directory)
|
|
77
|
+
copyFileSync(moduleSwiftPath, path.join(moduleRoot, "Module.swift"));
|
|
64
78
|
|
|
65
79
|
// Copy directories
|
|
66
80
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
@@ -78,7 +92,7 @@ const copyFileSync = (source: string, target: string) => {
|
|
|
78
92
|
targetFile = path.join(target, path.basename(source));
|
|
79
93
|
}
|
|
80
94
|
|
|
81
|
-
fs.
|
|
95
|
+
fs.copyFileSync(source, targetFile);
|
|
82
96
|
};
|
|
83
97
|
|
|
84
98
|
const copyDirectorySync = (source: string, target: string) => {
|
package/plugin/src/withXcode.ts
CHANGED
|
@@ -18,14 +18,20 @@ export const withXcode: ConfigPlugin<Required<WidgetConfig>> = (
|
|
|
18
18
|
return withXcodeProject(config, (config) => {
|
|
19
19
|
const { platformProjectRoot, projectRoot } = config.modRequest;
|
|
20
20
|
|
|
21
|
-
const widgetsPath = path.join(projectRoot, widgetsFolder);
|
|
22
|
-
const targetPath = path.join(platformProjectRoot, targetName);
|
|
23
|
-
const widgetFiles = getWidgetFiles(widgetsPath, targetPath);
|
|
24
|
-
|
|
25
21
|
if (!enabled) {
|
|
26
22
|
return config;
|
|
27
23
|
}
|
|
28
24
|
|
|
25
|
+
const widgetsPath = path.join(projectRoot, widgetsFolder);
|
|
26
|
+
const targetPath = path.join(platformProjectRoot, targetName);
|
|
27
|
+
const moduleRoot = path.join(
|
|
28
|
+
projectRoot,
|
|
29
|
+
"node_modules",
|
|
30
|
+
"react-native-ios-widget",
|
|
31
|
+
"ios"
|
|
32
|
+
);
|
|
33
|
+
const widgetFiles = getWidgetFiles(widgetsPath, targetPath, moduleRoot);
|
|
34
|
+
|
|
29
35
|
const xcodeProject = config.modResults;
|
|
30
36
|
const marketingVersion = config.version;
|
|
31
37
|
const xCConfigurationList = addXCConfigurationList(xcodeProject, {
|