react-native-update-cli 1.45.3 → 1.45.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.json +3 -0
- package/lib/locales/en.js +6 -5
- package/lib/locales/zh.js +4 -3
- package/lib/versions.js +24 -11
- package/package.json +1 -1
- package/src/locales/en.ts +5 -4
- package/src/locales/zh.ts +3 -2
- package/src/package.ts +1 -1
- package/src/versions.ts +20 -9
package/cli.json
CHANGED
package/lib/locales/en.js
CHANGED
|
@@ -87,7 +87,7 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
87
87
|
processingStringPool: 'Processing the string pool ...',
|
|
88
88
|
publishUsage: 'Usage: pushy publish <ppk file> --platform ios|android|harmony',
|
|
89
89
|
rnuVersionNotFound: 'react-native-update: Cannot get the version number. Please run the command in the project directory',
|
|
90
|
-
rolloutConfigSet: 'Set {{rollout}}% rollout for
|
|
90
|
+
rolloutConfigSet: 'Set {{rollout}}% rollout for OTA update {{version}} on native version(s) {{versions}}',
|
|
91
91
|
rolloutRangeError: 'rollout must be an integer between 1-100',
|
|
92
92
|
runningHermesc: 'Running hermesc: {{- command}} {{- args}}',
|
|
93
93
|
sentryCliNotFound: 'Cannot find Sentry CLI tool, please make sure @sentry/cli is properly installed',
|
|
@@ -106,11 +106,12 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
106
106
|
usageUploadApk: 'Usage: cresc uploadApk <apk file>',
|
|
107
107
|
usageUploadApp: 'Usage: cresc uploadApp <app file>',
|
|
108
108
|
usageUploadIpa: 'Usage: cresc uploadIpa <ipa file>',
|
|
109
|
-
versionBind: 'Bound
|
|
109
|
+
versionBind: 'Bound hot update {{version}} to native version {{nativeVersion}} (id: {{id}})',
|
|
110
110
|
welcomeMessage: 'Welcome to Cresc hot update service, {{name}}.',
|
|
111
|
-
versionNameQuestion: 'Enter
|
|
112
|
-
versionDescriptionQuestion: 'Enter
|
|
111
|
+
versionNameQuestion: 'Enter OTA update name:',
|
|
112
|
+
versionDescriptionQuestion: 'Enter OTA update description:',
|
|
113
113
|
versionMetaInfoQuestion: 'Enter custom meta info:',
|
|
114
114
|
updateNativePackageQuestion: 'Bind to native package now?(Y/N)',
|
|
115
|
-
unnamed: '(Unnamed)'
|
|
115
|
+
unnamed: '(Unnamed)',
|
|
116
|
+
dryRun: 'Below is the dry-run result, no actual operation will be performed:'
|
|
116
117
|
};
|
package/lib/locales/zh.js
CHANGED
|
@@ -87,7 +87,7 @@ const _default = {
|
|
|
87
87
|
processingStringPool: '正在处理字符串池...',
|
|
88
88
|
publishUsage: '使用方法: pushy publish ppk后缀文件 --platform ios|android|harmony',
|
|
89
89
|
rnuVersionNotFound: 'react-native-update: 无法获取版本号。请在项目目录中运行命令',
|
|
90
|
-
rolloutConfigSet: '已在原生版本 {{versions}} 上设置灰度发布 {{rollout}}%
|
|
90
|
+
rolloutConfigSet: '已在原生版本 {{versions}} 上设置灰度发布 {{rollout}}% 热更包 {{version}}',
|
|
91
91
|
rolloutRangeError: 'rollout 必须是 1-100 的整数',
|
|
92
92
|
runningHermesc: '运行 hermesc:{{- command}} {{- args}}',
|
|
93
93
|
sentryCliNotFound: '无法找到 Sentry CLI 工具,请确保已正确安装 @sentry/cli',
|
|
@@ -105,11 +105,12 @@ const _default = {
|
|
|
105
105
|
usageUploadApk: '使用方法: pushy uploadApk apk后缀文件',
|
|
106
106
|
usageUploadApp: '使用方法: pushy uploadApp app后缀文件',
|
|
107
107
|
usageUploadIpa: '使用方法: pushy uploadIpa ipa后缀文件',
|
|
108
|
-
versionBind: '
|
|
108
|
+
versionBind: '已将热更包 {{version}} 绑定到原生版本 {{nativeVersion}} (id: {{id}})',
|
|
109
109
|
welcomeMessage: '欢迎使用 pushy 热更新服务,{{name}}。',
|
|
110
110
|
versionNameQuestion: '输入版本名称:',
|
|
111
111
|
versionDescriptionQuestion: '输入版本描述:',
|
|
112
112
|
versionMetaInfoQuestion: '输入自定义的 meta info:',
|
|
113
113
|
updateNativePackageQuestion: '是否现在将此热更应用到原生包上?(Y/N)',
|
|
114
|
-
unnamed: '(未命名)'
|
|
114
|
+
unnamed: '(未命名)',
|
|
115
|
+
dryRun: '以下是 dry-run 模拟运行结果,不会实际执行任何操作:'
|
|
115
116
|
};
|
package/lib/versions.js
CHANGED
|
@@ -24,6 +24,12 @@ const _package = require("./package");
|
|
|
24
24
|
const _depversions = require("./utils/dep-versions");
|
|
25
25
|
const _git = require("./utils/git");
|
|
26
26
|
const _compareversions = require("compare-versions");
|
|
27
|
+
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
28
|
+
function _interop_require_default(obj) {
|
|
29
|
+
return obj && obj.__esModule ? obj : {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
27
33
|
async function showVersion(appId, offset) {
|
|
28
34
|
const { data, count } = await (0, _api.get)(`/app/${appId}/version/list`);
|
|
29
35
|
console.log((0, _i18n.t)('offset', {
|
|
@@ -94,26 +100,33 @@ async function chooseVersion(appId) {
|
|
|
94
100
|
}
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
|
-
const bindVersionToPackages = async ({ appId, versionId, pkgs, rollout })=>{
|
|
103
|
+
const bindVersionToPackages = async ({ appId, versionId, pkgs, rollout, dryRun })=>{
|
|
104
|
+
if (dryRun) {
|
|
105
|
+
console.log(_chalk.default.yellow((0, _i18n.t)('dryRun')));
|
|
106
|
+
}
|
|
98
107
|
if (rollout !== undefined) {
|
|
99
108
|
const rolloutConfig = {};
|
|
100
109
|
for (const pkg of pkgs){
|
|
101
110
|
rolloutConfig[pkg.name] = rollout;
|
|
102
111
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
112
|
+
if (!dryRun) {
|
|
113
|
+
await (0, _api.put)(`/app/${appId}/version/${versionId}`, {
|
|
114
|
+
config: {
|
|
115
|
+
rollout: rolloutConfig
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
108
119
|
console.log(`${(0, _i18n.t)('rolloutConfigSet', {
|
|
109
120
|
versions: pkgs.map((pkg)=>pkg.name).join(', '),
|
|
110
121
|
rollout: rollout
|
|
111
122
|
})}`);
|
|
112
123
|
}
|
|
113
124
|
for (const pkg of pkgs){
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
if (!dryRun) {
|
|
126
|
+
await (0, _api.put)(`/app/${appId}/package/${pkg.id}`, {
|
|
127
|
+
versionId
|
|
128
|
+
});
|
|
129
|
+
}
|
|
117
130
|
console.log(`${(0, _i18n.t)('versionBind', {
|
|
118
131
|
version: versionId,
|
|
119
132
|
nativeVersion: pkg.name,
|
|
@@ -253,9 +266,9 @@ const commands = {
|
|
|
253
266
|
appId,
|
|
254
267
|
versionId,
|
|
255
268
|
pkgs: pkgsToBind,
|
|
256
|
-
rollout
|
|
269
|
+
rollout,
|
|
270
|
+
dryRun: options.dryRun
|
|
257
271
|
});
|
|
258
|
-
console.log((0, _i18n.t)('operationSuccess'));
|
|
259
272
|
},
|
|
260
273
|
updateVersionInfo: async ({ args, options })=>{
|
|
261
274
|
const platform = await (0, _app.getPlatform)(options.platform);
|
package/package.json
CHANGED
package/src/locales/en.ts
CHANGED
|
@@ -101,7 +101,7 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
101
101
|
rnuVersionNotFound:
|
|
102
102
|
'react-native-update: Cannot get the version number. Please run the command in the project directory',
|
|
103
103
|
rolloutConfigSet:
|
|
104
|
-
'Set {{rollout}}% rollout for
|
|
104
|
+
'Set {{rollout}}% rollout for OTA update {{version}} on native version(s) {{versions}}',
|
|
105
105
|
rolloutRangeError: 'rollout must be an integer between 1-100',
|
|
106
106
|
runningHermesc: 'Running hermesc: {{- command}} {{- args}}',
|
|
107
107
|
sentryCliNotFound:
|
|
@@ -122,11 +122,12 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
122
122
|
usageUploadApp: 'Usage: cresc uploadApp <app file>',
|
|
123
123
|
usageUploadIpa: 'Usage: cresc uploadIpa <ipa file>',
|
|
124
124
|
versionBind:
|
|
125
|
-
'Bound
|
|
125
|
+
'Bound hot update {{version}} to native version {{nativeVersion}} (id: {{id}})',
|
|
126
126
|
welcomeMessage: 'Welcome to Cresc hot update service, {{name}}.',
|
|
127
|
-
versionNameQuestion: 'Enter
|
|
128
|
-
versionDescriptionQuestion: 'Enter
|
|
127
|
+
versionNameQuestion: 'Enter OTA update name:',
|
|
128
|
+
versionDescriptionQuestion: 'Enter OTA update description:',
|
|
129
129
|
versionMetaInfoQuestion: 'Enter custom meta info:',
|
|
130
130
|
updateNativePackageQuestion: 'Bind to native package now?(Y/N)',
|
|
131
131
|
unnamed: '(Unnamed)',
|
|
132
|
+
dryRun: 'Below is the dry-run result, no actual operation will be performed:',
|
|
132
133
|
};
|
package/src/locales/zh.ts
CHANGED
|
@@ -96,7 +96,7 @@ export default {
|
|
|
96
96
|
rnuVersionNotFound:
|
|
97
97
|
'react-native-update: 无法获取版本号。请在项目目录中运行命令',
|
|
98
98
|
rolloutConfigSet:
|
|
99
|
-
'已在原生版本 {{versions}} 上设置灰度发布 {{rollout}}%
|
|
99
|
+
'已在原生版本 {{versions}} 上设置灰度发布 {{rollout}}% 热更包 {{version}}',
|
|
100
100
|
rolloutRangeError: 'rollout 必须是 1-100 的整数',
|
|
101
101
|
runningHermesc: '运行 hermesc:{{- command}} {{- args}}',
|
|
102
102
|
sentryCliNotFound: '无法找到 Sentry CLI 工具,请确保已正确安装 @sentry/cli',
|
|
@@ -115,11 +115,12 @@ export default {
|
|
|
115
115
|
usageUploadApp: '使用方法: pushy uploadApp app后缀文件',
|
|
116
116
|
usageUploadIpa: '使用方法: pushy uploadIpa ipa后缀文件',
|
|
117
117
|
versionBind:
|
|
118
|
-
'
|
|
118
|
+
'已将热更包 {{version}} 绑定到原生版本 {{nativeVersion}} (id: {{id}})',
|
|
119
119
|
welcomeMessage: '欢迎使用 pushy 热更新服务,{{name}}。',
|
|
120
120
|
versionNameQuestion: '输入版本名称:',
|
|
121
121
|
versionDescriptionQuestion: '输入版本描述:',
|
|
122
122
|
versionMetaInfoQuestion: '输入自定义的 meta info:',
|
|
123
123
|
updateNativePackageQuestion: '是否现在将此热更应用到原生包上?(Y/N)',
|
|
124
124
|
unnamed: '(未命名)',
|
|
125
|
+
dryRun: '以下是 dry-run 模拟运行结果,不会实际执行任何操作:',
|
|
125
126
|
};
|
package/src/package.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { get, getAllPackages, post, uploadFile } from './api';
|
|
|
2
2
|
import { question, saveToLocal } from './utils';
|
|
3
3
|
import { t } from './utils/i18n';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { getPlatform, getSelectedApp } from './app';
|
|
6
6
|
|
|
7
7
|
import { getApkInfo, getIpaInfo, getAppInfo } from './utils';
|
|
8
8
|
import Table from 'tty-table';
|
package/src/versions.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { depVersions } from './utils/dep-versions';
|
|
|
8
8
|
import { getCommitInfo } from './utils/git';
|
|
9
9
|
import type { Package, Platform, Version } from 'types';
|
|
10
10
|
import { satisfies } from 'compare-versions';
|
|
11
|
+
import chalk from 'chalk';
|
|
11
12
|
|
|
12
13
|
interface CommandOptions {
|
|
13
14
|
name?: string;
|
|
@@ -21,6 +22,7 @@ interface CommandOptions {
|
|
|
21
22
|
maxPackageVersion?: string;
|
|
22
23
|
packageVersionRange?: string;
|
|
23
24
|
rollout?: string;
|
|
25
|
+
dryRun?: boolean;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
async function showVersion(appId: string, offset: number) {
|
|
@@ -107,22 +109,29 @@ export const bindVersionToPackages = async ({
|
|
|
107
109
|
versionId,
|
|
108
110
|
pkgs,
|
|
109
111
|
rollout,
|
|
112
|
+
dryRun,
|
|
110
113
|
}: {
|
|
111
114
|
appId: string;
|
|
112
115
|
versionId: string;
|
|
113
116
|
pkgs: Package[];
|
|
114
117
|
rollout?: number;
|
|
118
|
+
dryRun?: boolean;
|
|
115
119
|
}) => {
|
|
120
|
+
if (dryRun) {
|
|
121
|
+
console.log(chalk.yellow(t('dryRun')));
|
|
122
|
+
}
|
|
116
123
|
if (rollout !== undefined) {
|
|
117
124
|
const rolloutConfig: Record<string, number> = {};
|
|
118
125
|
for (const pkg of pkgs) {
|
|
119
126
|
rolloutConfig[pkg.name] = rollout;
|
|
120
127
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
128
|
+
if (!dryRun) {
|
|
129
|
+
await put(`/app/${appId}/version/${versionId}`, {
|
|
130
|
+
config: {
|
|
131
|
+
rollout: rolloutConfig,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
126
135
|
console.log(
|
|
127
136
|
`${t('rolloutConfigSet', {
|
|
128
137
|
versions: pkgs.map((pkg: Package) => pkg.name).join(', '),
|
|
@@ -131,9 +140,11 @@ export const bindVersionToPackages = async ({
|
|
|
131
140
|
);
|
|
132
141
|
}
|
|
133
142
|
for (const pkg of pkgs) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
143
|
+
if (!dryRun) {
|
|
144
|
+
await put(`/app/${appId}/package/${pkg.id}`, {
|
|
145
|
+
versionId,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
137
148
|
console.log(
|
|
138
149
|
`${t('versionBind', {
|
|
139
150
|
version: versionId,
|
|
@@ -294,8 +305,8 @@ export const commands = {
|
|
|
294
305
|
versionId,
|
|
295
306
|
pkgs: pkgsToBind,
|
|
296
307
|
rollout,
|
|
308
|
+
dryRun: options.dryRun,
|
|
297
309
|
});
|
|
298
|
-
console.log(t('operationSuccess'));
|
|
299
310
|
},
|
|
300
311
|
updateVersionInfo: async ({
|
|
301
312
|
args,
|