1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-09 01:25:14 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
tdzl2003
2016-04-03 18:04:10 +08:00
parent f1694be238
commit c89fd2f3c6
4 changed files with 135 additions and 5 deletions

View File

@@ -7,11 +7,40 @@ const {
post,
uploadFile,
} = require('./api');
import { question } from './utils';
import { checkPlatform, getSelectedApp } from './app';
import {getIPAVersion, getApkVersion} from './utils';
export async function listPackage(appId){
const {data} = await get(`/app/${appId}/package/list?limit=1000`);
for (const pkg of data) {
const {version} = pkg;
let versionInfo = '';
if (version) {
versionInfo = ` - ${version.id} ${version.hash.slice(0, 8)} ${version.name}`;
} else {
versionInfo = ' (newest)';
}
console.log(`${pkg.id}) ${pkg.name}(${pkg.status})${versionInfo}`);
}
console.log(`\nTotal ${data.length} packages.`);
return data;
}
export async function choosePackage(appId) {
const list = await listPackage(appId);
while (true) {
const id = await question('Enter packageId:');
const app = list.find(v=>v.id === (id|0));
if (app) {
return app;
}
}
}
export const commands = {
uploadIpa: async function({args}) {
const fn = args[0];
@@ -45,4 +74,9 @@ export const commands = {
});
console.log('Ok.');
},
packages: async function({options}) {
const { platform } = options;
const { appId } = await getSelectedApp(platform);
await listPackage(appId);
},
};