Skip to content

Commit bfe285b

Browse files
authored
Remove old library templates (#14476)
## Description This PR removes the "old" library templates as the `cpp-lib` template is the recommended template for all modules. ### Type of Change - Bug fix (non-breaking change which fixes an issue) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - This change requires a documentation update ### Why The old lib templates are focused on Old Arch compatible projects, and while they still work sometimes for New Arch, the `cpp-lib` template is **explicitly** a hybrid project to support New and Old arch projects. Resolves #13932 ### What Deleted the shims that exposed the old lib template code to the `init-windows` command. Removed those configurations from the pipeline matrices. ## Screenshots N/A ## Testing Verified old templates are no longer available. ## Changelog Should this change be included in the release notes: _yes_ Removed old lib templates in preference for the new cpp-lib template
1 parent 2082a70 commit bfe285b

File tree

6 files changed

+24
-86
lines changed

6 files changed

+24
-86
lines changed

.ado/jobs/cli-init-windows.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,6 @@ parameters:
7373
configuration: Debug
7474
platform: x86
7575
additionalInitArguments: --namespace MyCompany.MyApplication.MyComponent
76-
- Name: PaperLibX86DebugCpp
77-
template: old/uwp-cpp-lib
78-
configuration: Debug
79-
platform: x86
80-
additionalRunArguments: --no-autolink --no-deploy
81-
- Name: PaperLibX86DebugCs
82-
template: old/uwp-cpp-lib
83-
configuration: Debug
84-
platform: x86
85-
additionalRunArguments: --no-autolink --no-deploy
8676
- Name: PaperX86DebugCppChakra
8777
template: old/uwp-cpp-app
8878
configuration: Debug
@@ -223,16 +213,6 @@ parameters:
223213
configuration: Debug
224214
platform: x86
225215
additionalInitArguments: --namespace MyCompany.MyApplication.MyComponent
226-
- Name: PaperLibX86DebugCpp
227-
template: old/uwp-cpp-lib
228-
configuration: Debug
229-
platform: x86
230-
additionalRunArguments: --no-autolink --no-deploy
231-
- Name: PaperLibX86DebugCs
232-
template: old/uwp-cs-lib
233-
configuration: Debug
234-
platform: x86
235-
additionalRunArguments: --no-autolink --no-deploy
236216
- Name: PaperX86DebugCppChakra
237217
template: old/uwp-cpp-app
238218
configuration: Debug

.ado/templates/react-native-init-windows.yml

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -77,30 +77,12 @@ steps:
7777
displayName: Init new app project with @react-native-community/cli init
7878
workingDirectory: $(Agent.BuildDirectory)
7979
80-
- ${{ if and(endsWith(parameters.template, '-lib'), not(startsWith(parameters.template, 'old'))) }}:
80+
- ${{ if endsWith(parameters.template, '-lib') }}:
8181
- script: |
8282
npx --yes create-react-native-library@latest --slug testcli --description testcli --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 --type turbo-module --react-native-version $(reactNativeDevDependency) --example vanilla testcli
8383
displayName: Init new lib project with create-react-native-library
8484
workingDirectory: $(Agent.BuildDirectory)
8585
86-
- ${{ elseif and(endsWith(parameters.template, '-lib'), startsWith(parameters.template, 'old')) }}:
87-
- script: |
88-
npx --yes create-react-native-module@0.20.2 --package-name "testcli" testcli
89-
displayName: Init new lib project with create-react-native-module
90-
workingDirectory: $(Agent.BuildDirectory)
91-
92-
- script: |
93-
rmdir /s /q android
94-
displayName: Remove broken android folder # See issue https://github.com/microsoft/react-native-windows/issues/12209
95-
workingDirectory: $(Agent.BuildDirectory)\testcli
96-
97-
- script: |
98-
call yarn install
99-
call yarn upgrade react@$(reactDevDependency) --dev
100-
call yarn upgrade react-native@$(reactNativeDevDependency) --dev
101-
displayName: Update lib project react and react-native dev versions
102-
workingDirectory: $(Agent.BuildDirectory)\testcli
103-
10486
- script: |
10587
call yarn install
10688
displayName: pre-windows yarn install
@@ -156,22 +138,21 @@ steps:
156138
- ${{ if eq(parameters.useExperimentalWinUI3, true) }}:
157139
- template: ../templates/enable-experimental-winui3.yml
158140
parameters:
159-
${{ if and(endsWith(parameters.template, '-lib'), not(startsWith(parameters.template, 'old'))) }}:
141+
${{ if endsWith(parameters.template, '-lib') }}:
160142
workingDir: $(Agent.BuildDirectory)\testcli\example\windows
161143
${{ else }}:
162144
workingDir: $(Agent.BuildDirectory)\testcli\windows
163145

164-
- ${{ if or(endsWith(parameters.template, '-app'), and(endsWith(parameters.template, '-lib'), not(startsWith(parameters.template, 'old')))) }}:
165-
- powershell: |
166-
$path = (Get-ChildItem -Filter "Package.appxmanifest" -File -Recurse).FullName;
167-
[xml] $manifest = Get-Content $path
168-
$manifest.Package.Identity.Name = 'ReactNative.InitTest'
169-
$manifest.Save("$path")
170-
displayName: Set AppX package name to "ReactNative.InitTest"
171-
${{ if and(endsWith(parameters.template, '-lib'), not(startsWith(parameters.template, 'old'))) }}:
172-
workingDirectory: $(Agent.BuildDirectory)\testcli\example\windows
173-
${{ else }}:
174-
workingDirectory: $(Agent.BuildDirectory)\testcli\windows
146+
- powershell: |
147+
$path = (Get-ChildItem -Filter "Package.appxmanifest" -File -Recurse).FullName;
148+
[xml] $manifest = Get-Content $path
149+
$manifest.Package.Identity.Name = 'ReactNative.InitTest'
150+
$manifest.Save("$path")
151+
displayName: Set AppX package name to "ReactNative.InitTest"
152+
${{ if endsWith(parameters.template, '-lib') }}:
153+
workingDirectory: $(Agent.BuildDirectory)\testcli\example\windows
154+
${{ else }}:
155+
workingDirectory: $(Agent.BuildDirectory)\testcli\windows
175156
176157
# End npm test server
177158
- template: verdaccio-stop.yml
@@ -184,7 +165,7 @@ steps:
184165

185166
- template: react-native-debug-info.yml
186167
parameters:
187-
${{ if and(endsWith(parameters.template, '-lib'), not(startsWith(parameters.template, 'old'))) }}:
168+
${{ if endsWith(parameters.template, '-lib') }}:
188169
workingDirectory: $(Agent.BuildDirectory)\testcli\example
189170
${{ else }}:
190171
workingDirectory: $(Agent.BuildDirectory)\testcli
@@ -205,7 +186,7 @@ steps:
205186
buildPlatform: ${{ parameters.platform }}
206187
deployOption: ${{ parameters.additionalRunArguments }}
207188
buildLogDirectory: $(Build.BinariesDirectory)\${{ parameters.platform }}\${{ parameters.configuration }}\BuildLogs
208-
${{ if and(endsWith(parameters.template, '-lib'), not(startsWith(parameters.template, 'old'))) }}:
189+
${{ if endsWith(parameters.template, '-lib') }}:
209190
workingDirectory: $(Agent.BuildDirectory)\testcli\example
210191
${{ else }}:
211192
workingDirectory: $(Agent.BuildDirectory)\testcli
@@ -218,7 +199,7 @@ steps:
218199

219200
# #13705 - Temporarily disable test:windows call until we get upstream fix
220201
# Only run the following on fabric apps
221-
# - ${{ if and(endsWith(parameters.template, '-app'), not(startsWith(parameters.template, 'old'))) }}:
202+
# - ${{ if and(endsWith(parameters.template, '-app')) }}:
222203
# - script: call yarn test:windows
223204
# displayName: Run jest tests with react-test-renderer
224205
# workingDirectory: $(Agent.BuildDirectory)\testcli
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Remove old library templates",
4+
"packageName": "react-native-windows",
5+
"email": "jthysell@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

vnext/templates/cpp-lib/template.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ async function postInstall(config = {}, options = {}) {
242242
}
243243

244244
module.exports = {
245-
name: 'React Native Windows Turbo Module (New Arch, C++)',
245+
name: 'React Native Windows Library (C++)',
246246
description:
247-
"[Experimental] A RNW turbo module targeting RN's new architecture.",
247+
"A RNW native/turbo module supporting both RN's old and new architecture.",
248248
preInstall,
249249
getFileMappings,
250250
postInstall,

vnext/templates/old/uwp-cpp-lib/template.config.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

vnext/templates/old/uwp-cs-lib/template.config.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)