1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-17 21:46:09 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

add document

This commit is contained in:
tdzl2003
2016-04-05 20:07:23 +08:00
parent 320b2bf6df
commit 75b29d28d6
13 changed files with 342 additions and 25 deletions

View File

@@ -79,6 +79,12 @@
"options": {
"platform": {
"hasValue": true
},
"versionId": {
"hasValue": true
},
"packageId": {
"hasValue": true
}
}
},

View File

@@ -65,16 +65,18 @@ export async function chooseApp(platform) {
export const commands = {
createApp: async function ({options}) {
const name = options.name || await question('App Name:');
const {downloadUrl} = options;
const platform = checkPlatform(options.platform || await question('Platform(ios/android):'));
const {id} = await post('/app/create', {name, platform});
console.log(`Created app ${id}`);
await this.selectApp({
args: [id],
options: {platform},
options: {platform, downloadUrl},
});
},
deleteApp: async function ({args}) {
const id = args[0] || ((await this.apps()), (await question('Choose App to delete:')));
deleteApp: async function ({args, options}) {
const {platform} = options;
const id = args[0] || chooseApp(platform);
if (!id) {
console.log('Canceled');
}
@@ -86,8 +88,8 @@ export const commands = {
listApp(platform);
},
selectApp: async function({args, options}) {
const {platform} = options;
checkPlatform(platform);
const platform = checkPlatform(options.platform || await question('Platform(ios/android):'));
checkPlatform(platform || await question('Platform(ios/android):'));
const id = args[0] || (await chooseApp(platform)).id;
let updateInfo = {};

View File

@@ -13,7 +13,7 @@ import {ZipFile} from 'yazl';
import {open as openZipFile} from 'yauzl';
import {diff} from 'node-bsdiff';
import { question } from './utils';
import {checkPlatform} from './app';
import crypto from 'crypto';
function mkdir(dir){
@@ -316,14 +316,16 @@ function enumZipEntries(zipFn, callback) {
export const commands = {
bundle: async function({options}){
const platform = checkPlatform(options.platform || await question('Platform(ios/android):'));
const {
entryFile,
intermediaDir,
platform,
output,
dev,
verbose
} = translateOptions(options);
} = translateOptions({...options, platform});
const realOutput = output.replace(/\$\{time\}/g, '' + Date.now());
if (!platform) {

View File

@@ -75,7 +75,7 @@ export const commands = {
console.log('Ok.');
},
packages: async function({options}) {
const { platform } = options;
const platform = checkPlatform(options.platform || await question('Platform(ios/android):'));
const { appId } = await getSelectedApp(platform);
await listPackage(appId);
},

View File

@@ -69,10 +69,13 @@ async function chooseVersion(appId) {
export const commands = {
publish: async function({args, options}) {
const fn = args[0];
const {platform, name, description, metaInfo } = options;
if (!fn || !platform) {
const {name, description, metaInfo } = options;
if (!fn) {
throw new Error('Usage: pushy publish <ppkFile> --platform ios|android');
}
const platform = checkPlatform(options.platform || await question('Platform(ios/android):'));
const { appId } = await getSelectedApp(platform);
const { hash } = await uploadFile(fn);
@@ -87,21 +90,21 @@ export const commands = {
const v = await question('Would you like to bind packages to this version?(Y/N)');
if (v.toLowerCase() === 'y') {
await this.update({args:[], options:{packageId: id, platform}});
await this.update({args:[], options:{versionId: id, platform}});
}
},
versions: async function({options}) {
const { platform } = options;
const platform = checkPlatform(options.platform || await question('Platform(ios/android):'));
const { appId } = await getSelectedApp(platform);
await listVersions(appId);
},
update: async function({args, options}) {
const { platform } = options;
const platform = checkPlatform(options.platform || await question('Platform(ios/android):'));
const { appId } = await getSelectedApp(platform);
const version = await chooseVersion(appId);
const pkg = await choosePackage(appId);
await put(`/app/${appId}/package/${pkg.id}`, {
versionId: version.id,
const versionId = options.versionId || (await chooseVersion(appId)).id;
const pkgId = options.packageId || (await choosePackage(appId)).id;
await put(`/app/${appId}/package/${pkgId}`, {
versionId,
});
console.log('Ok.');
}