File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
packages/create-react-native-library Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -790,8 +790,23 @@ async function create(_argv: yargs.Arguments<any>) {
790790 examplePackageJson . dependencies [ 'react-native' ] ;
791791 }
792792
793- if ( arch !== 'legacy' && example === 'vanilla' ) {
794- addCodegenBuildScript ( folder , options . project . name ) ;
793+ if ( example === 'vanilla' ) {
794+ // React Native doesn't provide the community CLI as a dependency.
795+ // We have to get read the version from the example app and put to the root package json
796+ const exampleCommunityCLIVersion =
797+ examplePackageJson . devDependencies [ '@react-native-community/cli' ] ;
798+ console . assert (
799+ exampleCommunityCLIVersion !== undefined ,
800+ "The generated example app doesn't have community CLI installed"
801+ ) ;
802+
803+ rootPackageJson . devDependencies = rootPackageJson . devDependencies || { } ;
804+ rootPackageJson . devDependencies [ '@react-native-community/cli' ] =
805+ exampleCommunityCLIVersion ;
806+
807+ if ( arch !== 'legacy' ) {
808+ addCodegenBuildScript ( folder , options . project . name ) ;
809+ }
795810 }
796811 }
797812
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments