File tree Expand file tree Collapse file tree 2 files changed +24
-17
lines changed
packages/create-react-native-library/src Expand file tree Collapse file tree 2 files changed +24
-17
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
1818 type Args ,
1919} from './input' ;
2020import { getDependencyVersionsFromExample } from './exampleApp/dependencies' ;
21- import { printErrorHelp , printNextSteps } from './inform' ;
21+ import { printErrorHelp , printNextSteps , printUsedRNVersion } from './inform' ;
2222
2323const FALLBACK_BOB_VERSION = '0.32.0' ;
2424
@@ -82,22 +82,8 @@ async function create(_argv: yargs.Arguments<Args>) {
8282
8383 await fs . mkdirp ( folder ) ;
8484
85- if ( answers . reactNativeVersion != null ) {
86- if ( config . example === 'vanilla' ) {
87- console . log (
88- `${ kleur . blue ( 'ℹ' ) } Using ${ kleur . cyan (
89- `react-native@${ answers . reactNativeVersion } `
90- ) } for the example`
91- ) ;
92- } else {
93- console . warn (
94- `${ kleur . yellow (
95- '⚠'
96- ) } Ignoring --react-native-version for unsupported example type: ${ kleur . cyan (
97- config . example
98- ) } `
99- ) ;
100- }
85+ if ( answers . reactNativeVersion !== null ) {
86+ printUsedRNVersion ( answers . reactNativeVersion , config ) ;
10187 }
10288
10389 const spinner = ora ( ) . start ( ) ;
Original file line number Diff line number Diff line change @@ -122,3 +122,24 @@ export function printErrorHelp(message: string, error: Error) {
122122
123123 process . exit ( 1 ) ;
124124}
125+
126+ export function printUsedRNVersion (
127+ version : string ,
128+ config : TemplateConfiguration
129+ ) {
130+ if ( config . example === 'vanilla' ) {
131+ console . log (
132+ `${ kleur . blue ( 'ℹ' ) } Using ${ kleur . cyan (
133+ `react-native@${ version } `
134+ ) } for the example`
135+ ) ;
136+ } else {
137+ console . warn (
138+ `${ kleur . yellow (
139+ '⚠'
140+ ) } Ignoring --react-native-version for unsupported example type: ${ kleur . cyan (
141+ config . example
142+ ) } `
143+ ) ;
144+ }
145+ }
You can’t perform that action at this time.
0 commit comments