import program from 'commander' ; import chalk from 'chalk' ; import createWebScriptsLibrary from '.' ; const pkg = require ( '../package.json' ) ; let projectName ; program . version ( pkg . version ) . arguments ( '<project-directory>' ) . usage ( `${ chalk . green ( '<project-directory>' ) } [options]` ) . action ( ( name ) => { projectName = name ; } ) . allowUnknownOption ( ) . parse ( process . argv ) ; async function run ( ) { try { await createWebScriptsLibrary ( projectName ) ; } catch ( err ) { console . log ( chalk . redBright ( 'Failed to create your project!' ) ) ; console . log ( ( err as Error ) . message ) ; process . exit ( 1 ) ; return ; } } run ( ) ;