-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathpluginPlatformVisionOS.ts
More file actions
58 lines (51 loc) · 1.7 KB
/
pluginPlatformVisionOS.ts
File metadata and controls
58 lines (51 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import type { PluginOutput, PluginApi } from '@callstack/rnef-config';
import {
createBuild,
createRun,
getRunOptions,
getBuildOptions,
RunFlags,
BuildFlags,
} from '@callstack/rnef-plugin-platform-apple';
import { getProjectConfig } from '@react-native-community/cli-config-apple';
const projectConfig = getProjectConfig({ platformName: 'visionos' });
const buildOptions = getBuildOptions({ platformName: 'visionos' });
const runOptions = getRunOptions({ platformName: 'visionos' });
export const pluginPlatformVisionOS =
() =>
(api: PluginApi): PluginOutput => {
api.registerCommand({
name: 'build:visionos',
description: 'Build visionOS app.',
action: async (args) => {
const projectRoot = api.getProjectRoot();
const config = projectConfig(projectRoot, {});
if (config) {
await createBuild('visionos', config, args as BuildFlags);
} else {
throw new Error('visionOS project not found.');
}
},
options: buildOptions,
});
api.registerCommand({
name: 'run:visionos',
description: 'Run visionOS app.',
action: async (args) => {
const projectRoot = api.getProjectRoot();
const config = projectConfig(projectRoot, {});
if (config) {
await createRun('visionos', config, args as RunFlags, projectRoot);
} else {
throw new Error('visionOS project not found.');
}
},
// @ts-expect-error: fix `simulator` is not defined in `RunFlags`
options: runOptions,
});
return {
name: 'plugin-platform-visionos',
description: 'RNEF plugin for everything visionOS.',
};
};
export default pluginPlatformVisionOS;