mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-17 21:46:09 +08:00
add document
This commit is contained in:
@@ -79,6 +79,12 @@
|
||||
"options": {
|
||||
"platform": {
|
||||
"hasValue": true
|
||||
},
|
||||
"versionId": {
|
||||
"hasValue": true
|
||||
},
|
||||
"packageId": {
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -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 = {};
|
||||
|
@@ -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) {
|
||||
|
@@ -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);
|
||||
},
|
||||
|
@@ -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.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user