@@ -6,7 +6,7 @@ import { checkPlatform, getSelectedApp } from './app';
66import { getApkInfo , getIpaInfo , getAppInfo } from './utils' ;
77import Table from 'tty-table' ;
88
9- export async function listPackage ( appId ) {
9+ export async function listPackage ( appId : string ) {
1010 const { data } = await get ( `/app/${ appId } /package/list?limit=1000` ) ;
1111
1212 const header = [ { value : '原生包 Id' } , { value : '原生版本' } ] ;
@@ -35,20 +35,20 @@ export async function listPackage(appId) {
3535 return data ;
3636}
3737
38- export async function choosePackage ( appId ) {
38+ export async function choosePackage ( appId : string ) {
3939 const list = await listPackage ( appId ) ;
4040
4141 while ( true ) {
4242 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 ) ) ;
4444 if ( app ) {
4545 return app ;
4646 }
4747 }
4848}
4949
5050export const commands = {
51- uploadIpa : async function ( { args } ) {
51+ uploadIpa : async ( { args } : { args : string [ ] } ) => {
5252 const fn = args [ 0 ] ;
5353 if ( ! fn || ! fn . endsWith ( '.ipa' ) ) {
5454 throw new Error ( '使用方法: pushy uploadIpa ipa后缀文件' ) ;
@@ -85,7 +85,7 @@ export const commands = {
8585 `已成功上传ipa原生包(id: ${ id } , version: ${ versionName } , buildTime: ${ buildTime } )` ,
8686 ) ;
8787 } ,
88- uploadApk : async function ( { args } ) {
88+ uploadApk : async ( { args } ) => {
8989 const fn = args [ 0 ] ;
9090 if ( ! fn || ! fn . endsWith ( '.apk' ) ) {
9191 throw new Error ( '使用方法: pushy uploadApk apk后缀文件' ) ;
@@ -122,7 +122,7 @@ export const commands = {
122122 `已成功上传apk原生包(id: ${ id } , version: ${ versionName } , buildTime: ${ buildTime } )` ,
123123 ) ;
124124 } ,
125- uploadApp : async function ( { args } ) {
125+ uploadApp : async ( { args } ) => {
126126 const fn = args [ 0 ] ;
127127 if ( ! fn || ! fn . endsWith ( '.app' ) ) {
128128 throw new Error ( '使用方法: pushy uploadApp app后缀文件' ) ;
@@ -134,7 +134,6 @@ export const commands = {
134134 appKey : appKeyInPkg ,
135135 } = await getAppInfo ( fn ) ;
136136 const { appId, appKey } = await getSelectedApp ( 'harmony' ) ;
137-
138137
139138 if ( appIdInPkg && appIdInPkg != appId ) {
140139 throw new Error (
@@ -160,28 +159,28 @@ export const commands = {
160159 `已成功上传app原生包(id: ${ id } , version: ${ versionName } , buildTime: ${ buildTime } )` ,
161160 ) ;
162161 } ,
163- parseApp : async function ( { args } ) {
162+ parseApp : async ( { args } ) => {
164163 const fn = args [ 0 ] ;
165164 if ( ! fn || ! fn . endsWith ( '.app' ) ) {
166165 throw new Error ( '使用方法: pushy parseApp app后缀文件' ) ;
167166 }
168167 console . log ( await getAppInfo ( fn ) ) ;
169168 } ,
170- parseIpa : async function ( { args } ) {
169+ parseIpa : async ( { args } ) => {
171170 const fn = args [ 0 ] ;
172171 if ( ! fn || ! fn . endsWith ( '.ipa' ) ) {
173172 throw new Error ( '使用方法: pushy parseIpa ipa后缀文件' ) ;
174173 }
175174 console . log ( await getIpaInfo ( fn ) ) ;
176175 } ,
177- parseApk : async function ( { args } ) {
176+ parseApk : async ( { args } ) => {
178177 const fn = args [ 0 ] ;
179178 if ( ! fn || ! fn . endsWith ( '.apk' ) ) {
180179 throw new Error ( '使用方法: pushy parseApk apk后缀文件' ) ;
181180 }
182181 console . log ( await getApkInfo ( fn ) ) ;
183182 } ,
184- packages : async function ( { options } ) {
183+ packages : async ( { options } ) => {
185184 const platform = checkPlatform (
186185 options . platform || ( await question ( '平台(ios/android/harmony):' ) ) ,
187186 ) ;
0 commit comments