Skip to content

Commit 9c3fddf

Browse files
huntiemeta-codesync[bot]
authored andcommitted
Move core-cli-utils to private/ as a reference implementation (#56922)
Summary: Pull Request resolved: #56922 Move `react-native/core-cli-utils` from `packages/` to `private/`, stop publishing it to npm, and reframe it as a reference implementation of React Native CLI tooling. The package has no known external consumers and is only used internally by `private/helloworld/` and `packages/rn-tester/`. Publishing it to npm creates a maintenance surface for a package that serves no external users. See react-native-community/discussions-and-proposals#1002. #### Changes - Move `packages/core-cli-utils/` to `private/core-cli-utils/`. - Convert all source files to CJS (require/module.exports) with Flow comment syntax (/*:: */), eliminating the runtime Babel dependency. - Remove from the JS build pipeline (`scripts/build/config.js`). - Remove the defunct `patchCoreCLIUtilsPackageJSON()` runtime patching from both `helloworld/cli.js` and `rn-tester/cli.js`, and delete both `monorepo.js` files that contained it. - Add as `devDependency` to `rn-tester` and `helloworld`. - Skip `"*"` version deps in `_prepareHelloWorld()` so they aren't rewritten to the Verdaccio-published version. - Remove redundant desktop import ignore entry (`private/**` already covers it). - Rewrite README as reference implementation documentation. Changelog: [General][Breaking] - The `react-native/core-cli-utils` package is no longer published. It remains available in the React Native repo as a reference implementation. Reviewed By: cortinico Differential Revision: D105959855 fbshipit-source-id: 42e439a45273bdeca76029eff306cdf2451308e2
1 parent 36bec56 commit 9c3fddf

26 files changed

Lines changed: 268 additions & 425 deletions

File tree

packages/core-cli-utils/README.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

packages/core-cli-utils/package.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/core-cli-utils/src/index.flow.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/core-cli-utils/src/index.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/core-cli-utils/src/public/version.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/react-native/react-native.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {Command} from '@react-native-community/cli-types';
1818
// depending on and injecting:
1919
// - @react-native-community/cli-platform-android
2020
// - @react-native-community/cli-platform-ios
21-
// - @react-native/community-cli-plugin (via the @react-native/core-cli-utils package)
21+
// - @react-native/community-cli-plugin
2222
// - codegen command should be inhoused into @react-native-community/cli
2323
//
2424
// This is a temporary workaround.

packages/rn-tester/cli.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,11 @@
1212
import {Command} from 'commander';
1313
*/
1414

15-
// eslint-disable-next-line @react-native/monorepo/sort-imports
16-
const {patchCoreCLIUtilsPackageJSON} = require('./scripts/monorepo');
17-
18-
function injectCoreCLIUtilsRuntimePatch() {
19-
patchCoreCLIUtilsPackageJSON(true);
20-
const cleared = {
21-
status: false,
22-
};
23-
['exit', 'SIGUSR1', 'SIGUSR2', 'uncaughtException'].forEach(event => {
24-
if (cleared.status) {
25-
return;
26-
}
27-
patchCoreCLIUtilsPackageJSON(false);
28-
cleared.status = true;
29-
});
30-
}
31-
3215
if (process.env.BUILD_EXCLUDE_BABEL_REGISTER == null) {
3316
// $FlowFixMe[cannot-resolve-module]
3417
require('../../scripts/shared/babelRegister').registerForMonorepo();
3518
}
3619

37-
injectCoreCLIUtilsRuntimePatch();
38-
3920
const program /*: Command */ = require('./cli.flow.js').default;
4021

4122
if (require.main === module) {

packages/rn-tester/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@react-native-community/cli": "20.0.0",
5656
"@react-native-community/cli-platform-android": "20.0.0",
5757
"@react-native-community/cli-platform-ios": "20.0.0",
58+
"@react-native/core-cli-utils": "*",
5859
"commander": "^12.0.0",
5960
"listr2": "^6.4.1",
6061
"rxjs": "npm:@react-native-community/rxjs@6.5.4-custom"

packages/rn-tester/scripts/monorepo.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)