Skip to content

Commit 75a630a

Browse files
authored
feat: remove experimental label from c++ template (#961)
the c++ template no longer requires `includesGeneratedCode: true`
1 parent 4968d0a commit 75a630a

9 files changed

Lines changed: 4 additions & 63 deletions

File tree

‎.github/workflows/build-templates.yml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,6 @@ jobs:
173173
working-directory: ${{ env.work_dir }}
174174
run: yarn nitrogen
175175

176-
- name: Generate codegen native code
177-
if: matrix.type.language == 'cpp'
178-
working-directory: ${{ env.work_dir }}
179-
run: yarn bob build --target codegen
180-
181176
- name: Cache turborepo
182177
if: env.android_build == 1 || env.ios_build == 1
183178
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0

‎docs/pages/create.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,3 @@ Once the project is created, you can follow the official React Native docs to le
9595
- [Fabric Components](https://reactnative.dev/docs/fabric-native-components-introduction)
9696

9797
Turbo Modules and Fabric components don't have native support for Swift. If you want to write the iOS implementation in Swift for a Turbo Module or Fabric View, see [Swift with Turbo Modules and Fabric](./swift-new-architecture.md).
98-
99-
> Note: The C++ template is currently experimental and only works with `includesGeneratedCode: true`. This can make it incompatible with React Native versions other than the one used to generate the codegen files. See [Including Generated Code into Libraries](https://reactnative.dev/docs/the-new-architecture/codegen-cli#including-generated-code-into-libraries) in the React Native docs for more details.

‎packages/create-react-native-library/src/exampleApp/dependencies.ts‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import sortObjectKeys from '../utils/sortObjectKeys.ts';
44

55
type PackageJson = {
66
devDependencies?: Record<string, string>;
7-
'react-native-builder-bob'?: {
8-
targets?: (string | [string, unknown])[];
9-
};
107
};
118

129
export async function alignDependencyVersionsWithExampleApp(
@@ -24,15 +21,6 @@ export async function alignDependencyVersionsWithExampleApp(
2421
'@react-native/babel-preset',
2522
];
2623

27-
const usesCodegen =
28-
pkg['react-native-builder-bob']?.targets?.some((target) =>
29-
Array.isArray(target) ? target[0] === 'codegen' : target === 'codegen'
30-
) ?? false;
31-
32-
if (usesCodegen) {
33-
PACKAGES_TO_COPY.push('@react-native-community/cli');
34-
}
35-
3624
const devDependencies: Record<string, string> = {};
3725

3826
PACKAGES_TO_COPY.forEach((name) => {

‎packages/create-react-native-library/src/prompt.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const LANGUAGE_CHOICES: {
6464
types: ['turbo-module', 'fabric-view'],
6565
},
6666
{
67-
title: 'C++ (Experimental)',
67+
title: 'C++',
6868
value: 'cpp',
6969
types: ['turbo-module'],
7070
},
@@ -364,7 +364,7 @@ export const prompt = create(['[name]'], {
364364
const answers = prompt.read();
365365

366366
if (answers.languages === 'cpp') {
367-
return choice.value !== 'vanilla';
367+
return choice.value === 'test-app';
368368
}
369369

370370
return false;

‎packages/create-react-native-library/templates/common/$.github/workflows/ci.yml‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ jobs:
7979
- name: Generate nitrogen code
8080
run: yarn nitrogen
8181
<% } -%>
82-
<% if (project.cpp) { -%>
83-
84-
- name: Generate codegen native code
85-
run: yarn bob build --target codegen
86-
<% } -%>
8782

8883
- name: Cache turborepo for Android
8984
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
@@ -157,11 +152,6 @@ jobs:
157152
- name: Generate nitrogen code
158153
run: yarn nitrogen
159154
<% } -%>
160-
<% if (project.cpp) { -%>
161-
162-
- name: Generate codegen native code
163-
run: yarn bob build --target codegen
164-
<% } -%>
165155

166156
- name: Cache turborepo for iOS
167157
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3

‎packages/create-react-native-library/templates/common/$package.json‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@
6969
"registry": "https://registry.npmjs.org/"
7070
},
7171
"devDependencies": {
72-
<% if (project.cpp) { -%>
73-
"@react-native-community/cli": "20.2.0",
74-
<% } -%>
7572
"@react-native/babel-preset": "0.88.0",
7673
"@types/react": "^19.2.0",
7774
"del-cli": "^8.0.1",
@@ -125,22 +122,14 @@
125122
{
126123
"project": "tsconfig.build.json"
127124
}
128-
]<% if (project.cpp) { -%>,
129-
"codegen"
130-
<% } -%>
125+
]
131126
]
132127
<% if (project.moduleConfig === 'turbo-modules' || project.viewConfig === 'fabric-view') { -%>
133128
},
134129
"codegenConfig": {
135130
"name": "<%- project.name -%><%- project.viewConfig !== null ? 'View': '' -%>Spec",
136131
"type": "<%- project.viewConfig !== null ? 'all': 'modules' -%>",
137132
"jsSrcsDir": "src",
138-
<% if (project.cpp) { -%>
139-
"outputDir": {
140-
"ios": "ios/generated",
141-
"android": "android/generated"
142-
},
143-
<% } -%>
144133
"android": {
145134
"javaPackageName": "com.<%- project.package %>"
146135
<% if (project.viewConfig === 'fabric-view') { -%>
@@ -153,9 +142,6 @@
153142
}
154143
<% } -%>
155144
}
156-
<% if (project.cpp) { -%>,
157-
"includesGeneratedCode": true
158-
<% } -%>
159145
<% } -%>
160146
}
161147
}

‎packages/create-react-native-library/templates/common/CONTRIBUTING.md‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ To invoke **Nitrogen**, use the following command:
3737
yarn nitrogen
3838
```
3939

40-
<% } -%>
41-
<% if (project.cpp) { -%>
42-
You need to run React Native Codegen to generate the native scaffolding for the C++ Turbo Module. The example app will not build without these generated files.
43-
44-
Run **Codegen** in following cases:
45-
46-
- When you make changes to `src/Native<%- project.name -%>.ts`.
47-
- When running the project for the first time (since the generated files are not committed to the repository).
48-
49-
To invoke **Codegen**, use the following command:
50-
51-
```sh
52-
yarn bob build --target codegen
53-
```
54-
5540
<% } -%>
5641
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
5742

‎packages/create-react-native-library/templates/cpp-library/react-native.config.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module.exports = {
55
dependency: {
66
platforms: {
77
android: {
8-
cmakeListsPath: 'generated/jni/CMakeLists.txt',
98
cxxModuleCMakeListsModuleName: '<%- project.identifier -%>',
109
cxxModuleCMakeListsPath: 'CMakeLists.txt',
1110
cxxModuleHeaderName: '<%- project.name -%>Impl',

‎packages/create-react-native-library/templates/cpp-library/{%- project.name %}.podspec‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
1313
s.platforms = { :ios => min_ios_version_supported }
1414
s.source = { :git => "<%- repo -%>.git", :tag => "#{s.version}" }
1515

16-
s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}", "ios/generated/*.{h,cpp,mm}"
16+
s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}"
1717
s.private_header_files = "ios/**/*.h"
1818

1919
install_modules_dependencies(s)

0 commit comments

Comments
 (0)