import path from "path" ; import alias from "module-alias" ; alias ( path . resolve ( __dirname , "../../" ) ) ; import { Command } from 'commander' ; import internallyCommand from './internally' ; import { initExtraPack } from './extra' ; const program = new Command ( require ( '../../package' ) . commandName ) ; export interface ICommand { version : string ; description : string ; command : string ; action : ( value ? : any ) => void ; } const initCommand = ( commandConfig ) => { commandConfig . forEach ( config => { const { version , description , command , action } = config ; program . version ( version ) . description ( description ) . command ( command ) . action ( ( value ) => { action ( value ) ; } ) ; } ) ; } ; const init = ( ) => { const extraPacks = initExtraPack ( ) ; initCommand ( [ ... internallyCommand , ... extraPacks ] ) ; } ; init ( ) ; program . parse ( process . argv ) ;