Skip to content
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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/react-native/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

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.

*/
function warnWhenRunningInit() {
if (process.argv[2] === 'init') {
console.warn('\nRunning: npx @react-native-community/cli init\n');
}
}

/**
* npx react-native -> @react-native-community/cli
*
Expand Down Expand Up @@ -66,6 +76,9 @@ async function main() {
// Ignore errors, since it's a nice to have warning
}
}

warnWhenRunningInit();

return cli.run(name);
}

Expand Down
Loading