@@ -12,6 +12,7 @@ import pack from '../package.json';
1212
1313const TEMPLATE = path . resolve ( __dirname , '../templates/library' ) ;
1414const BINARIES = / ( g r a d l e w | \. ( j a r | k e y s t o r e | p n g | j p g | g i f ) ) $ / ;
15+ const CPP_FILES = path . resolve ( __dirname , '../templates/cppLibrary' ) ;
1516
1617export default async function create ( argv : yargs . Arguments < any > ) {
1718 const folder = path . join ( process . cwd ( ) , argv . name ) ;
@@ -51,6 +52,7 @@ export default async function create(argv: yargs.Arguments<any>) {
5152 authorEmail,
5253 authorUrl,
5354 githubUrl : repo ,
55+ useCpp,
5456 } = ( await inquirer . prompt ( [
5557 {
5658 type : 'input' ,
@@ -118,13 +120,20 @@ export default async function create(argv: yargs.Arguments<any>) {
118120 } ,
119121 validate : input => / ^ h t t p s ? : \/ \/ / . test ( input ) || 'Must be a valid URL' ,
120122 } ,
123+ {
124+ type : 'confirm' ,
125+ name : 'useCpp' ,
126+ message : 'Does your library use C++ code?' ,
127+ default : false ,
128+ } ,
121129 ] ) ) as {
122130 slug : string ;
123131 description : string ;
124132 authorName : string ;
125133 authorEmail : string ;
126134 authorUrl : string ;
127135 githubUrl : string ;
136+ useCpp : boolean ;
128137 } ;
129138
130139 const project = slug . replace ( / ^ ( r e a c t - n a t i v e - | @ [ ^ / ] + \/ ) / , '' ) ;
@@ -143,6 +152,7 @@ export default async function create(argv: yargs.Arguments<any>) {
143152 . slice ( 1 ) } `,
144153 package : slug . replace ( / [ ^ a - z 0 - 9 ] / g, '' ) . toLowerCase ( ) ,
145154 podspec : slug . replace ( / [ ^ a - z 0 - 9 ] + / g, '-' ) . replace ( / ^ - / , '' ) ,
155+ useCpp,
146156 } ,
147157 author : {
148158 name : authorName ,
@@ -176,6 +186,9 @@ export default async function create(argv: yargs.Arguments<any>) {
176186 } ;
177187
178188 await copyDir ( TEMPLATE , folder ) ;
189+ if ( options . project . useCpp ) {
190+ await copyDir ( CPP_FILES , folder ) ;
191+ }
179192
180193 try {
181194 await spawn . sync (
0 commit comments