The init-windows command will now stamp the template, name, and namespace arguments to the project's package.json file as follows: json { "react-native-windows": { "init-windows": { "name": "testcli", "namespace": "testcli", "template": "cpp-app", }, }, }
The config command (and therefore all other CLI commands) will now contain the contents of this new react-native-windows section in a new rnwConfig property.
Then, as per #13937:
The init-windows command will now use the previously saved arguments if they're available (and not otherwise overwritten by passed-in arguments)
If the template arg is missing (as it will be for all previously created projects) the config command will try to determine which template was used and inject it
Additionally, as per #13926:
The autolink-windows command will now use the template information to use the correct files when autolinking
Bonus, as per #13174:
The autolink-windows command will now include both the CPP and H file (the H file wasn't being regenerated before)
Screenshots
N/A
Testing
Verified new projects contain the new information.
Changelog
Should this change be included in the release notes: yes
Update RNW CLI to preserve and re-use init-windows arguments
This PR backports #13988 to 0.76.
Description
This PR updates the RNW CLI to preserve and re-use the arguments passed to
init-windows
when the project was created.Type of Change
Why
The RNW CLI should be smart enough to change its command's behaviors based on the template used by the project.
Closes #13927 Closes #13926 Closes #13937 Closes #13174
What
As per #13927:
init-windows
command will now stamp thetemplate
,name
, andnamespace
arguments to the project'spackage.json
file as follows:json { "react-native-windows": { "init-windows": { "name": "testcli", "namespace": "testcli", "template": "cpp-app", }, }, }
config
command (and therefore all other CLI commands) will now contain the contents of this newreact-native-windows
section in a newrnwConfig
property.Then, as per #13937:
init-windows
command will now use the previously saved arguments if they're available (and not otherwise overwritten by passed-in arguments)config
command will try to determine which template was used and inject itAdditionally, as per #13926:
autolink-windows
command will now use the template information to use the correct files when autolinkingBonus, as per #13174:
autolink-windows
command will now include both the CPP and H file (the H file wasn't being regenerated before)Screenshots
N/A
Testing
Verified new projects contain the new information.
Changelog
Should this change be included in the release notes: yes
Update RNW CLI to preserve and re-use
init-windows
argumentsMicrosoft Reviewers: Open in CodeFlow