@react-native/core-cli-utils
Version:
React Native CLI library for Frameworks to build on
76 lines (68 loc) • 1.89 kB
Flow
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import type { Task } from "./types";
import type { ExecaPromise } from "execa";
type AppleBuildMode = "Debug" | "Release";
type AppleBuildOptions = {
isWorkspace: boolean,
name: string,
mode: AppleBuildMode,
scheme?: string,
destination: "device" | "simulator" | string,
...AppleOptions,
};
type AppleBootstrapOption = {
// Enabled by default
hermes: boolean,
newArchitecture: boolean,
frameworks?: "static" | "dynamic",
...AppleOptions,
};
type AppleInstallApp = {
// Install the app on a simulator or device, typically this is the description from
// `xcrun simctl list devices`
device: string,
appPath: string,
bundleId: string,
...AppleOptions,
};
type AppleOptions = {
// The directory where the Xcode project is located
cwd: string,
// The environment variables to pass to the build command
env?: { [key: string]: string | void, ... },
};
/* eslint sort-keys: "off" */
declare export const tasks: {
// 1. Setup your environment for building the iOS apps
bootstrap: (options: AppleBootstrapOption) => {
cleanupBuildFolder: Task<void>,
runCodegen: Task<void>,
validate: Task<void>,
installRubyGems: Task<ExecaPromise>,
installDependencies: Task<ExecaPromise>,
},
// 2. Build the iOS app using a setup environment
build: (
options: AppleBuildOptions,
...args: $ReadOnlyArray<string>
) => {
validate: Task<void>,
hasPodsInstalled: Task<void>,
build: Task<ExecaPromise>,
},
// 3. Install the built app on a simulator or device
ios: {
install: (options: AppleInstallApp) => {
validate: Task<void>,
install: Task<ExecaPromise>,
},
},
};