From 07ee28ba3bad76619924e99d68344f0d08a2c17a Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Wed, 29 Jun 2022 09:20:57 +0800 Subject: [PATCH] add updateVersionInfo --- cli.json | 23 +++++++++++++++++++++++ src/versions.js | 14 ++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/cli.json b/cli.json index 2c5ea42..e582e59 100644 --- a/cli.json +++ b/cli.json @@ -88,6 +88,29 @@ } }, + "updateVersionInfo": { + "options": { + "platform": { + "hasValue": true + }, + "versionId": { + "hasValue": true + }, + "name": { + "default": false, + "hasValue": true + }, + "description": { + "default": false, + "hasValue": true + }, + "metaInfo": { + "default": false, + "hasValue": true + } + } + }, + "build": { "description": "Bundle javascript and copy assets." }, diff --git a/src/versions.js b/src/versions.js index 8890376..6a95899 100644 --- a/src/versions.js +++ b/src/versions.js @@ -149,4 +149,18 @@ export const commands = { }); console.log('操作成功'); }, + updateVersionInfo: async function ({ args, options }) { + const platform = checkPlatform( + options.platform || (await question('平台(ios/android):')), + ); + const { appId } = await getSelectedApp(platform); + const versionId = options.versionId || (await chooseVersion(appId)).id; + + const updateParams = {}; + options.name && (updateParams.name = options.name); + options.description && (updateParams.description = options.description); + options.metaInfo && (updateParams.metaInfo = options.metaInfo); + await put(`/app/${appId}/version/${versionId}`, updateParams); + console.log('操作成功'); + }, };