@@ -6,7 +6,7 @@ import { checkPlatform, getSelectedApp } from './app';
6
6
import { getApkInfo , getIpaInfo , getAppInfo } from './utils' ;
7
7
import Table from 'tty-table' ;
8
8
9
- export async function listPackage ( appId ) {
9
+ export async function listPackage ( appId : string ) {
10
10
const { data } = await get ( `/app/${ appId } /package/list?limit=1000` ) ;
11
11
12
12
const header = [ { value : '原生包 Id' } , { value : '原生版本' } ] ;
@@ -35,20 +35,20 @@ export async function listPackage(appId) {
35
35
return data ;
36
36
}
37
37
38
- export async function choosePackage ( appId ) {
38
+ export async function choosePackage ( appId : string ) {
39
39
const list = await listPackage ( appId ) ;
40
40
41
41
while ( true ) {
42
42
const id = await question ( '输入原生包 id:' ) ;
43
- const app = list . find ( ( v ) => v . id === ( id | 0 ) ) ;
43
+ const app = list . find ( ( v ) => v . id === Number ( id ) ) ;
44
44
if ( app ) {
45
45
return app ;
46
46
}
47
47
}
48
48
}
49
49
50
50
export const commands = {
51
- uploadIpa : async function ( { args } ) {
51
+ uploadIpa : async ( { args } : { args : string [ ] } ) => {
52
52
const fn = args [ 0 ] ;
53
53
if ( ! fn || ! fn . endsWith ( '.ipa' ) ) {
54
54
throw new Error ( '使用方法: pushy uploadIpa ipa后缀文件' ) ;
@@ -85,7 +85,7 @@ export const commands = {
85
85
`已成功上传ipa原生包(id: ${ id } , version: ${ versionName } , buildTime: ${ buildTime } )` ,
86
86
) ;
87
87
} ,
88
- uploadApk : async function ( { args } ) {
88
+ uploadApk : async ( { args } ) => {
89
89
const fn = args [ 0 ] ;
90
90
if ( ! fn || ! fn . endsWith ( '.apk' ) ) {
91
91
throw new Error ( '使用方法: pushy uploadApk apk后缀文件' ) ;
@@ -122,7 +122,7 @@ export const commands = {
122
122
`已成功上传apk原生包(id: ${ id } , version: ${ versionName } , buildTime: ${ buildTime } )` ,
123
123
) ;
124
124
} ,
125
- uploadApp : async function ( { args } ) {
125
+ uploadApp : async ( { args } ) => {
126
126
const fn = args [ 0 ] ;
127
127
if ( ! fn || ! fn . endsWith ( '.app' ) ) {
128
128
throw new Error ( '使用方法: pushy uploadApp app后缀文件' ) ;
@@ -134,7 +134,6 @@ export const commands = {
134
134
appKey : appKeyInPkg ,
135
135
} = await getAppInfo ( fn ) ;
136
136
const { appId, appKey } = await getSelectedApp ( 'harmony' ) ;
137
-
138
137
139
138
if ( appIdInPkg && appIdInPkg != appId ) {
140
139
throw new Error (
@@ -160,28 +159,28 @@ export const commands = {
160
159
`已成功上传app原生包(id: ${ id } , version: ${ versionName } , buildTime: ${ buildTime } )` ,
161
160
) ;
162
161
} ,
163
- parseApp : async function ( { args } ) {
162
+ parseApp : async ( { args } ) => {
164
163
const fn = args [ 0 ] ;
165
164
if ( ! fn || ! fn . endsWith ( '.app' ) ) {
166
165
throw new Error ( '使用方法: pushy parseApp app后缀文件' ) ;
167
166
}
168
167
console . log ( await getAppInfo ( fn ) ) ;
169
168
} ,
170
- parseIpa : async function ( { args } ) {
169
+ parseIpa : async ( { args } ) => {
171
170
const fn = args [ 0 ] ;
172
171
if ( ! fn || ! fn . endsWith ( '.ipa' ) ) {
173
172
throw new Error ( '使用方法: pushy parseIpa ipa后缀文件' ) ;
174
173
}
175
174
console . log ( await getIpaInfo ( fn ) ) ;
176
175
} ,
177
- parseApk : async function ( { args } ) {
176
+ parseApk : async ( { args } ) => {
178
177
const fn = args [ 0 ] ;
179
178
if ( ! fn || ! fn . endsWith ( '.apk' ) ) {
180
179
throw new Error ( '使用方法: pushy parseApk apk后缀文件' ) ;
181
180
}
182
181
console . log ( await getApkInfo ( fn ) ) ;
183
182
} ,
184
- packages : async function ( { options } ) {
183
+ packages : async ( { options } ) => {
185
184
const platform = checkPlatform (
186
185
options . platform || ( await question ( '平台(ios/android/harmony):' ) ) ,
187
186
) ;
0 commit comments