react-native-ios-widget 0.0.6 → 0.0.8
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/package.json +1 -1
- package/plugin/build/index.d.ts +2 -8
- package/plugin/build/index.js +14 -18
- package/plugin/build/lib/getWidgetFiles.js +3 -0
- package/plugin/build/types.d.ts +9 -0
- package/plugin/build/types.js +2 -0
- package/plugin/build/withConfig.d.ts +2 -5
- package/plugin/build/withConfig.js +4 -1
- package/plugin/build/withPodfile.d.ts +2 -4
- package/plugin/build/withPodfile.js +4 -1
- package/plugin/build/withWidgetExtensionEntitlements.d.ts +2 -6
- package/plugin/build/withWidgetExtensionEntitlements.js +4 -1
- package/plugin/build/withXcode.d.ts +2 -6
- package/plugin/build/withXcode.js +10 -7
- package/plugin/src/index.ts +18 -27
- package/plugin/src/lib/getWidgetFiles.ts +7 -0
- package/plugin/src/types.ts +9 -0
- package/plugin/src/withConfig.ts +9 -5
- package/plugin/src/withPodfile.ts +9 -4
- package/plugin/src/withWidgetExtensionEntitlements.ts +8 -6
- package/plugin/src/withXcode.ts +13 -15
package/package.json
CHANGED
package/plugin/build/index.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
widgetsFolder?: string;
|
|
5
|
-
deploymentTarget?: string;
|
|
6
|
-
groupIdentifier?: string;
|
|
7
|
-
pods?: string[];
|
|
8
|
-
widgetName: string;
|
|
9
|
-
}>;
|
|
2
|
+
import { WidgetPluginProps } from "./types";
|
|
3
|
+
declare const withWidget: ConfigPlugin<WidgetPluginProps>;
|
|
10
4
|
export default withWidget;
|
package/plugin/build/index.js
CHANGED
|
@@ -5,25 +5,21 @@ const withXcode_1 = require("./withXcode");
|
|
|
5
5
|
const withWidgetExtensionEntitlements_1 = require("./withWidgetExtensionEntitlements");
|
|
6
6
|
const withPodfile_1 = require("./withPodfile");
|
|
7
7
|
const withConfig_1 = require("./withConfig");
|
|
8
|
-
const withWidget = (config, { enabled = true, deploymentTarget = "14.0", widgetsFolder = "widgets", groupIdentifier, pods, }) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const withWidget = (config, { enabled = true, deploymentTarget = "14.0", widgetsFolder = "widgets", groupIdentifier, pods = [], targetName = "WidgetsExtension", bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`, }) => {
|
|
9
|
+
const props = {
|
|
10
|
+
enabled,
|
|
11
|
+
deploymentTarget,
|
|
12
|
+
widgetsFolder,
|
|
13
|
+
groupIdentifier,
|
|
14
|
+
pods,
|
|
15
|
+
targetName,
|
|
16
|
+
bundleIdentifier,
|
|
17
|
+
};
|
|
14
18
|
return (0, config_plugins_1.withPlugins)(config, [
|
|
15
|
-
[
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
bundleIdentifier,
|
|
20
|
-
deploymentTarget,
|
|
21
|
-
widgetsFolder,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
[withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, { targetName, groupIdentifier }],
|
|
25
|
-
[withPodfile_1.withPodfile, { targetName, pods }],
|
|
26
|
-
[withConfig_1.withConfig, { targetName, bundleIdentifier, groupIdentifier }],
|
|
19
|
+
[withXcode_1.withXcode, props],
|
|
20
|
+
[withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, props],
|
|
21
|
+
[withPodfile_1.withPodfile, props],
|
|
22
|
+
[withConfig_1.withConfig, props],
|
|
27
23
|
]);
|
|
28
24
|
};
|
|
29
25
|
exports.default = withWidget;
|
|
@@ -70,6 +70,9 @@ function getWidgetFiles(widgetsPath, targetPath) {
|
|
|
70
70
|
const source = path.join(widgetsPath, file);
|
|
71
71
|
copyFileSync(source, targetPath);
|
|
72
72
|
});
|
|
73
|
+
// Copy Module.swift and Attributes.swift
|
|
74
|
+
const modulePath = path.join(__dirname, "../../../ios");
|
|
75
|
+
copyFileSync(path.join(widgetsPath, "Module.swift"), path.join(modulePath, "Module.swift"));
|
|
73
76
|
// Copy directories
|
|
74
77
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
75
78
|
const imagesXcassetsSource = path.join(widgetsPath, directory);
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
targetName: string;
|
|
5
|
-
groupIdentifier?: string;
|
|
6
|
-
}>;
|
|
2
|
+
import { WidgetPluginProps } from "./types";
|
|
3
|
+
export declare const withConfig: ConfigPlugin<Required<WidgetPluginProps>>;
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withConfig = void 0;
|
|
4
4
|
const getWidgetExtensionEntitlements_1 = require("./lib/getWidgetExtensionEntitlements");
|
|
5
|
-
const withConfig = (config, {
|
|
5
|
+
const withConfig = (config, { enabled, groupIdentifier, targetName, bundleIdentifier }) => {
|
|
6
|
+
if (!enabled) {
|
|
7
|
+
return config;
|
|
8
|
+
}
|
|
6
9
|
let configIndex = null;
|
|
7
10
|
config.extra?.eas?.build?.experimental?.ios?.appExtensions?.forEach((ext, index) => {
|
|
8
11
|
if (ext.targetName === targetName) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
pods?: string[];
|
|
5
|
-
}>;
|
|
2
|
+
import { WidgetPluginProps } from "./types";
|
|
3
|
+
export declare const withPodfile: ConfigPlugin<Required<WidgetPluginProps>>;
|
|
@@ -28,7 +28,10 @@ const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
|
28
28
|
const config_plugins_1 = require("expo/config-plugins");
|
|
29
29
|
const fs = __importStar(require("fs"));
|
|
30
30
|
const path = __importStar(require("path"));
|
|
31
|
-
const withPodfile = (config, { targetName, pods
|
|
31
|
+
const withPodfile = (config, { enabled, targetName, pods }) => {
|
|
32
|
+
if (!enabled) {
|
|
33
|
+
return config;
|
|
34
|
+
}
|
|
32
35
|
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
33
36
|
"ios",
|
|
34
37
|
(config) => {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
targetPath: string;
|
|
5
|
-
groupIdentifier: string;
|
|
6
|
-
appleSignin: boolean;
|
|
7
|
-
}>;
|
|
2
|
+
import { WidgetPluginProps } from "./types";
|
|
3
|
+
export declare const withWidgetExtensionEntitlements: ConfigPlugin<Required<WidgetPluginProps>>;
|
|
@@ -32,7 +32,10 @@ const config_plugins_1 = require("expo/config-plugins");
|
|
|
32
32
|
const fs = __importStar(require("fs"));
|
|
33
33
|
const path = __importStar(require("path"));
|
|
34
34
|
const getWidgetExtensionEntitlements_1 = require("./lib/getWidgetExtensionEntitlements");
|
|
35
|
-
const withWidgetExtensionEntitlements = (config, { targetName, groupIdentifier }) => {
|
|
35
|
+
const withWidgetExtensionEntitlements = (config, { enabled, targetName, groupIdentifier }) => {
|
|
36
|
+
if (!enabled) {
|
|
37
|
+
return config;
|
|
38
|
+
}
|
|
36
39
|
return (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
37
40
|
const targetPath = path.join(config.modRequest.platformProjectRoot, targetName);
|
|
38
41
|
const filePath = path.join(targetPath, `${targetName}.entitlements`);
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
bundleIdentifier: string;
|
|
5
|
-
deploymentTarget: string;
|
|
6
|
-
widgetsFolder: string;
|
|
7
|
-
}>;
|
|
2
|
+
import { WidgetPluginProps } from "./types";
|
|
3
|
+
export declare const withXcode: ConfigPlugin<Required<WidgetPluginProps>>;
|
|
@@ -34,16 +34,17 @@ const addTargetDependency_1 = require("./xcode/addTargetDependency");
|
|
|
34
34
|
const addPbxGroup_1 = require("./xcode/addPbxGroup");
|
|
35
35
|
const addBuildPhases_1 = require("./xcode/addBuildPhases");
|
|
36
36
|
const getWidgetFiles_1 = require("./lib/getWidgetFiles");
|
|
37
|
-
const withXcode = (config, { targetName, bundleIdentifier, deploymentTarget, widgetsFolder }) => {
|
|
37
|
+
const withXcode = (config, { enabled, targetName, bundleIdentifier, deploymentTarget, widgetsFolder }) => {
|
|
38
38
|
return (0, config_plugins_1.withXcodeProject)(config, (config) => {
|
|
39
|
-
const
|
|
40
|
-
const widgetsPath = path.join(
|
|
41
|
-
const targetUuid = xcodeProject.generateUuid();
|
|
42
|
-
const groupName = "Embed Foundation Extensions";
|
|
43
|
-
const { platformProjectRoot } = config.modRequest;
|
|
44
|
-
const marketingVersion = config.version;
|
|
39
|
+
const { platformProjectRoot, projectRoot } = config.modRequest;
|
|
40
|
+
const widgetsPath = path.join(projectRoot, widgetsFolder);
|
|
45
41
|
const targetPath = path.join(platformProjectRoot, targetName);
|
|
46
42
|
const widgetFiles = (0, getWidgetFiles_1.getWidgetFiles)(widgetsPath, targetPath);
|
|
43
|
+
if (!enabled) {
|
|
44
|
+
return config;
|
|
45
|
+
}
|
|
46
|
+
const xcodeProject = config.modResults;
|
|
47
|
+
const marketingVersion = config.version;
|
|
47
48
|
const xCConfigurationList = (0, addXCConfigurationList_1.addXCConfigurationList)(xcodeProject, {
|
|
48
49
|
targetName,
|
|
49
50
|
currentProjectVersion: config.ios.buildNumber || "1",
|
|
@@ -51,10 +52,12 @@ const withXcode = (config, { targetName, bundleIdentifier, deploymentTarget, wid
|
|
|
51
52
|
deploymentTarget,
|
|
52
53
|
marketingVersion,
|
|
53
54
|
});
|
|
55
|
+
const groupName = "Embed Foundation Extensions";
|
|
54
56
|
const productFile = (0, addProductFile_1.addProductFile)(xcodeProject, {
|
|
55
57
|
targetName,
|
|
56
58
|
groupName,
|
|
57
59
|
});
|
|
60
|
+
const targetUuid = xcodeProject.generateUuid();
|
|
58
61
|
const target = (0, addToPbxNativeTargetSection_1.addToPbxNativeTargetSection)(xcodeProject, {
|
|
59
62
|
targetName,
|
|
60
63
|
targetUuid,
|
package/plugin/src/index.ts
CHANGED
|
@@ -3,44 +3,35 @@ import { withXcode } from "./withXcode";
|
|
|
3
3
|
import { withWidgetExtensionEntitlements } from "./withWidgetExtensionEntitlements";
|
|
4
4
|
import { withPodfile } from "./withPodfile";
|
|
5
5
|
import { withConfig } from "./withConfig";
|
|
6
|
+
import { WidgetPluginProps } from "./types";
|
|
6
7
|
|
|
7
|
-
const withWidget: ConfigPlugin<
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
widgetsFolder?: string;
|
|
10
|
-
deploymentTarget?: string;
|
|
11
|
-
groupIdentifier?: string;
|
|
12
|
-
pods?: string[];
|
|
13
|
-
widgetName: string;
|
|
14
|
-
}> = (
|
|
8
|
+
const withWidget: ConfigPlugin<WidgetPluginProps> = (
|
|
15
9
|
config,
|
|
16
10
|
{
|
|
17
11
|
enabled = true,
|
|
18
12
|
deploymentTarget = "14.0",
|
|
19
13
|
widgetsFolder = "widgets",
|
|
20
14
|
groupIdentifier,
|
|
21
|
-
pods,
|
|
15
|
+
pods = [],
|
|
16
|
+
targetName = "WidgetsExtension",
|
|
17
|
+
bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`,
|
|
22
18
|
}
|
|
23
19
|
) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const props: WidgetPluginProps = {
|
|
21
|
+
enabled,
|
|
22
|
+
deploymentTarget,
|
|
23
|
+
widgetsFolder,
|
|
24
|
+
groupIdentifier,
|
|
25
|
+
pods,
|
|
26
|
+
targetName,
|
|
27
|
+
bundleIdentifier,
|
|
28
|
+
};
|
|
30
29
|
|
|
31
30
|
return withPlugins(config, [
|
|
32
|
-
[
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
bundleIdentifier,
|
|
37
|
-
deploymentTarget,
|
|
38
|
-
widgetsFolder,
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
[withWidgetExtensionEntitlements, { targetName, groupIdentifier }],
|
|
42
|
-
[withPodfile, { targetName, pods }],
|
|
43
|
-
[withConfig, { targetName, bundleIdentifier, groupIdentifier }],
|
|
31
|
+
[withXcode, props],
|
|
32
|
+
[withWidgetExtensionEntitlements, props],
|
|
33
|
+
[withPodfile, props],
|
|
34
|
+
[withConfig, props],
|
|
44
35
|
]);
|
|
45
36
|
};
|
|
46
37
|
|
|
@@ -55,6 +55,13 @@ export function getWidgetFiles(widgetsPath: string, targetPath: string) {
|
|
|
55
55
|
copyFileSync(source, targetPath);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
+
// Copy Module.swift and Attributes.swift
|
|
59
|
+
const modulePath = path.join(__dirname, "../../../ios");
|
|
60
|
+
copyFileSync(
|
|
61
|
+
path.join(widgetsPath, "Module.swift"),
|
|
62
|
+
path.join(modulePath, "Module.swift")
|
|
63
|
+
);
|
|
64
|
+
|
|
58
65
|
// Copy directories
|
|
59
66
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
60
67
|
const imagesXcassetsSource = path.join(widgetsPath, directory);
|
package/plugin/src/withConfig.ts
CHANGED
|
@@ -3,12 +3,16 @@ import {
|
|
|
3
3
|
addApplicationGroupsEntitlement,
|
|
4
4
|
getWidgetExtensionEntitlements,
|
|
5
5
|
} from "./lib/getWidgetExtensionEntitlements";
|
|
6
|
+
import { WidgetPluginProps } from "./types";
|
|
7
|
+
|
|
8
|
+
export const withConfig: ConfigPlugin<Required<WidgetPluginProps>> = (
|
|
9
|
+
config,
|
|
10
|
+
{ enabled, groupIdentifier, targetName, bundleIdentifier }
|
|
11
|
+
) => {
|
|
12
|
+
if (!enabled) {
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
6
15
|
|
|
7
|
-
export const withConfig: ConfigPlugin<{
|
|
8
|
-
bundleIdentifier: string;
|
|
9
|
-
targetName: string;
|
|
10
|
-
groupIdentifier?: string;
|
|
11
|
-
}> = (config, { bundleIdentifier, targetName, groupIdentifier }) => {
|
|
12
16
|
let configIndex: null | number = null;
|
|
13
17
|
config.extra?.eas?.build?.experimental?.ios?.appExtensions?.forEach(
|
|
14
18
|
(ext: any, index: number) => {
|
|
@@ -2,11 +2,16 @@ import { mergeContents } from "@expo/config-plugins/build/utils/generateCode";
|
|
|
2
2
|
import { ConfigPlugin, withDangerousMod } from "expo/config-plugins";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "path";
|
|
5
|
+
import { WidgetPluginProps } from "./types";
|
|
6
|
+
|
|
7
|
+
export const withPodfile: ConfigPlugin<Required<WidgetPluginProps>> = (
|
|
8
|
+
config,
|
|
9
|
+
{ enabled, targetName, pods }
|
|
10
|
+
) => {
|
|
11
|
+
if (!enabled) {
|
|
12
|
+
return config;
|
|
13
|
+
}
|
|
5
14
|
|
|
6
|
-
export const withPodfile: ConfigPlugin<{
|
|
7
|
-
targetName: string;
|
|
8
|
-
pods?: string[];
|
|
9
|
-
}> = (config, { targetName, pods = [] }) => {
|
|
10
15
|
return withDangerousMod(config, [
|
|
11
16
|
"ios",
|
|
12
17
|
(config) => {
|
|
@@ -4,13 +4,15 @@ import * as fs from "fs";
|
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
|
|
6
6
|
import { getWidgetExtensionEntitlements } from "./lib/getWidgetExtensionEntitlements";
|
|
7
|
+
import { WidgetPluginProps } from "./types";
|
|
8
|
+
|
|
9
|
+
export const withWidgetExtensionEntitlements: ConfigPlugin<
|
|
10
|
+
Required<WidgetPluginProps>
|
|
11
|
+
> = (config, { enabled, targetName, groupIdentifier }) => {
|
|
12
|
+
if (!enabled) {
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
7
15
|
|
|
8
|
-
export const withWidgetExtensionEntitlements: ConfigPlugin<{
|
|
9
|
-
targetName: string;
|
|
10
|
-
targetPath: string;
|
|
11
|
-
groupIdentifier: string;
|
|
12
|
-
appleSignin: boolean;
|
|
13
|
-
}> = (config, { targetName, groupIdentifier }) => {
|
|
14
16
|
return withInfoPlist(config, (config) => {
|
|
15
17
|
const targetPath = path.join(
|
|
16
18
|
config.modRequest.platformProjectRoot,
|
package/plugin/src/withXcode.ts
CHANGED
|
@@ -9,29 +9,25 @@ import { addTargetDependency } from "./xcode/addTargetDependency";
|
|
|
9
9
|
import { addPbxGroup } from "./xcode/addPbxGroup";
|
|
10
10
|
import { addBuildPhases } from "./xcode/addBuildPhases";
|
|
11
11
|
import { getWidgetFiles } from "./lib/getWidgetFiles";
|
|
12
|
+
import { WidgetPluginProps } from "./types";
|
|
12
13
|
|
|
13
|
-
export const withXcode: ConfigPlugin<
|
|
14
|
-
targetName: string;
|
|
15
|
-
bundleIdentifier: string;
|
|
16
|
-
deploymentTarget: string;
|
|
17
|
-
widgetsFolder: string;
|
|
18
|
-
}> = (
|
|
14
|
+
export const withXcode: ConfigPlugin<Required<WidgetPluginProps>> = (
|
|
19
15
|
config,
|
|
20
|
-
{ targetName, bundleIdentifier, deploymentTarget, widgetsFolder }
|
|
16
|
+
{ enabled, targetName, bundleIdentifier, deploymentTarget, widgetsFolder }
|
|
21
17
|
) => {
|
|
22
18
|
return withXcodeProject(config, (config) => {
|
|
23
|
-
const
|
|
24
|
-
const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
|
|
25
|
-
|
|
26
|
-
const targetUuid = xcodeProject.generateUuid();
|
|
27
|
-
const groupName = "Embed Foundation Extensions";
|
|
28
|
-
const { platformProjectRoot } = config.modRequest;
|
|
29
|
-
const marketingVersion = config.version;
|
|
19
|
+
const { platformProjectRoot, projectRoot } = config.modRequest;
|
|
30
20
|
|
|
21
|
+
const widgetsPath = path.join(projectRoot, widgetsFolder);
|
|
31
22
|
const targetPath = path.join(platformProjectRoot, targetName);
|
|
32
|
-
|
|
33
23
|
const widgetFiles = getWidgetFiles(widgetsPath, targetPath);
|
|
34
24
|
|
|
25
|
+
if (!enabled) {
|
|
26
|
+
return config;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const xcodeProject = config.modResults;
|
|
30
|
+
const marketingVersion = config.version;
|
|
35
31
|
const xCConfigurationList = addXCConfigurationList(xcodeProject, {
|
|
36
32
|
targetName,
|
|
37
33
|
currentProjectVersion: config.ios!.buildNumber || "1",
|
|
@@ -40,11 +36,13 @@ export const withXcode: ConfigPlugin<{
|
|
|
40
36
|
marketingVersion,
|
|
41
37
|
});
|
|
42
38
|
|
|
39
|
+
const groupName = "Embed Foundation Extensions";
|
|
43
40
|
const productFile = addProductFile(xcodeProject, {
|
|
44
41
|
targetName,
|
|
45
42
|
groupName,
|
|
46
43
|
});
|
|
47
44
|
|
|
45
|
+
const targetUuid = xcodeProject.generateUuid();
|
|
48
46
|
const target = addToPbxNativeTargetSection(xcodeProject, {
|
|
49
47
|
targetName,
|
|
50
48
|
targetUuid,
|