diff --git a/packages/core-cli-utils/.eslintrc.json b/packages/core-cli-utils/.eslintrc.json new file mode 100644 index 00000000000..3cddbc9f82f --- /dev/null +++ b/packages/core-cli-utils/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "ignorePatterns": ["dist/**"], + "rules": { + "sort-keys": 2 + } +} diff --git a/packages/core-cli-utils/package.json b/packages/core-cli-utils/package.json index 58c98e847f3..056d43745bf 100644 --- a/packages/core-cli-utils/package.json +++ b/packages/core-cli-utils/package.json @@ -13,6 +13,7 @@ ".": "./src/index.js", "./package.json": "./package.json" }, + "types": "./dist/index.d.ts", "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/core-cli-utils#readme", "keywords": [ "cli-utils", diff --git a/packages/core-cli-utils/src/index.js b/packages/core-cli-utils/src/index.js index ad4e4c9cde6..cf3797ac618 100644 --- a/packages/core-cli-utils/src/index.js +++ b/packages/core-cli-utils/src/index.js @@ -15,7 +15,9 @@ import {tasks as clean} from './private/clean.js'; /* eslint sort-keys : "error" */ export default { - android, - apple, - clean, + android: typeof android, + apple: typeof apple, + clean: typeof clean, }; + +export type {Task} from './private/types'; diff --git a/packages/core-cli-utils/src/private/clean.js b/packages/core-cli-utils/src/private/clean.js index 7f5165e4ce0..0b96c8bacca 100644 --- a/packages/core-cli-utils/src/private/clean.js +++ b/packages/core-cli-utils/src/private/clean.js @@ -20,19 +20,18 @@ import path from 'path'; type CleanTasks = { android: (androidSrcDir: ?string) => Task[], + cocoapods?: (projectRootDir: string) => Task[], metro: () => Task[], npm: (projectRootDir: string, verifyCache?: boolean) => Task[], - bun: (projectRootDir: string) => Task[], watchman: (projectRootDir: string) => Task[], yarn: (projectRootDir: string) => Task[], - cocoapods?: (projectRootDir: string) => Task[], }; const rmrf = (pathname: string) => { if (!existsSync(pathname)) { return; } - rm(pathname, {maxRetries: 3, recursive: true, force: true}); + rm(pathname, {force: true, maxRetries: 3, recursive: true}); }; /** @@ -130,15 +129,6 @@ export const tasks: CleanTasks = { return _tasks; }, - /** - * Cleans up the Bun cache. - */ - bun: (projectRootDir: string) => [ - task('🧹 Clean Bun cache', (opts?: ExecaOptions) => - execa('bun', ['pm', 'cache', 'rm'], {cwd: projectRootDir, ...opts}), - ), - ], - /** * Stops Watchman and clears its cache */ diff --git a/packages/core-cli-utils/src/private/utils.js b/packages/core-cli-utils/src/private/utils.js index f70a1f59328..74d2b408ed0 100644 --- a/packages/core-cli-utils/src/private/utils.js +++ b/packages/core-cli-utils/src/private/utils.js @@ -16,8 +16,8 @@ import os from 'os'; export function task(label: string, action: Task['action']): Task { return { - label, action, + label, }; }