mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-12-14 09:22:34 +08:00
Add deleteVersion command and update localization for version deletion success and error messages; bump version to 2.6.0 in package.json.
This commit is contained in:
13
cli.json
13
cli.json
@@ -173,6 +173,19 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"deleteVersion": {
|
||||
"options": {
|
||||
"platform": {
|
||||
"hasValue": true
|
||||
},
|
||||
"versionId": {
|
||||
"hasValue": true
|
||||
},
|
||||
"appId": {
|
||||
"hasValue": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"description": "Bundle javascript and copy assets."
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update-cli",
|
||||
"version": "2.5.0",
|
||||
"version": "2.6.0",
|
||||
"description": "command line tool for react-native-update (remote updates for react native)",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
||||
@@ -138,6 +138,8 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
||||
deletePackageError:
|
||||
'Failed to delete native package {{packageId}}: {{error}}',
|
||||
usageDeletePackage: 'Usage: cresc deletePackage [packageId] --appId [appId]',
|
||||
deleteVersionSuccess: 'Version {{versionId}} deleted successfully',
|
||||
deleteVersionError: 'Failed to delete version {{versionId}}: {{error}}',
|
||||
bundleFileNotFound:
|
||||
'Bundle file not found! Please use default bundle file name and path.',
|
||||
diffPackageGenerated: '{{- output}} generated.',
|
||||
|
||||
@@ -130,6 +130,8 @@ export default {
|
||||
deletePackageError: '删除原生包 {{packageId}} 失败: {{error}}',
|
||||
usageDeletePackage:
|
||||
'使用方法: pushy deletePackage [packageId] --appId [appId]',
|
||||
deleteVersionSuccess: '热更包 {{versionId}} 删除成功',
|
||||
deleteVersionError: '删除热更包 {{versionId}} 失败: {{error}}',
|
||||
bundleFileNotFound: '未找到 bundle 文件!请使用默认的 bundle 文件名和路径。',
|
||||
diffPackageGenerated: '{{- output}} 已生成。',
|
||||
nodeBsdiffRequired:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { get, getAllPackages, post, put, uploadFile } from './api';
|
||||
import { get, getAllPackages, post, put, uploadFile, doDelete } from './api';
|
||||
import { question, saveToLocal } from './utils';
|
||||
import { t } from './utils/i18n';
|
||||
|
||||
@@ -343,4 +343,29 @@ export const versionCommands = {
|
||||
await put(`/app/${appId}/version/${versionId}`, updateParams);
|
||||
console.log(t('operationSuccess'));
|
||||
},
|
||||
deleteVersion: async ({
|
||||
options,
|
||||
}: {
|
||||
options: VersionCommandOptions;
|
||||
}) => {
|
||||
let appId = options.appId;
|
||||
if (!appId) {
|
||||
const platform = await getPlatform(options.platform);
|
||||
appId = (await getSelectedApp(platform)).appId;
|
||||
}
|
||||
|
||||
let versionId = options.versionId;
|
||||
if (!versionId) {
|
||||
versionId = (await chooseVersion(appId as string)).id;
|
||||
}
|
||||
|
||||
try {
|
||||
await doDelete(`/app/${appId}/version/${versionId}`);
|
||||
console.log(t('deleteVersionSuccess', { versionId }));
|
||||
} catch (error: any) {
|
||||
throw new Error(
|
||||
t('deleteVersionError', { versionId, error: error.message }),
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user