Skip to content

Commit 4708eb6

Browse files
update creaternwapp.cmd
1 parent 86aea94 commit 4708eb6

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

vnext/Scripts/creaternwapp.cmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ if not "x%RN_VERSION:nightly=%"=="x%RN_VERSION%" (
120120
set RNCLI_TEMPLATE=--template "@react-native-community/template@0.84.1"
121121
)
122122

123+
if not "x%RN_VERSION:-rc=%"=="x%RN_VERSION%" (
124+
@echo creaternwapp.cmd Override @react-native-community/template version for RC
125+
REM RC versions may not have a corresponding template published to npm
126+
REM Windows we need to manually update this with every integration #15124
127+
set RNCLI_TEMPLATE=--template "@react-native-community/template@0.84.1"
128+
)
129+
123130
@echo creaternwapp.cmd: Creating base RN app project with: npx --yes @react-native-community/cli@%RNCLI_VERSION% init %APP_NAME% --version %RN_VERSION% %RNCLI_TEMPLATE% --verbose --skip-install --install-pods false --skip-git-init true
124131
call npx --yes @react-native-community/cli@%RNCLI_VERSION% init %APP_NAME% --version %RN_VERSION% %RNCLI_TEMPLATE% --verbose --skip-install --install-pods false --skip-git-init true
125132

vnext/Scripts/creaternwlib.cmd

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

122129
if %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
142161
call yarn install
143162

0 commit comments

Comments
 (0)