You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): warn underlying command when using npx react-native init (#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
0 commit comments