@@ -72,20 +72,24 @@ export async function chooseApp(platform: Platform) {
7272}
7373
7474export const commands = {
75- createApp : async function ( { options } ) {
75+ createApp : async function ( {
76+ options,
77+ } : {
78+ options : { name : string ; downloadUrl : string ; platform : Platform } ;
79+ } ) {
7680 const name = options . name || ( await question ( '应用名称:' ) ) ;
7781 const { downloadUrl } = options ;
7882 const platform = checkPlatform (
7983 options . platform || ( await question ( '平台(ios/android/harmony):' ) ) ,
8084 ) ;
81- const { id } = await post ( '/app/create' , { name, platform } ) ;
85+ const { id } = await post ( '/app/create' , { name, platform, downloadUrl } ) ;
8286 console . log ( `已成功创建应用(id: ${ id } )` ) ;
8387 await this . selectApp ( {
8488 args : [ id ] ,
85- options : { platform, downloadUrl } ,
89+ options : { platform } ,
8690 } ) ;
8791 } ,
88- deleteApp : async ( { args, options } ) => {
92+ deleteApp : async ( { args, options } : { args : string [ ] ; options : { platform : Platform } } ) => {
8993 const { platform } = options ;
9094 const id = args [ 0 ] || chooseApp ( platform ) ;
9195 if ( ! id ) {
@@ -94,19 +98,19 @@ export const commands = {
9498 await doDelete ( `/app/${ id } ` ) ;
9599 console . log ( '操作成功' ) ;
96100 } ,
97- apps : async ( { options } ) => {
101+ apps : async ( { options } : { options : { platform : Platform } } ) => {
98102 const { platform } = options ;
99103 listApp ( platform ) ;
100104 } ,
101- selectApp : async ( { args, options } ) => {
105+ selectApp : async ( { args, options } : { args : string [ ] ; options : { platform : Platform } } ) => {
102106 const platform = checkPlatform (
103107 options . platform || ( await question ( '平台(ios/android/harmony):' ) ) ,
104108 ) ;
105109 const id = args [ 0 ]
106110 ? Number . parseInt ( args [ 0 ] )
107111 : ( await chooseApp ( platform ) ) . id ;
108112
109- let updateInfo = { } ;
113+ let updateInfo : Partial < Record < Platform , { appId : number ; appKey : string } > > = { } ;
110114 if ( fs . existsSync ( 'update.json' ) ) {
111115 try {
112116 updateInfo = JSON . parse ( fs . readFileSync ( 'update.json' , 'utf8' ) ) ;
0 commit comments