import * as commander from "commander" ; import { appletsConversionTool , AppletsConversionToolParams } from "../index" ; author CaMnter
  let currentVersion = 'latest' ; try { const { version } = require ( '../../package.json' ) ; currentVersion = version ; } catch ( e ) { } commander . version ( currentVersion || 'latest' ) . usage ( '[options] <any>' ) . option ( '-s, --src <string>' , '目标路径' ) . option ( '-o, --out <string>' , '输出路径' ) . option ( '-t, --target <string>' , '目标类型「\'wx\', \'my\'」' ) . option ( '-e, --expect <string>' , '期望类型「\'wx\', \'my\'」' ) . option ( '-5, --es5 <boolean>' , '是否转为 es5' , false ) . option ( '-f, --filter <string>' , '过滤关键字「node_module, .tea, .idea」等' , '' ) . parse ( process . argv ) ; const { src , out , target , expect , es5 } = commander ; const filter = commander . filter ; let expectFilter = [ ] ; if ( filter && '' !== filter ) { expectFilter = filter . split ( ',' ) ; } if ( expectFilter . length > 0 ) { expectFilter = expectFilter . map ( ( value ) => { return value . trim ( ) ; } ) ; } const params = { src , out , target , expect , options : { es5 : es5 ? true : false , filter : expectFilter || [ ] , } } ; appletsConversionTool ( params ) ;