diff --git a/packages/community-cli-plugin/package.json b/packages/community-cli-plugin/package.json index c780f698a96..b320c0db5b8 100644 --- a/packages/community-cli-plugin/package.json +++ b/packages/community-cli-plugin/package.json @@ -25,7 +25,8 @@ } }, "files": [ - "dist" + "dist", + "react-native.config.js" ], "scripts": { "prepack": "node ../../scripts/build/prepack.js" diff --git a/packages/community-cli-plugin/react-native.config.js b/packages/community-cli-plugin/react-native.config.js new file mode 100644 index 00000000000..4bb3ce15d72 --- /dev/null +++ b/packages/community-cli-plugin/react-native.config.js @@ -0,0 +1,20 @@ +/** + * 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. + * + * @format + * @noflow + */ + +const { + bundleCommand, + codegenCommand, + spmCommand, + startCommand, +} = require('@react-native/community-cli-plugin'); + +module.exports = { + commands: [bundleCommand, startCommand, spmCommand, codegenCommand], +}; diff --git a/packages/react-native/react-native.config.js b/packages/react-native/react-native.config.js index 36cc09508d4..9683c019136 100644 --- a/packages/react-native/react-native.config.js +++ b/packages/react-native/react-native.config.js @@ -17,13 +17,12 @@ import type {Command} from '@react-native-community/cli-types'; // IMPORTANT: This is a routing file only. Do NOT add new command // definitions or implementations here. // -// New CLI commands belong in @react-native/community-cli-plugin, and -// may (temporarily) be imported and registered here. +// CLI commands belong in @react-native/community-cli-plugin, which registers +// them via its own react-native.config.js. // // Future state: The Community Template should directly depend on and inject: // - @react-native-community/cli-platform-android // - @react-native-community/cli-platform-ios -// - @react-native/community-cli-plugin const verbose = Boolean(process.env.DEBUG?.includes('react-native')); @@ -72,15 +71,6 @@ try { const commands /*: Array */ = []; -const { - bundleCommand, - codegenCommand, - spmCommand, - startCommand, -} = require('@react-native/community-cli-plugin'); - -commands.push(bundleCommand, startCommand, spmCommand, codegenCommand); - const config = { commands, platforms: {} /*:: as {[string]: Readonly<{ diff --git a/packages/rn-tester/package.json b/packages/rn-tester/package.json index 0f4a2b6e888..a5580e8ecd0 100644 --- a/packages/rn-tester/package.json +++ b/packages/rn-tester/package.json @@ -62,6 +62,7 @@ "@react-native-community/cli": "20.2.0", "@react-native-community/cli-platform-android": "20.2.0", "@react-native-community/cli-platform-ios": "20.2.0", + "@react-native/community-cli-plugin": "0.87.0-main", "@react-native/core-cli-utils": "*", "commander": "^12.0.0", "listr2": "^6.4.1", diff --git a/private/helloworld/package.json b/private/helloworld/package.json index 60a9176d610..f8a9791217c 100644 --- a/private/helloworld/package.json +++ b/private/helloworld/package.json @@ -20,6 +20,7 @@ "@babel/preset-env": "^7.25.3", "@babel/runtime": "^7.25.0", "@react-native/babel-preset": "0.87.0-main", + "@react-native/community-cli-plugin": "0.87.0-main", "@react-native/core-cli-utils": "*", "@react-native/eslint-config": "0.87.0-main", "@react-native/jest-preset": "0.87.0-main",