File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55const fs = require ( 'fs' ) ;
66const program = require ( 'commander' ) ;
77const precinct = require ( '../index.js' ) ;
8- const { version } = require ( '../package.json' ) ;
8+ const { name , description , version } = require ( '../package.json' ) ;
99
1010program
11- . arguments ( '<filename>' )
11+ . name ( name )
12+ . description ( description )
1213 . version ( version )
14+ . argument ( '<filename>' )
1315 . option ( '--es6-mixed-imports' , 'Fetch all dependendies from a file that contains both CJS and ES6 imports' )
1416 . option ( '-t, --type <type>' , 'The type of content being passed in. Useful if you want to use a non-JS detective' )
17+ . showHelpAfterError ( )
1518 . parse ( ) ;
1619
17- const cliOptions = program . opts ( ) ;
20+ const { es6MixedImports : mixedImports , type } = program . opts ( ) ;
1821const options = {
1922 es6 : {
20- mixedImports : Boolean ( cliOptions . es6MixedImports )
23+ mixedImports : Boolean ( mixedImports )
2124 } ,
22- type : cliOptions . type
25+ type
2326} ;
2427
2528const content = fs . readFileSync ( program . args [ 0 ] , 'utf8' ) ;
You can’t perform that action at this time.
0 commit comments