@@ -24,7 +24,7 @@ type Choice<T> = {
2424type OptionConfig < T > = {
2525 id : string ;
2626 description : string ;
27- message : string ;
27+ message ? : string ;
2828 choices : ReadonlyArray < Choice < T > > ;
2929} ;
3030
@@ -34,6 +34,7 @@ type OptionConfigs = {
3434 database : OptionConfig < DatabaseType > ;
3535 auth : OptionConfig < void > ;
3636 outputDir : OptionConfig < void > ;
37+ testing : OptionConfig < void > ;
3738} ;
3839
3940const OPTIONS : OptionConfigs = {
@@ -77,6 +78,11 @@ const OPTIONS: OptionConfigs = {
7778 "Which directory would you like the starter code folder to be in (default is current directory)?" ,
7879 choices : [ ] ,
7980 } ,
81+ testing : {
82+ id : "t" ,
83+ description : "Test locally without cloning repo" ,
84+ choices : [ ] ,
85+ } ,
8086} ;
8187
8288const OPTION_COMBINATION_DENY_LIST = [
@@ -123,7 +129,7 @@ const parseArguments = (args: CommandLineArgs): CommandLineOptions => {
123129 database : {
124130 alias : OPTIONS . database . id ,
125131 type : "string" ,
126- description : OPTIONS . api . description ,
132+ description : OPTIONS . database . description ,
127133 choices : OPTIONS . database . choices . map ( ( choice ) => choice . value ) ,
128134 } ,
129135 auth : {
@@ -136,13 +142,20 @@ const parseArguments = (args: CommandLineArgs): CommandLineOptions => {
136142 type : "string" ,
137143 description : OPTIONS . outputDir . description ,
138144 } ,
145+ testing : {
146+ alias : OPTIONS . testing . id ,
147+ type : "boolean" ,
148+ description : OPTIONS . testing . description ,
149+ } ,
139150 } ) ;
140151
141152 return {
142153 backend : argv . backend as BackendType ,
143154 api : argv . api as APIType ,
144155 database : argv . database as DatabaseType ,
145156 auth : argv . auth ,
157+ outputDir : argv . outputDir ,
158+ testing : argv . testing ,
146159 } ;
147160} ;
148161
@@ -287,19 +300,21 @@ async function cli(args: CommandLineArgs): Promise<Options> {
287300 return Promise . reject ( new Error ( "No directory exists. Exiting..." ) ) ;
288301 }
289302
290- const clone = shell . exec (
291- "git clone https://github.com/uwblueprint/starter-code-v2.git" ,
292- ) ;
303+ if ( ! commandLineOptions . testing ) {
304+ const clone = shell . exec (
305+ "git clone https://github.com/uwblueprint/starter-code-v2.git" ,
306+ ) ;
293307
294- if ( clone . code !== 0 ) {
295- return Promise . reject ( new Error ( "Git clone failed. Exiting..." ) ) ;
296- }
308+ if ( clone . code !== 0 ) {
309+ return Promise . reject ( new Error ( "Git clone failed. Exiting..." ) ) ;
310+ }
297311
298- console . log ( chalk . green . bold ( "Removing .git ..." ) ) ;
299- const removeGit = shell . exec ( "rm -rf starter-code-v2/.git" ) ;
312+ console . log ( chalk . green . bold ( "Removing .git ..." ) ) ;
313+ const removeGit = shell . exec ( "rm -rf starter-code-v2/.git" ) ;
300314
301- if ( removeGit . code !== 0 ) {
302- return Promise . reject ( new Error ( "Remove .git failed. Exiting..." ) ) ;
315+ if ( removeGit . code !== 0 ) {
316+ return Promise . reject ( new Error ( "Remove .git failed. Exiting..." ) ) ;
317+ }
303318 }
304319
305320 return appOptions ;
0 commit comments