-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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-windows
can 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-init
package (packages/react-native-windows-init) locally using
yarn 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--devMode
option when running that command. Sincereact-native-windows-init
takes responsibility for callingyarn add react-native-windows
, the--devMode
option will tell the script to also callyarn link
on your behalf too. Note this only works for classic Yarn and still requires you to register your repo withyarn link
in yourvnext
folder.