-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Contributing to the CLI
Parts of the CLI:
- CLI Package: The commands that run with
react-native <command>are here:
[Root]\packages\@react-native-windows\cli - Template files used with
react-native init-windowscan be found here:
[Root]\vnext\templates
If you've made local changes to your RNW repo, or to one of the CLI commands (such as react-native run-windows, react-native autolink-windows, etc.), the easiest way to do so is to test one of the many RNW apps already existing in the repo, such as packages/e2e-test-app or packages/sample-app-fabric.
If you want to debug a CLI command as it runs, you can do so by running the command in a new "JavaScript Debug Terminal" in VSCode.
See Creating new projects to test specific RNW versions, specifically Using your local RNW repo.
Again, if you want to debug a CLI command as it runs, you can do so by running the command in a new "JavaScript Debug Terminal" in VSCode.
If you are making local changes to the old react-native-windows-init code, you can build and run it locally:
- Build the
react-native-windows-initpackage (packages/react-native-windows-init) locally usingyarn build` - Manually call into the CLI by using
node <root>\packages\react-native-windows-init\bin.js [...]rather than callingnpx react-native-windows-init [...]
Note, you can pass parameters to that as usual, or use node --inspect-brk ... to allow you to attach to the call using VSCode.
Also note that this will only test the changes made directly to the react-native-windows-init package. The other packages will be downloaded from npmjs.org (according to the version you specified with --version) during the process.
Note: If you want to test local changes to RNW or its CLI commands on projects you want to create using
react-native-windows-init, you'll need to use the--devModeoption when running that command. Sincereact-native-windows-inittakes responsibility for callingyarn add react-native-windows, the--devModeoption will tell the script to also callyarn linkon your behalf too. Note this only works for classic Yarn and still requires you to register your repo withyarn linkin yourvnextfolder.