@react-native/core-cli-utils
Version:
React Native CLI library for Frameworks to build on
77 lines (66 loc) • 1.85 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, Options as ExecaOptions } from "execa";
/**
* Removes the contents of a directory matching a given pattern, but keeps the directory.
* @private
*/
declare export function deleteDirectoryContents(
directory: string,
filePattern: RegExp
): () => Promise<void>;
/**
* Removes a directory recursively.
* @private
*/
declare export function deleteDirectory(directory: string): () => Promise<void>;
/**
* Deletes the contents of the tmp directory matching a given pattern.
* @private
*/
declare export function deleteTmpDirectoryContents(
filepattern: RegExp
): () => Promise<void>;
type CocoaPodsClean = {
clean: Task<ExecaPromise>,
};
type AndroidClean = {
validate: Task<void>,
run: Task<ExecaPromise>,
};
type MetroClean = {
metro: Task<Promise<void>>,
haste: Task<Promise<void>>,
react_native: Task<Promise<void>>,
};
type NpmClean = {
node_modules: Task<Promise<void>>,
verify_cache: Task<ExecaPromise>,
};
type WatchmanClean = {
stop: Task<ExecaPromise>,
cache: Task<ExecaPromise>,
};
type YarnClean = {
clean: Task<ExecaPromise>,
};
type CleanTasks = {
android: (andoirdSrcDir: ?string, opts?: ExecaOptions) => AndroidClean,
cocoapods: CocoaPodsClean,
metro: () => MetroClean,
npm: (projectRootDir: string) => NpmClean,
watchman: (projectRootDir: string) => WatchmanClean,
yarn: (projectRootDir: string) => YarnClean,
cocoapods?: (projectRootDir: string) => CocoaPodsClean,
};
// The tasks that cleanup various build artefacts.
/* eslint sort-keys: "off" */
declare export const tasks: CleanTasks;