@@ -116,8 +116,15 @@ for /f "delims=" %%a in ('npm show react@%R_VERSION% version') do @set R_VERSION
116116
117117@ echo creaternwlib.cmd Creating RNW lib " %LIB_NAME% " with react@%R_VERSION% , react-native@%RN_VERSION% , and react-native-windows@%RNW_VERSION%
118118
119- @ echo creaternwlib.cmd Creating base RN library project with: npx --yes create-react-native-library@0.48.9 --slug %LIB_NAME% --description %LIB_NAME% --author-name " React-Native-Windows Bot" --author-email 53619745+rnbot@users.noreply.github.com --author-url http://example.com --repo-url http://example.com --languages kotlin-objc --local false --type %RN_TEMPLATE_TYPE% --react-native-version %RN_VERSION% --example vanilla %LIB_NAME%
120- call npx --yes create-react-native-library@ 0.48.9 --slug %LIB_NAME% --description %LIB_NAME% --author-name " React-Native-Windows Bot" --author-email 53619745+rnbot@ users.noreply.github.com --author-url http://example.com --repo-url http://example.com --languages kotlin-objc --local false --type %RN_TEMPLATE_TYPE% --react-native-version %RN_VERSION% --example vanilla %LIB_NAME%
119+ set CRNL_RN_VERSION_ARG = --react-native-version %RN_VERSION%
120+ if not " x%RN_VERSION:-rc =% " == " x%RN_VERSION% " (
121+ @ echo creaternwlib.cmd Override --react-native-version for RC build, will fix up versions later
122+ REM RC versions may not have a corresponding template published to npm, omit --react-native-version
123+ set CRNL_RN_VERSION_ARG =
124+ )
125+
126+ @ echo creaternwlib.cmd Creating base RN library project with: npx --yes create-react-native-library@0.48.9 --slug %LIB_NAME% --description %LIB_NAME% --author-name " React-Native-Windows Bot" --author-email 53619745+rnbot@users.noreply.github.com --author-url http://example.com --repo-url http://example.com --languages kotlin-objc --local false --type %RN_TEMPLATE_TYPE% %CRNL_RN_VERSION_ARG% --example vanilla %LIB_NAME%
127+ call npx --yes create-react-native-library@ 0.48.9 --slug %LIB_NAME% --description %LIB_NAME% --author-name " React-Native-Windows Bot" --author-email 53619745+rnbot@ users.noreply.github.com --author-url http://example.com --repo-url http://example.com --languages kotlin-objc --local false --type %RN_TEMPLATE_TYPE% %CRNL_RN_VERSION_ARG% --example vanilla %LIB_NAME%
121128
122129if %ERRORLEVEL% neq 0 (
123130 @ echo creaternwlib.cmd: Unable to create base RN library project
@@ -138,6 +145,18 @@ if not "x%RN_VERSION:nightly=%"=="x%RN_VERSION%" (
138145 popd
139146)
140147
148+ if not " x%RN_VERSION:-rc =% " == " x%RN_VERSION% " (
149+ @ echo creaternwlib.cmd Fixing react-native RC version
150+ pwsh.exe -Command " (gc package.json) -replace '" " react-native" " : " " [^\*]*" " ', '" " react-native" " : " " %RN_VERSION% " " ' | Out-File -encoding utf8NoBOM package.json"
151+ pwsh.exe -Command " (gc package.json) -replace '" " @react-native/(.+-(config|preset))" " : " " .*" " ', '" " @react-native/$1" " : " " %RN_VERSION% " " ' | Out-File -encoding utf8NoBOM package.json"
152+ pwsh.exe -Command " (gc package.json) -replace '" " @react-native-community/cli((-platform-)?(ios|android))?" " : " " .*" " ', '" " @react-native-community/cli$1" " : " " %RNCLI_VERSION% " " ' | Out-File -encoding utf8NoBOM package.json"
153+ pushd example
154+ pwsh.exe -Command " (gc package.json) -replace '" " react-native" " : " " [^\*]*" " ', '" " react-native" " : " " %RN_VERSION% " " ' | Out-File -encoding utf8NoBOM package.json"
155+ pwsh.exe -Command " (gc package.json) -replace '" " @react-native/(.+-(config|preset))" " : " " .*" " ', '" " @react-native/$1" " : " " %RN_VERSION% " " ' | Out-File -encoding utf8NoBOM package.json"
156+ pwsh.exe -Command " (gc package.json) -replace '" " @react-native-community/cli((-platform-)?(ios|android))?" " : " " .*" " ', '" " @react-native-community/cli$1" " : " " %RNCLI_VERSION% " " ' | Out-File -encoding utf8NoBOM package.json"
157+ popd
158+ )
159+
141160@ echo creaternwlib.cmd: Calling yarn install
142161call yarn install
143162
0 commit comments