1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

support no-interaction usage.

This commit is contained in:
tdzl2003 2016-07-30 04:19:42 +08:00
parent de3ea04239
commit 67773c458a
7 changed files with 14 additions and 8 deletions

View File

@ -150,6 +150,8 @@
}
},
"globalOptions":{
"no-interactive": {
"default": false
}
}
}

View File

@ -89,7 +89,6 @@ export const commands = {
},
selectApp: async function({args, options}) {
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

@ -24,6 +24,7 @@ const commands = {
exports.run = function () {
const argv = require('cli-arguments').parse(require('../cli.json'));
global.NO_INTERACTIVE = argv.options['no-interactive'];
loadSession()
.then(()=>commands[argv.command](argv))
@ -33,5 +34,6 @@ exports.run = function () {
return;
}
console.error(err.message);
process.exit(-1);
});
};

View File

@ -52,11 +52,11 @@ export const commands = {
const {hash} = await uploadFile(fn);
await post(`/app/${appId}/package/create`, {
const {id} = await post(`/app/${appId}/package/create`, {
name,
hash,
});
console.log('Ok.');
console.log('Ipa uploaded: id');
},
uploadApk: async function({args}) {
const fn = args[0];
@ -68,11 +68,11 @@ export const commands = {
const {hash} = await uploadFile(fn);
await post(`/app/${appId}/package/create`, {
const {id} = await post(`/app/${appId}/package/create`, {
name,
hash,
});
console.log('Ok.');
console.log('Apk uploaded: id');
},
packages: async function({options}) {
const platform = checkPlatform(options.platform || await question('Platform(ios/android):'));

View File

@ -10,6 +10,9 @@ import ipaMetadata from 'ipa-metadata';
var read = require('read');
export function question(query, password) {
if (NO_INTERACTIVE){
return Promise.resolve('');
}
return new Promise((resolve, reject)=>read({
prompt: query,
silent: password,

View File

@ -86,7 +86,7 @@ export const commands = {
description: description || await question('Enter description:'),
metaInfo: metaInfo || await question('Enter meta info:'),
});
console.log('Ok.');
console.log(`Version published: ${id}`);
const v = await question('Would you like to bind packages to this version?(Y/N)');
if (v.toLowerCase() === 'y') {

View File

@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "1.1.1",
"version": "2.0.1",
"description": "react-native hot update",
"main": "lib/index.js",
"scripts": {