-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli): warn underlying command when using npx react-native init
#43127
feat(cli): warn underlying command when using npx react-native init
#43127
Conversation
I'm not sure if there are tests for |
npx react-native init
npx react-native init
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, this is pointing to the merged path, which is currently unavailable. The RFC is scheduled to be merged on the 26th of Feb.
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cortinico merged this pull request in a6397af. |
…#43127) Summary: This adds a new warning for React Native 0.74, implementing the [RFC 0759](https://github.com/react-native-community/discussions-and-proposals/blob/nc/rnf/proposals/0759-react-native-frameworks.md#the-init-command) init command changes. - It's added inside `react-native/cli.js` to avoid warning users when actually executing `npx react-native-community/cli` commands. - The check is fairly simple: `process.argv[2] === 'init'`. The first two args are the Node bin and the actual script bin paths. - The message is sent over `console.warn` to avoid potentially mixing JSON with non-JSON output. ## Changelog: [GENERAL] [ADDED] - Warn with future command when using `npx react-native init` Pull Request resolved: #43127 Test Plan: Any command other than `init` must not warn. - `$ node ./path/to/react-native/cli.js init` - `$ node ./path/to/react-native/cli.js init --help` - Should warn with `Running: npx react-native-community/cli init`  - `$ node ./path/to/react-native/cli.js --help` - Must not warn  Reviewed By: cipolleschi Differential Revision: D54063131 Pulled By: cortinico fbshipit-source-id: c60b8b6034087b584e98b51f5bedf68a46caf44c
…facebook#43127) Summary: This adds a new warning for React Native 0.74, implementing the [RFC 0759](https://github.com/react-native-community/discussions-and-proposals/blob/nc/rnf/proposals/0759-react-native-frameworks.md#the-init-command) init command changes. - It's added inside `react-native/cli.js` to avoid warning users when actually executing `npx react-native-community/cli` commands. - The check is fairly simple: `process.argv[2] === 'init'`. The first two args are the Node bin and the actual script bin paths. - The message is sent over `console.warn` to avoid potentially mixing JSON with non-JSON output. ## Changelog: [GENERAL] [ADDED] - Warn with future command when using `npx react-native init` Pull Request resolved: facebook#43127 Test Plan: Any command other than `init` must not warn. - `$ node ./path/to/react-native/cli.js init` - `$ node ./path/to/react-native/cli.js init --help` - Should warn with `Running: npx react-native-community/cli init`  - `$ node ./path/to/react-native/cli.js --help` - Must not warn  Reviewed By: cipolleschi Differential Revision: D54063131 Pulled By: cortinico fbshipit-source-id: c60b8b6034087b584e98b51f5bedf68a46caf44c
Summary:
This adds a new warning for React Native 0.74, implementing the RFC 0759 init command changes.
react-native/cli.js
to avoid warning users when actually executingnpx @react-native-community/cli
commands.process.argv[2] === 'init'
. The first two args are the Node bin and the actual script bin paths.console.warn
to avoid potentially mixing JSON with non-JSON output.Changelog:
[GENERAL] [ADDED] - Warn with future command when using
npx react-native init
Test Plan:
Any command other than
init
must not warn.$ node ./path/to/react-native/cli.js init
$ node ./path/to/react-native/cli.js init --help
Running: npx @react-native-community/cli init
$ node ./path/to/react-native/cli.js --help