1
+ import { fileURLToPath } from 'node:url'
2
+
1
3
import { program } from 'commander'
2
- import tl from 'terminal-link'
3
4
import consola from 'consola'
4
- import { fileURLToPath } from 'url '
5
+ import tl from 'terminal-link '
5
6
6
7
import { readPkg } from './utils'
7
- import { getBanner } from './utils/show-brand'
8
- import { usage } from './utils/show-usage'
9
8
import { HOMEPAGE } from './utils/constants'
10
9
import logger from './utils/logger'
10
+ import { getBanner } from './utils/show-brand'
11
+ import { usage } from './utils/show-usage'
11
12
12
13
// polyfill node12 & 14 global variable
13
14
global . __filename = fileURLToPath ( import . meta. url )
@@ -23,12 +24,12 @@ const cli = program
23
24
. addHelpText ( 'beforeAll' , ( ) => `${ getBanner ( ) } \n` )
24
25
25
26
const commands = {
26
- create : async ( ) => await import ( './commands/create' ) . then ( ( res ) => res . create ) ,
27
- list : async ( ) => await import ( './commands/list' ) . then ( ( res ) => res . list ) ,
28
- add : async ( ) => await import ( './commands/add' ) . then ( ( res ) => res . add ) ,
29
- run : async ( ) => await import ( './commands/run' ) . then ( ( res ) => res . run ) ,
30
- prepack : async ( ) => await import ( './commands/prepack' ) . then ( ( res ) => res . prepack ) ,
31
- whoami : async ( ) => await import ( './commands/whoami' ) . then ( ( res ) => res . whoami ) ,
27
+ create : async ( ) => await import ( './commands/create' ) . then ( res => res . create ) ,
28
+ list : async ( ) => await import ( './commands/list' ) . then ( res => res . list ) ,
29
+ add : async ( ) => await import ( './commands/add' ) . then ( res => res . add ) ,
30
+ run : async ( ) => await import ( './commands/run' ) . then ( res => res . run ) ,
31
+ prepack : async ( ) => await import ( './commands/prepack' ) . then ( res => res . prepack ) ,
32
+ whoami : async ( ) => await import ( './commands/whoami' ) . then ( res => res . whoami ) ,
32
33
}
33
34
34
35
const handler = ( cmdName : string ) => {
80
81
) } generator`,
81
82
)
82
83
. option ( '-m, --module [modules...]' , 'Partial modules of workflow will run' )
84
+ . option ( '--store-dir [storeDir]' , 'Set store dir' )
83
85
. action ( handler ( 'run' ) )
84
86
. addHelpText ( 'after' , usage . run ( ) )
85
87
100
102
program . parse ( process . argv )
101
103
102
104
consola . wrapConsole ( )
103
- process . on ( 'unhandledRejection' , ( err ) => consola . error ( '[unhandledRejection]' , err ) )
104
- process . on ( 'uncaughtException' , ( err ) => consola . error ( '[uncaughtException]' , err ) )
105
- // @ts -ignore http://nodejs.cn/api/process/process_nodeprecation.html
105
+ process . on ( 'unhandledRejection' , err => consola . error ( '[unhandledRejection]' , err ) )
106
+ process . on ( 'uncaughtException' , err => consola . error ( '[uncaughtException]' , err ) )
107
+ // @ts -expect-error http://nodejs.cn/api/process/process_nodeprecation.html
106
108
process . noDeprecation = true
0 commit comments