1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-18 01:26:10 +08:00
Code Issues 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":{ "globalOptions":{
"no-interactive": {
"default": false
}
} }
} }

View File

@@ -89,7 +89,6 @@ export const commands = {
}, },
selectApp: async function({args, options}) { selectApp: async function({args, options}) {
const platform = checkPlatform(options.platform || await question('Platform(ios/android):')); 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; const id = args[0] || (await chooseApp(platform)).id;
let updateInfo = {}; let updateInfo = {};

View File

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

View File

@@ -52,11 +52,11 @@ export const commands = {
const {hash} = await uploadFile(fn); const {hash} = await uploadFile(fn);
await post(`/app/${appId}/package/create`, { const {id} = await post(`/app/${appId}/package/create`, {
name, name,
hash, hash,
}); });
console.log('Ok.'); console.log('Ipa uploaded: id');
}, },
uploadApk: async function({args}) { uploadApk: async function({args}) {
const fn = args[0]; const fn = args[0];
@@ -68,11 +68,11 @@ export const commands = {
const {hash} = await uploadFile(fn); const {hash} = await uploadFile(fn);
await post(`/app/${appId}/package/create`, { const {id} = await post(`/app/${appId}/package/create`, {
name, name,
hash, hash,
}); });
console.log('Ok.'); console.log('Apk uploaded: id');
}, },
packages: async function({options}) { packages: async function({options}) {
const platform = checkPlatform(options.platform || await question('Platform(ios/android):')); 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'); var read = require('read');
export function question(query, password) { export function question(query, password) {
if (NO_INTERACTIVE){
return Promise.resolve('');
}
return new Promise((resolve, reject)=>read({ return new Promise((resolve, reject)=>read({
prompt: query, prompt: query,
silent: password, silent: password,

View File

@@ -86,7 +86,7 @@ export const commands = {
description: description || await question('Enter description:'), description: description || await question('Enter description:'),
metaInfo: metaInfo || await question('Enter meta info:'), 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)'); const v = await question('Would you like to bind packages to this version?(Y/N)');
if (v.toLowerCase() === 'y') { if (v.toLowerCase() === 'y') {

View File

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