From 355bb98b761ac4f4eb7b3b7724102ba2528431d5 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Wed, 21 Feb 2024 13:59:44 +0100 Subject: [PATCH] feature: warn when using `npx react-native init` --- packages/react-native/cli.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/react-native/cli.js b/packages/react-native/cli.js index 7dd4bfb76de8d5..0e1bd5216512d0 100755 --- a/packages/react-native/cli.js +++ b/packages/react-native/cli.js @@ -39,6 +39,16 @@ async function getLatestVersion(registryHost = DEFAULT_REGISTRY_HOST) { }); } +/** + * Warn when users are using `npx react-native init`, to raise awareness of the changes from RFC 0759. + * @see https://github.com/react-native-community/discussions-and-proposals/tree/main/proposals/0759-react-native-frameworks.md + */ +function warnWhenRunningInit() { + if (process.argv[2] === 'init') { + console.warn('\nRunning: npx @react-native-community/cli init\n'); + } +} + /** * npx react-native -> @react-native-community/cli * @@ -66,6 +76,9 @@ async function main() { // Ignore errors, since it's a nice to have warning } } + + warnWhenRunningInit(); + return cli.run(name); }