@@ -7,29 +7,35 @@ const isInvalidPath = require("is-invalid-path");
77interface CLIArguments {
88 source : PathFactory . Type ;
99 port : number ;
10- tsconfig ?: PathFactory . Type ;
10+ tsConfig ?: PathFactory . Type ;
11+ exclude ?: string ;
12+ webpackConfig ?: PathFactory . Type ;
1113}
1214
1315export const validateCliArguments = ( args : commander . Command ) : CLIArguments => {
1416 if ( typeof args [ "source" ] !== "string" || isInvalidPath ( args [ "source" ] ) ) {
1517 throw new SourcePathInvalidError ( "`--source` arguments does not selected." ) ;
1618 }
17- if ( args [ "tsconfig " ] && isInvalidPath ( args [ "source" ] ) ) {
19+ if ( args [ "tsConfig " ] && isInvalidPath ( args [ "source" ] ) ) {
1820 throw new SourcePathInvalidError ( "`--source` arguments does not selected." ) ;
1921 }
2022 return {
2123 source : PathFactory . create ( { source : args [ "source" ] } ) ,
2224 port : args [ "port" ] ,
23- tsconfig : args [ "tsconfig" ] && PathFactory . create ( { source : args [ "tsconfig" ] } ) ,
25+ tsConfig : args [ "tsConfig" ] && PathFactory . create ( { source : args [ "tsConfig" ] } ) ,
26+ exclude : args [ "exclude" ] ,
27+ webpackConfig : args [ "webpackConfig" ] && PathFactory . create ( { source : args [ "webpackConfig" ] } ) ,
2428 } ;
2529} ;
2630
2731export const executeCommandLine = ( ) : CLIArguments => {
2832 commander
2933 . version ( process . env . VERSION ! ) // add webpack.DefinePlugin
30- . option ( "-s --source [value]" , "Source Directory or File" )
31- . option ( "-p --port [value]" , "Port number" , 3000 )
32- . option ( "--tsconfig [value]" , "tsconfig.json path" , undefined )
34+ . option ( "-s --source [directory]" , "Source directory" )
35+ . option ( "-p --port [number]" , "Port number" , 3000 )
36+ . option ( "--ts-config [path]" , "tsconfig.json path" , undefined )
37+ . option ( "--webpack-config [path]" , "webpack.config.js path (only js file)" )
38+ . option ( "--exclude [string pattern]" , "cruise exclude pattern" , "node_modules" )
3339 . parse ( process . argv ) ;
3440 return validateCliArguments ( commander ) ;
3541} ;
0 commit comments