Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions packages/core-cli-utils/README.md

This file was deleted.

42 changes: 0 additions & 42 deletions packages/core-cli-utils/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/react-native/react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {Command} from '@react-native-community/cli-types';
// depending on and injecting:
// - @react-native-community/cli-platform-android
// - @react-native-community/cli-platform-ios
// - @react-native/community-cli-plugin (via the @react-native/core-cli-utils package)
// - @react-native/community-cli-plugin
// - codegen command should be inhoused into @react-native-community/cli
//
// This is a temporary workaround.
Expand Down
19 changes: 0 additions & 19 deletions packages/rn-tester/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,11 @@
import {Command} from 'commander';
*/

// eslint-disable-next-line @react-native/monorepo/sort-imports
const {patchCoreCLIUtilsPackageJSON} = require('./scripts/monorepo');

function injectCoreCLIUtilsRuntimePatch() {
patchCoreCLIUtilsPackageJSON(true);
const cleared = {
status: false,
};
['exit', 'SIGUSR1', 'SIGUSR2', 'uncaughtException'].forEach(event => {
if (cleared.status) {
return;
}
patchCoreCLIUtilsPackageJSON(false);
cleared.status = true;
});
}

if (process.env.BUILD_EXCLUDE_BABEL_REGISTER == null) {
// $FlowFixMe[cannot-resolve-module]
require('../../scripts/shared/babelRegister').registerForMonorepo();
}

injectCoreCLIUtilsRuntimePatch();

const program /*: Command */ = require('./cli.flow.js').default;

if (require.main === module) {
Expand Down
1 change: 1 addition & 0 deletions packages/rn-tester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@react-native-community/cli": "20.0.0",
"@react-native-community/cli-platform-android": "20.0.0",
"@react-native-community/cli-platform-ios": "20.0.0",
"@react-native/core-cli-utils": "*",
"commander": "^12.0.0",
"listr2": "^6.4.1",
"rxjs": "npm:@react-native-community/rxjs@6.5.4-custom"
Expand Down
41 changes: 0 additions & 41 deletions packages/rn-tester/scripts/monorepo.js

This file was deleted.

File renamed without changes.
18 changes: 18 additions & 0 deletions private/core-cli-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# @react-native/core-cli-utils

A reference implementation of React Native CLI tooling. This package provides composable, ordered `Task` objects for common CLI operations including Android Gradle builds, iOS Xcode/CocoaPods workflows, Metro bundling with Hermes support, and cache cleaning.

This is not published to npm. Framework authors can use this code as a starting point for their own CLI tooling, but should not depend on it as a versioned API.

## Modules

- **`android`** — Gradle-based Android build tasks (assemble, build, install)
- **`apple`** — Xcode/CocoaPods-based iOS tasks (bootstrap, build, install)
- **`app`** — Metro bundler tasks (watch mode, bundle mode, Hermes bytecode compilation)
- **`clean`** — Cache-cleaning tasks (Android/Gradle, Metro, npm, Watchman, Yarn, CocoaPods)
- **`version`** — Semver version requirements for platform toolchains (Android NDK/SDK, Xcode, Node, etc.)

## Consumers

- [`private/helloworld/`](../helloworld/) — the primary consumer, using Android, iOS, and Metro modules
- [`packages/rn-tester/`](../../packages/rn-tester/) — uses iOS bootstrap for CocoaPods setup
19 changes: 19 additions & 0 deletions private/core-cli-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@react-native/core-cli-utils",
"version": "0.0.0",
"description": "Reference implementation of React Native CLI tooling",
"license": "MIT",
"main": "./src/index.flow.js",
"exports": {
".": "./src/index.js",
"./package.json": "./package.json",
"./version.js": "./src/public/version.js"
},
"dependencies": {
"metro-babel-register": "^0.84.3"
},
"devDependencies": {},
"engines": {
"node": "^22.13.0 || ^24.3.0 || >= 26.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
export type * from './index.flow';
*/

if (process.env.BUILD_EXCLUDE_BABEL_REGISTER == null) {
require('../../../scripts/shared/babelRegister').registerForMonorepo();
}
const {register} = require('metro-babel-register');

Check warning on line 15 in private/core-cli-utils/src/index.js

View workflow job for this annotation

GitHub Actions / test_js (22.13.0)

Requires should be sorted alphabetically, with at least one line between imports/requires and code

Check warning on line 15 in private/core-cli-utils/src/index.js

View workflow job for this annotation

GitHub Actions / test_js (24)

Requires should be sorted alphabetically, with at least one line between imports/requires and code
register([__dirname]);

module.exports = require('./index.flow');
19 changes: 0 additions & 19 deletions private/helloworld/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,11 @@
import {Command} from 'commander';
*/

// eslint-disable-next-line @react-native/monorepo/sort-imports
const {patchCoreCLIUtilsPackageJSON} = require('./scripts/monorepo');

function injectCoreCLIUtilsRuntimePatch() {
patchCoreCLIUtilsPackageJSON(true);
const cleared = {
status: false,
};
['exit', 'SIGUSR1', 'SIGUSR2', 'uncaughtException'].forEach(event => {
if (cleared.status) {
return;
}
patchCoreCLIUtilsPackageJSON(false);
cleared.status = true;
});
}

if (process.env.BUILD_EXCLUDE_BABEL_REGISTER == null) {
// $FlowFixMe[cannot-resolve-module]
require('../../scripts/shared/babelRegister').registerForMonorepo();
}

injectCoreCLIUtilsRuntimePatch();

const program /*: Command */ = require('./cli.flow.js').default;

if (require.main === module) {
Expand Down
2 changes: 1 addition & 1 deletion private/helloworld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native/babel-preset": "0.87.0-main",
"@react-native/core-cli-utils": "0.87.0-main",
"@react-native/core-cli-utils": "*",
"@react-native/eslint-config": "0.87.0-main",
"@react-native/metro-config": "0.87.0-main",
"@react-native/typescript-config": "0.87.0-main",
Expand Down
46 changes: 0 additions & 46 deletions private/helloworld/scripts/monorepo.js

This file was deleted.

4 changes: 0 additions & 4 deletions scripts/build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ const buildConfig: BuildConfig = {
'community-cli-plugin': {
target: 'node',
},
'core-cli-utils': {
emitTypeScriptDefs: true,
target: 'node',
},
'debugger-shell': {
emitTypeScriptDefs: true,
target: 'node',
Expand Down
10 changes: 8 additions & 2 deletions scripts/e2e/init-project-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,18 @@ function _prepareHelloWorld(
// and update the dependencies and devDependencies of packages scoped as @react-native
// to the version passed as parameter
for (const key of Object.keys(packageJson.dependencies)) {
if (key.startsWith('@react-native/')) {
if (
key.startsWith('@react-native/') &&
packageJson.dependencies[key] !== '*'
) {
packageJson.dependencies[key] = version;
}
}
for (const key of Object.keys(packageJson.devDependencies)) {
if (key.startsWith('@react-native/')) {
if (
key.startsWith('@react-native/') &&
packageJson.devDependencies[key] !== '*'
) {
packageJson.devDependencies[key] = version;
}
}
Expand Down
Loading