@@ -12,6 +12,7 @@ import pack from '../package.json';
12
12
13
13
const TEMPLATE = path . resolve ( __dirname , '../templates/library' ) ;
14
14
const 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' ) ;
15
16
16
17
export default async function create ( argv : yargs . Arguments < any > ) {
17
18
const folder = path . join ( process . cwd ( ) , argv . name ) ;
@@ -51,6 +52,7 @@ export default async function create(argv: yargs.Arguments<any>) {
51
52
authorEmail,
52
53
authorUrl,
53
54
githubUrl : repo ,
55
+ useCpp,
54
56
} = ( await inquirer . prompt ( [
55
57
{
56
58
type : 'input' ,
@@ -118,13 +120,20 @@ export default async function create(argv: yargs.Arguments<any>) {
118
120
} ,
119
121
validate : input => / ^ h t t p s ? : \/ \/ / . test ( input ) || 'Must be a valid URL' ,
120
122
} ,
123
+ {
124
+ type : 'confirm' ,
125
+ name : 'useCpp' ,
126
+ message : 'Does your library use C++ code?' ,
127
+ default : false ,
128
+ } ,
121
129
] ) ) as {
122
130
slug : string ;
123
131
description : string ;
124
132
authorName : string ;
125
133
authorEmail : string ;
126
134
authorUrl : string ;
127
135
githubUrl : string ;
136
+ useCpp : boolean ;
128
137
} ;
129
138
130
139
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>) {
143
152
. slice ( 1 ) } `,
144
153
package : slug . replace ( / [ ^ a - z 0 - 9 ] / g, '' ) . toLowerCase ( ) ,
145
154
podspec : slug . replace ( / [ ^ a - z 0 - 9 ] + / g, '-' ) . replace ( / ^ - / , '' ) ,
155
+ useCpp,
146
156
} ,
147
157
author : {
148
158
name : authorName ,
@@ -176,6 +186,9 @@ export default async function create(argv: yargs.Arguments<any>) {
176
186
} ;
177
187
178
188
await copyDir ( TEMPLATE , folder ) ;
189
+ if ( options . project . useCpp ) {
190
+ await copyDir ( CPP_FILES , folder ) ;
191
+ }
179
192
180
193
try {
181
194
await spawn . sync (
0 commit comments