@@ -109,6 +109,29 @@ function renameItems(libraryName: string) {
109
109
console . log ( '\n' ) ;
110
110
}
111
111
112
+ const _promptInstallExampleApp = {
113
+ properties : {
114
+ installExampleApp : {
115
+ description : cyan (
116
+ 'Would you like to generate an example react app to test your library/component?'
117
+ ) ,
118
+ pattern : / ^ ( y ( e s ) ? | n ( o ) ? ) $ / i,
119
+ type : 'string' ,
120
+ required : true ,
121
+ message : 'You need to type "Yes" or "No" to continue...' ,
122
+ } ,
123
+ } ,
124
+ } ;
125
+ function installExampleApp ( ) {
126
+ _prompt . get ( _promptInstallExampleApp , ( err : any , res : any ) => {
127
+ if ( err ) return ;
128
+ if ( res . installExampleApp . toLowerCase ( ) . charAt ( 0 ) === 'y' ) {
129
+ exec ( 'npx create-react-app example' ) ;
130
+ exec ( 'echo "SKIP_PREFLIGHT_CHECK=true" >> example/.env' ) ;
131
+ }
132
+ } ) ;
133
+ }
134
+
112
135
/**
113
136
* Calls any external programs to finish setting up the library
114
137
*/
@@ -136,14 +159,9 @@ function finalize() {
136
159
writeFileSync ( jsonPackage , JSON . stringify ( pkg , null , 2 ) ) ;
137
160
console . log ( green ( 'Postinstall script has been removed' ) ) ;
138
161
139
- // Initialize Husky
140
- fork (
141
- resolve ( __dirname , '..' , 'node_modules' , 'husky' , 'bin' , 'install' ) ,
142
- [ ] ,
143
- { silent : true }
144
- ) ;
145
- console . log ( green ( 'Git hooks set up' ) ) ;
146
-
162
+ console . log ( yellow ( 'Removing yarn.lock and performing a clean install...' ) ) ;
163
+ rm ( 'yarn.lock' ) ;
164
+ exec ( 'yarn install' ) ;
147
165
console . log ( '\n' ) ;
148
166
}
149
167
/**
@@ -165,6 +183,7 @@ function setupLibrary(libraryName: string) {
165
183
removeItems ( ) ;
166
184
167
185
modifyGitignoreFile ( ) ;
186
+ installExampleApp ( ) ;
168
187
modifyContents ( libraryName , username , usermail ) ;
169
188
// renameItems(libraryName);
170
189
0 commit comments