Skip to content

Commit 5d17cf8

Browse files
authored
Merge branch 'main' into react-native-config.js
2 parents e2176f5 + 242b47b commit 5d17cf8

File tree

7 files changed

+36
-5
lines changed

7 files changed

+36
-5
lines changed

packages/create-react-native-library/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [0.42.2](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.42.2) (2024-10-26)
7+
8+
### Bug Fixes
9+
10+
* vanilla example codegen fails ([#665](https://github.com/callstack/react-native-builder-bob/issues/665)) ([a9546fb](https://github.com/callstack/react-native-builder-bob/commit/a9546fbf33b6cc96af64c553311d0ce02e9f9de3)), closes [#662](https://github.com/callstack/react-native-builder-bob/issues/662) - by @atlj
11+
612
## [0.42.1](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.42.1) (2024-10-24)
713

814
### Bug Fixes

packages/create-react-native-library/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-react-native-library",
3-
"version": "0.42.1",
3+
"version": "0.42.2",
44
"description": "CLI to scaffold React Native libraries",
55
"keywords": [
66
"react-native",

packages/create-react-native-library/src/index.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import dedent from 'dedent';
55
import kleur from 'kleur';
66
import yargs from 'yargs';
77
import ora from 'ora';
8+
import assert from 'node:assert';
89
import validateNpmPackage from 'validate-npm-package-name';
910
import githubUsername from 'github-username';
1011
import prompts, { type PromptObject } from './utils/prompts';
@@ -790,8 +791,23 @@ async function create(_argv: yargs.Arguments<any>) {
790791
examplePackageJson.dependencies['react-native'];
791792
}
792793

793-
if (arch !== 'legacy' && example === 'vanilla') {
794-
addCodegenBuildScript(folder, options.project.name);
794+
if (example === 'vanilla') {
795+
// React Native doesn't provide the community CLI as a dependency.
796+
// We have to get read the version from the example app and put to the root package json
797+
const exampleCommunityCLIVersion =
798+
examplePackageJson.devDependencies['@react-native-community/cli'];
799+
assert(
800+
exampleCommunityCLIVersion !== undefined,
801+
"The generated example app doesn't have community CLI installed"
802+
);
803+
804+
rootPackageJson.devDependencies = rootPackageJson.devDependencies || {};
805+
rootPackageJson.devDependencies['@react-native-community/cli'] =
806+
exampleCommunityCLIVersion;
807+
808+
if (arch !== 'legacy') {
809+
addCodegenBuildScript(folder, options.project.name);
810+
}
795811
}
796812
}
797813

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
"devDependencies": {
7373
"@commitlint/config-conventional": "^17.0.2",
7474
"@evilmartians/lefthook": "^1.5.0",
75+
<% if (example === 'vanilla') { -%>
76+
"@react-native-community/cli": "15.0.0-alpha.2",
77+
<% } -%>
7578
"@react-native/eslint-config": "^0.73.1",
7679
"@release-it/conventional-changelog": "^5.0.0",
7780
"@types/jest": "^29.5.5",

packages/react-native-builder-bob/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [0.30.3](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.30.3) (2024-10-26)
7+
8+
### Bug Fixes
9+
10+
* vanilla example codegen fails ([#665](https://github.com/callstack/react-native-builder-bob/issues/665)) ([a9546fb](https://github.com/callstack/react-native-builder-bob/commit/a9546fbf33b6cc96af64c553311d0ce02e9f9de3)), closes [#662](https://github.com/callstack/react-native-builder-bob/issues/662) - by @atlj
11+
612
## [0.30.2](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.30.2) (2024-09-08)
713

814
### Bug Fixes

packages/react-native-builder-bob/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-builder-bob",
3-
"version": "0.30.2",
3+
"version": "0.30.3",
44
"description": "CLI to build JavaScript files for React Native libraries",
55
"keywords": [
66
"react-native",

packages/react-native-builder-bob/src/targets/codegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default async function build({ root, report }: Options) {
3333
}
3434

3535
try {
36-
await spawn('npx', ['react-native', 'codegen'], {
36+
await spawn('npx', ['@react-native-community/cli', 'codegen'], {
3737
stdio: 'ignore',
3838
});
3939

0 commit comments

Comments
 (0)