react-native-update-cli 1.43.5 → 1.43.6
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/lib/bundle.js +36 -19
- package/lib/index.js +0 -13
- package/lib/locales/en.js +50 -3
- package/lib/locales/zh.js +50 -3
- package/lib/package.js +10 -7
- package/lib/user.js +5 -2
- package/lib/utils/add-gitignore.js +4 -1
- package/lib/utils/check-plugin.js +8 -2
- package/lib/versions.js +54 -17
- package/package.json +9 -7
- package/src/bundle.ts +18 -24
- package/src/index.ts +0 -7
- package/src/locales/en.ts +56 -4
- package/src/locales/zh.ts +51 -3
- package/src/package.ts +8 -7
- package/src/user.ts +3 -2
- package/src/utils/add-gitignore.ts +2 -1
- package/src/utils/check-plugin.ts +3 -2
- package/src/versions.ts +40 -21
package/lib/bundle.js
CHANGED
|
@@ -233,12 +233,14 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
233
233
|
});
|
|
234
234
|
reactNativeBundleProcess.on('close', async (exitCode)=>{
|
|
235
235
|
if (exitCode) {
|
|
236
|
-
reject(new Error(
|
|
236
|
+
reject(new Error((0, _i18n.t)('bundleCommandError', {
|
|
237
|
+
code: exitCode
|
|
238
|
+
})));
|
|
237
239
|
} else {
|
|
238
240
|
let hermesEnabled = false;
|
|
239
241
|
if (disableHermes) {
|
|
240
242
|
hermesEnabled = false;
|
|
241
|
-
console.log(
|
|
243
|
+
console.log((0, _i18n.t)('hermesDisabled'));
|
|
242
244
|
} else if (platform === 'android') {
|
|
243
245
|
const gradlePropeties = await new Promise((resolve)=>{
|
|
244
246
|
properties.parse('./android/gradle.properties', {
|
|
@@ -280,8 +282,12 @@ async function copyHarmonyBundle(outputFolder) {
|
|
|
280
282
|
await _fsextra.ensureDir(outputFolder);
|
|
281
283
|
await _fsextra.copy(harmonyRawPath, outputFolder);
|
|
282
284
|
} catch (error) {
|
|
283
|
-
console.error(
|
|
284
|
-
|
|
285
|
+
console.error((0, _i18n.t)('copyHarmonyBundleError', {
|
|
286
|
+
error
|
|
287
|
+
}));
|
|
288
|
+
throw new Error((0, _i18n.t)('copyFileFailed', {
|
|
289
|
+
error: error.message
|
|
290
|
+
}));
|
|
285
291
|
}
|
|
286
292
|
}
|
|
287
293
|
function getHermesOSBin() {
|
|
@@ -335,7 +341,10 @@ async function compileHermesByteCode(bundleName, outputFolder, sourcemapOutput,
|
|
|
335
341
|
_fsextra.copyFileSync(sourcemapOutput, _nodepath.default.join(outputFolder, `${bundleName}.txt.map`));
|
|
336
342
|
args.push('-output-source-map');
|
|
337
343
|
}
|
|
338
|
-
console.log(
|
|
344
|
+
console.log((0, _i18n.t)('runningHermesc', {
|
|
345
|
+
command: hermesCommand,
|
|
346
|
+
args: args.join(' ')
|
|
347
|
+
}));
|
|
339
348
|
(0, _nodechild_process.spawnSync)(hermesCommand, args, {
|
|
340
349
|
stdio: 'ignore'
|
|
341
350
|
});
|
|
@@ -344,7 +353,7 @@ async function compileHermesByteCode(bundleName, outputFolder, sourcemapOutput,
|
|
|
344
353
|
if (!_fsextra.existsSync(composerPath)) {
|
|
345
354
|
return;
|
|
346
355
|
}
|
|
347
|
-
console.log(
|
|
356
|
+
console.log((0, _i18n.t)('composingSourceMap'));
|
|
348
357
|
(0, _nodechild_process.spawnSync)('node', [
|
|
349
358
|
composerPath,
|
|
350
359
|
_nodepath.default.join(outputFolder, `${bundleName}.txt.map`),
|
|
@@ -369,13 +378,13 @@ async function copyDebugidForSentry(bundleName, outputFolder, sourcemapOutput) {
|
|
|
369
378
|
]
|
|
370
379
|
});
|
|
371
380
|
} catch (error) {
|
|
372
|
-
console.error(
|
|
381
|
+
console.error((0, _i18n.t)('sentryCliNotFound'));
|
|
373
382
|
return;
|
|
374
383
|
}
|
|
375
384
|
if (!_fsextra.existsSync(copyDebugidPath)) {
|
|
376
385
|
return;
|
|
377
386
|
}
|
|
378
|
-
console.log(
|
|
387
|
+
console.log((0, _i18n.t)('copyingDebugId'));
|
|
379
388
|
(0, _nodechild_process.spawnSync)('node', [
|
|
380
389
|
copyDebugidPath,
|
|
381
390
|
_nodepath.default.join(outputFolder, `${bundleName}.txt.map`),
|
|
@@ -411,8 +420,10 @@ async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutpu
|
|
|
411
420
|
], {
|
|
412
421
|
stdio: 'inherit'
|
|
413
422
|
});
|
|
414
|
-
console.log(
|
|
415
|
-
|
|
423
|
+
console.log((0, _i18n.t)('sentryReleaseCreated', {
|
|
424
|
+
version
|
|
425
|
+
}));
|
|
426
|
+
console.log((0, _i18n.t)('uploadingSourcemap'));
|
|
416
427
|
(0, _nodechild_process.spawnSync)('node', [
|
|
417
428
|
sentryCliPath,
|
|
418
429
|
'releases',
|
|
@@ -438,7 +449,7 @@ const ignorePackingExtensions = [
|
|
|
438
449
|
'txt.map'
|
|
439
450
|
];
|
|
440
451
|
async function pack(dir, output) {
|
|
441
|
-
console.log('
|
|
452
|
+
console.log((0, _i18n.t)('packing'));
|
|
442
453
|
_fsextra.ensureDirSync(_nodepath.default.dirname(output));
|
|
443
454
|
await new Promise((resolve, reject)=>{
|
|
444
455
|
const zipfile = new _yazl.ZipFile();
|
|
@@ -469,8 +480,8 @@ async function pack(dir, output) {
|
|
|
469
480
|
});
|
|
470
481
|
zipfile.end();
|
|
471
482
|
});
|
|
472
|
-
console.log((0, _i18n.t)('
|
|
473
|
-
output
|
|
483
|
+
console.log((0, _i18n.t)('fileGenerated', {
|
|
484
|
+
file: output
|
|
474
485
|
}));
|
|
475
486
|
}
|
|
476
487
|
function readEntire(entry, zipFile) {
|
|
@@ -594,7 +605,9 @@ async function diffFromPPK(origin, next, output) {
|
|
|
594
605
|
const deletes = {};
|
|
595
606
|
for(const k in originEntries){
|
|
596
607
|
if (!newEntries[k]) {
|
|
597
|
-
console.log(
|
|
608
|
+
console.log((0, _i18n.t)('deleteFile', {
|
|
609
|
+
file: k
|
|
610
|
+
}));
|
|
598
611
|
deletes[k] = 1;
|
|
599
612
|
}
|
|
600
613
|
}
|
|
@@ -723,7 +736,9 @@ async function enumZipEntries(zipFn, callback, nestedPath = '') {
|
|
|
723
736
|
await result;
|
|
724
737
|
}
|
|
725
738
|
} catch (error) {
|
|
726
|
-
console.error('
|
|
739
|
+
console.error((0, _i18n.t)('processingError', {
|
|
740
|
+
error
|
|
741
|
+
}));
|
|
727
742
|
}
|
|
728
743
|
zipfile.readEntry();
|
|
729
744
|
});
|
|
@@ -734,7 +749,9 @@ async function enumZipEntries(zipFn, callback, nestedPath = '') {
|
|
|
734
749
|
function diffArgsCheck(args, options, diffFn) {
|
|
735
750
|
const [origin, next] = args;
|
|
736
751
|
if (!origin || !next) {
|
|
737
|
-
console.error(
|
|
752
|
+
console.error((0, _i18n.t)('usageDiff', {
|
|
753
|
+
command: diffFn
|
|
754
|
+
}));
|
|
738
755
|
process.exit(1);
|
|
739
756
|
}
|
|
740
757
|
if (diffFn.startsWith('hdiff')) {
|
|
@@ -775,7 +792,7 @@ const commands = {
|
|
|
775
792
|
const sourcemapOutput = _nodepath.default.join(intermediaDir, `${bundleName}.map`);
|
|
776
793
|
const realOutput = output.replace(/\$\{time\}/g, `${Date.now()}`);
|
|
777
794
|
if (!platform) {
|
|
778
|
-
throw new Error(
|
|
795
|
+
throw new Error((0, _i18n.t)('platformRequired'));
|
|
779
796
|
}
|
|
780
797
|
console.log(`Bundling with react-native: ${_depversions.depVersions['react-native']}`);
|
|
781
798
|
await runReactNativeBundleCommand({
|
|
@@ -811,12 +828,12 @@ const commands = {
|
|
|
811
828
|
},
|
|
812
829
|
async diff ({ args, options }) {
|
|
813
830
|
const { origin, next, realOutput } = diffArgsCheck(args, options, 'diff');
|
|
814
|
-
await diffFromPPK(origin, next, realOutput
|
|
831
|
+
await diffFromPPK(origin, next, realOutput);
|
|
815
832
|
console.log(`${realOutput} generated.`);
|
|
816
833
|
},
|
|
817
834
|
async hdiff ({ args, options }) {
|
|
818
835
|
const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
|
|
819
|
-
await diffFromPPK(origin, next, realOutput
|
|
836
|
+
await diffFromPPK(origin, next, realOutput);
|
|
820
837
|
console.log(`${realOutput} generated.`);
|
|
821
838
|
},
|
|
822
839
|
async diffFromApk ({ args, options }) {
|
package/lib/index.js
CHANGED
|
@@ -4,21 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
const _api = require("./api");
|
|
7
|
-
const _updatenotifier = /*#__PURE__*/ _interop_require_default(require("update-notifier"));
|
|
8
7
|
const _utils = require("./utils");
|
|
9
|
-
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
|
|
10
8
|
const _i18n = require("./utils/i18n");
|
|
11
|
-
function _interop_require_default(obj) {
|
|
12
|
-
return obj && obj.__esModule ? obj : {
|
|
13
|
-
default: obj
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
(0, _updatenotifier.default)({
|
|
17
|
-
pkg: _packagejson.default
|
|
18
|
-
}).notify({
|
|
19
|
-
isGlobal: true,
|
|
20
|
-
message: (0, _i18n.t)('updateNotifier')
|
|
21
|
-
});
|
|
22
9
|
function printUsage() {
|
|
23
10
|
// const commandName = args[0];
|
|
24
11
|
// TODO: print usage of commandName, or print global usage.
|
package/lib/locales/en.js
CHANGED
|
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _default = {
|
|
12
|
-
updateNotifier: 'Run `{updateCommand}` to update the CLI to get continuous improvements in features, performance, and security.',
|
|
13
12
|
loginFirst: 'Not logged in.\nPlease run `cresc login` in the project directory to login.',
|
|
14
13
|
lockNotFound: 'No lock file detected, which may cause inconsistent dependencies and hot-updating issues.',
|
|
15
14
|
multipleLocksFound: 'Multiple lock files detected ({{lockFiles}}), which may cause inconsistent dependencies and hot-updating issues.',
|
|
@@ -30,7 +29,7 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
30
29
|
appId: 'App ID',
|
|
31
30
|
appName: 'App Name',
|
|
32
31
|
platform: 'Platform',
|
|
33
|
-
totalApps: 'Total {{count}} apps',
|
|
32
|
+
totalApps: 'Total {{count}} {{platform}} apps',
|
|
34
33
|
appNotSelected: 'App not selected. run `cresc selectApp --platform {{platform}}` first!',
|
|
35
34
|
enterAppIdQuestion: 'Enter AppId:',
|
|
36
35
|
appNameQuestion: 'App Name:',
|
|
@@ -39,5 +38,53 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
39
38
|
cancelled: 'Cancelled',
|
|
40
39
|
operationSuccess: 'Operation successful',
|
|
41
40
|
failedToParseUpdateJson: 'Failed to parse file `update.json`. Try to remove it manually.',
|
|
42
|
-
ppkPackageGenerated: 'ppk package generated and saved to: {{- output}}'
|
|
41
|
+
ppkPackageGenerated: 'ppk package generated and saved to: {{- output}}',
|
|
42
|
+
Message: 'Welcome to Cresc hot update service, {{name}}.',
|
|
43
|
+
loggedOut: 'Logged out',
|
|
44
|
+
usageUnderDevelopment: 'Usage is under development now.',
|
|
45
|
+
hermesDisabled: 'Hermes disabled',
|
|
46
|
+
hermesEnabled: 'Hermes enabled, now compiling to hermes bytecode:\n',
|
|
47
|
+
runningHermesc: 'Running hermesc: {{command}} {{args}}',
|
|
48
|
+
composingSourceMap: 'Composing source map',
|
|
49
|
+
copyingDebugId: 'Copying debugid',
|
|
50
|
+
sentryCliNotFound: 'Cannot find Sentry CLI tool, please make sure @sentry/cli is properly installed',
|
|
51
|
+
sentryReleaseCreated: 'Sentry release created for version: {{version}}',
|
|
52
|
+
uploadingSourcemap: 'Uploading sourcemap',
|
|
53
|
+
packing: 'Packing',
|
|
54
|
+
deletingFile: 'Delete {{- file}}',
|
|
55
|
+
bundlingWithRN: 'Bundling with react-native: {{version}}',
|
|
56
|
+
fileGenerated: '{{- file}} generated.',
|
|
57
|
+
processingError: 'Error processing file: {{error}}',
|
|
58
|
+
usageDiff: 'Usage: cresc {{command}} <origin> <next>',
|
|
59
|
+
pluginDetected: 'detected {{name}} plugin',
|
|
60
|
+
pluginDetectionError: 'error while detecting {{name}} plugin: {{error}}',
|
|
61
|
+
addedToGitignore: 'Added {{line}} to .gitignore',
|
|
62
|
+
processingStringPool: 'Processing the string pool ...',
|
|
63
|
+
processingPackage: 'Processing the package {{count}} ...',
|
|
64
|
+
typeStrings: 'Type strings:',
|
|
65
|
+
keyStrings: 'Key strings:',
|
|
66
|
+
failedToParseIcon: '[Warning] failed to parse icon: {{error}}',
|
|
67
|
+
errorInHarmonyApp: 'Error in getEntryFromHarmonyApp: {{error}}',
|
|
68
|
+
totalPackages: 'Total {{count}} packages',
|
|
69
|
+
usageUploadIpa: 'Usage: cresc uploadIpa <ipa file>',
|
|
70
|
+
usageUploadApk: 'Usage: cresc uploadApk <apk file>',
|
|
71
|
+
usageUploadApp: 'Usage: cresc uploadApp <app file>',
|
|
72
|
+
usageParseApp: 'Usage: cresc parseApp <app file>',
|
|
73
|
+
usageParseIpa: 'Usage: cresc parseIpa <ipa file>',
|
|
74
|
+
usageParseApk: 'Usage: cresc parseApk <apk file>',
|
|
75
|
+
offset: 'Offset {{offset}}',
|
|
76
|
+
packageUploadSuccess: 'Successfully uploaded new hot update package (id: {{id}})',
|
|
77
|
+
rolloutRangeError: 'rollout must be an integer between 1-100',
|
|
78
|
+
nativeVersionNotFound: 'No native version found >= {{version}}',
|
|
79
|
+
nativeVersionNotFoundLess: 'No native version found <= {{version}}',
|
|
80
|
+
nativeVersionNotFoundMatch: 'No matching native version found: {{version}}',
|
|
81
|
+
packageIdRequired: 'Please provide packageId or packageVersion parameter',
|
|
82
|
+
operationComplete: 'Operation complete, bound to {{count}} native versions',
|
|
83
|
+
platformRequired: 'Platform must be specified.',
|
|
84
|
+
bundleCommandError: '"react-native bundle" command exited with code {{code}}.',
|
|
85
|
+
copyHarmonyBundleError: 'Error copying Harmony bundle: {{error}}',
|
|
86
|
+
copyFileFailed: 'Failed to copy file: {{error}}',
|
|
87
|
+
deleteFile: 'Delete {{- file}}',
|
|
88
|
+
rolloutConfigSet: 'Set {{rollout}}% rollout for version {{version}} on native version(s) {{versions}}',
|
|
89
|
+
versionBind: 'Bound version {{version}} to native version {{nativeVersion}} (id: {{id}})'
|
|
43
90
|
};
|
package/lib/locales/zh.js
CHANGED
|
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _default = {
|
|
12
|
-
updateNotifier: '建议运行 `{updateCommand}` 来更新命令行工具以获得功能、性能和安全性的持续改进',
|
|
13
12
|
loginFirst: '尚未登录。\n请在项目目录中运行`pushy login`命令来登录',
|
|
14
13
|
lockNotFound: '没有检测到任何 lock 文件,这可能导致依赖关系不一致而使热更异常。',
|
|
15
14
|
lockBestPractice: `
|
|
@@ -30,7 +29,7 @@ const _default = {
|
|
|
30
29
|
appId: '应用 id',
|
|
31
30
|
appName: '应用名称',
|
|
32
31
|
platform: '平台',
|
|
33
|
-
totalApps: '共 {{count}} 个{{platform}}应用',
|
|
32
|
+
totalApps: '共 {{count}} 个 {{platform}} 应用',
|
|
34
33
|
appNotSelected: '尚未选择应用。请先运行 `pushy selectApp --platform {{platform}}` 来选择应用',
|
|
35
34
|
enterAppIdQuestion: '输入应用 id:',
|
|
36
35
|
appNameQuestion: '应用名称:',
|
|
@@ -39,5 +38,53 @@ const _default = {
|
|
|
39
38
|
cancelled: '已取消',
|
|
40
39
|
operationSuccess: '操作成功',
|
|
41
40
|
failedToParseUpdateJson: '无法解析文件 `update.json`。请手动删除它。',
|
|
42
|
-
ppkPackageGenerated: 'ppk 热更包已生成并保存到: {{- output}}'
|
|
41
|
+
ppkPackageGenerated: 'ppk 热更包已生成并保存到: {{- output}}',
|
|
42
|
+
welcomeMessage: '欢迎使用 pushy 热更新服务,{{name}}。',
|
|
43
|
+
loggedOut: '已退出登录',
|
|
44
|
+
usageUnderDevelopment: '使用说明正在开发中。',
|
|
45
|
+
hermesDisabled: 'Hermes 已禁用',
|
|
46
|
+
hermesEnabled: 'Hermes 已启用,正在编译为 hermes 字节码:\n',
|
|
47
|
+
runningHermesc: '运行 hermesc:{{command}} {{args}}',
|
|
48
|
+
composingSourceMap: '正在生成 source map',
|
|
49
|
+
copyingDebugId: '正在复制 debugid',
|
|
50
|
+
sentryCliNotFound: '无法找到 Sentry CLI 工具,请确保已正确安装 @sentry/cli',
|
|
51
|
+
sentryReleaseCreated: '已为版本 {{version}} 创建 Sentry release',
|
|
52
|
+
uploadingSourcemap: '正在上传 sourcemap',
|
|
53
|
+
packing: '正在打包',
|
|
54
|
+
deletingFile: '删除 {{- file}}',
|
|
55
|
+
bundlingWithRN: '正在使用 react-native {{version}} 打包',
|
|
56
|
+
fileGenerated: '已生成 {{- file}}。',
|
|
57
|
+
processingError: '处理文件时出错:{{error}}',
|
|
58
|
+
usageDiff: '用法:pushy {{command}} <origin> <next>',
|
|
59
|
+
pluginDetected: '检测到 {{name}} 插件',
|
|
60
|
+
pluginDetectionError: '检测 {{name}} 插件时出错:{{error}}',
|
|
61
|
+
addedToGitignore: '已将 {{line}} 添加到 .gitignore',
|
|
62
|
+
processingStringPool: '正在处理字符串池...',
|
|
63
|
+
processingPackage: '正在处理包 {{count}}...',
|
|
64
|
+
typeStrings: '类型字符串:',
|
|
65
|
+
keyStrings: '键字符串:',
|
|
66
|
+
failedToParseIcon: '[警告] 解析图标失败:{{error}}',
|
|
67
|
+
errorInHarmonyApp: '获取 Harmony 应用入口时出错:{{error}}',
|
|
68
|
+
totalPackages: '共 {{count}} 个包',
|
|
69
|
+
usageUploadIpa: '使用方法: pushy uploadIpa ipa后缀文件',
|
|
70
|
+
usageUploadApk: '使用方法: pushy uploadApk apk后缀文件',
|
|
71
|
+
usageUploadApp: '使用方法: pushy uploadApp app后缀文件',
|
|
72
|
+
usageParseApp: '使用方法: pushy parseApp app后缀文件',
|
|
73
|
+
usageParseIpa: '使用方法: pushy parseIpa ipa后缀文件',
|
|
74
|
+
usageParseApk: '使用方法: pushy parseApk apk后缀文件',
|
|
75
|
+
offset: '偏移量 {{offset}}',
|
|
76
|
+
packageUploadSuccess: '已成功上传新热更包(id: {{id}})',
|
|
77
|
+
rolloutRangeError: 'rollout 必须是 1-100 的整数',
|
|
78
|
+
nativeVersionNotFound: '未查询到 >= {{version}} 的原生版本',
|
|
79
|
+
nativeVersionNotFoundLess: '未查询到 <= {{version}} 的原生版本',
|
|
80
|
+
nativeVersionNotFoundMatch: '未查询到匹配原生版本:{{version}}',
|
|
81
|
+
packageIdRequired: '请提供 packageId 或 packageVersion 参数',
|
|
82
|
+
operationComplete: '操作完成,共已绑定 {{count}} 个原生版本',
|
|
83
|
+
platformRequired: '必须指定平台。',
|
|
84
|
+
bundleCommandError: '"react-native bundle" 命令退出,代码为 {{code}}。',
|
|
85
|
+
copyHarmonyBundleError: '复制 Harmony bundle 错误:{{error}}',
|
|
86
|
+
copyFileFailed: '复制文件失败:{{error}}',
|
|
87
|
+
deleteFile: '删除 {{- file}}',
|
|
88
|
+
rolloutConfigSet: '已在原生版本 {{versions}} 上设置灰度发布 {{rollout}}% 热更版本 {{version}}',
|
|
89
|
+
versionBind: '已将热更版本 {{version}} 绑定到原生版本 {{nativeVersion}} (id: {{id}})'
|
|
43
90
|
};
|
package/lib/package.js
CHANGED
|
@@ -21,6 +21,7 @@ _export(exports, {
|
|
|
21
21
|
});
|
|
22
22
|
const _api = require("./api");
|
|
23
23
|
const _utils = require("./utils");
|
|
24
|
+
const _i18n = require("./utils/i18n");
|
|
24
25
|
const _app = require("./app");
|
|
25
26
|
const _ttytable = /*#__PURE__*/ _interop_require_default(require("tty-table"));
|
|
26
27
|
const _depversions = require("./utils/dep-versions");
|
|
@@ -63,7 +64,9 @@ async function listPackage(appId) {
|
|
|
63
64
|
]);
|
|
64
65
|
}
|
|
65
66
|
console.log((0, _ttytable.default)(header, rows).render());
|
|
66
|
-
console.log(
|
|
67
|
+
console.log((0, _i18n.t)('totalPackages', {
|
|
68
|
+
count: data.length
|
|
69
|
+
}));
|
|
67
70
|
return data;
|
|
68
71
|
}
|
|
69
72
|
async function choosePackage(appId) {
|
|
@@ -80,7 +83,7 @@ const commands = {
|
|
|
80
83
|
uploadIpa: async ({ args })=>{
|
|
81
84
|
const fn = args[0];
|
|
82
85
|
if (!fn || !fn.endsWith('.ipa')) {
|
|
83
|
-
throw new Error(
|
|
86
|
+
throw new Error((0, _i18n.t)('usageUploadIpa'));
|
|
84
87
|
}
|
|
85
88
|
const { versionName, buildTime, appId: appIdInPkg, appKey: appKeyInPkg } = await (0, _utils.getIpaInfo)(fn);
|
|
86
89
|
const { appId, appKey } = await (0, _app.getSelectedApp)('ios');
|
|
@@ -104,7 +107,7 @@ const commands = {
|
|
|
104
107
|
uploadApk: async ({ args })=>{
|
|
105
108
|
const fn = args[0];
|
|
106
109
|
if (!fn || !fn.endsWith('.apk')) {
|
|
107
|
-
throw new Error(
|
|
110
|
+
throw new Error((0, _i18n.t)('usageUploadApk'));
|
|
108
111
|
}
|
|
109
112
|
const { versionName, buildTime, appId: appIdInPkg, appKey: appKeyInPkg } = await (0, _utils.getApkInfo)(fn);
|
|
110
113
|
const { appId, appKey } = await (0, _app.getSelectedApp)('android');
|
|
@@ -128,7 +131,7 @@ const commands = {
|
|
|
128
131
|
uploadApp: async ({ args })=>{
|
|
129
132
|
const fn = args[0];
|
|
130
133
|
if (!fn || !fn.endsWith('.app')) {
|
|
131
|
-
throw new Error(
|
|
134
|
+
throw new Error((0, _i18n.t)('usageUploadApp'));
|
|
132
135
|
}
|
|
133
136
|
const { versionName, buildTime, appId: appIdInPkg, appKey: appKeyInPkg } = await (0, _utils.getAppInfo)(fn);
|
|
134
137
|
const { appId, appKey } = await (0, _app.getSelectedApp)('harmony');
|
|
@@ -152,21 +155,21 @@ const commands = {
|
|
|
152
155
|
parseApp: async ({ args })=>{
|
|
153
156
|
const fn = args[0];
|
|
154
157
|
if (!fn || !fn.endsWith('.app')) {
|
|
155
|
-
throw new Error(
|
|
158
|
+
throw new Error((0, _i18n.t)('usageParseApp'));
|
|
156
159
|
}
|
|
157
160
|
console.log(await (0, _utils.getAppInfo)(fn));
|
|
158
161
|
},
|
|
159
162
|
parseIpa: async ({ args })=>{
|
|
160
163
|
const fn = args[0];
|
|
161
164
|
if (!fn || !fn.endsWith('.ipa')) {
|
|
162
|
-
throw new Error(
|
|
165
|
+
throw new Error((0, _i18n.t)('usageParseIpa'));
|
|
163
166
|
}
|
|
164
167
|
console.log(await (0, _utils.getIpaInfo)(fn));
|
|
165
168
|
},
|
|
166
169
|
parseApk: async ({ args })=>{
|
|
167
170
|
const fn = args[0];
|
|
168
171
|
if (!fn || !fn.endsWith('.apk')) {
|
|
169
|
-
throw new Error(
|
|
172
|
+
throw new Error((0, _i18n.t)('usageParseApk'));
|
|
170
173
|
}
|
|
171
174
|
console.log(await (0, _utils.getApkInfo)(fn));
|
|
172
175
|
},
|
package/lib/user.js
CHANGED
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "commands", {
|
|
|
11
11
|
const _utils = require("./utils");
|
|
12
12
|
const _api = require("./api");
|
|
13
13
|
const _nodecrypto = /*#__PURE__*/ _interop_require_default(require("node:crypto"));
|
|
14
|
+
const _i18n = require("./utils/i18n");
|
|
14
15
|
function _interop_require_default(obj) {
|
|
15
16
|
return obj && obj.__esModule ? obj : {
|
|
16
17
|
default: obj
|
|
@@ -31,11 +32,13 @@ const commands = {
|
|
|
31
32
|
token
|
|
32
33
|
});
|
|
33
34
|
await (0, _api.saveSession)();
|
|
34
|
-
console.log(
|
|
35
|
+
console.log((0, _i18n.t)('welcomeMessage', {
|
|
36
|
+
name: info.name
|
|
37
|
+
}));
|
|
35
38
|
},
|
|
36
39
|
logout: async ()=>{
|
|
37
40
|
await (0, _api.closeSession)();
|
|
38
|
-
console.log('
|
|
41
|
+
console.log((0, _i18n.t)('loggedOut'));
|
|
39
42
|
},
|
|
40
43
|
me: async ()=>{
|
|
41
44
|
const me = await (0, _api.get)('/user/me');
|
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "addGitIgnore", {
|
|
|
10
10
|
});
|
|
11
11
|
const _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs"));
|
|
12
12
|
const _constants = require("./constants");
|
|
13
|
+
const _i18n = require("./i18n");
|
|
13
14
|
function _interop_require_default(obj) {
|
|
14
15
|
return obj && obj.__esModule ? obj : {
|
|
15
16
|
default: obj
|
|
@@ -36,7 +37,9 @@ function addGitIgnore() {
|
|
|
36
37
|
gitignoreLines.push('# react-native-update');
|
|
37
38
|
for (const line of shouldIgnore){
|
|
38
39
|
gitignoreLines.push(line);
|
|
39
|
-
console.log(
|
|
40
|
+
console.log((0, _i18n.t)('addedToGitignore', {
|
|
41
|
+
line
|
|
42
|
+
}));
|
|
40
43
|
}
|
|
41
44
|
_nodefs.default.writeFileSync(gitignorePath, gitignoreLines.join('\n'));
|
|
42
45
|
}
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "checkPlugins", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _pluginconfig = require("./plugin-config");
|
|
12
|
+
const _i18n = require("./i18n");
|
|
12
13
|
async function checkPlugins() {
|
|
13
14
|
const params = {
|
|
14
15
|
sentry: false,
|
|
@@ -19,10 +20,15 @@ async function checkPlugins() {
|
|
|
19
20
|
const isEnabled = await plugin.detect();
|
|
20
21
|
if (isEnabled && plugin.bundleParams) {
|
|
21
22
|
Object.assign(params, plugin.bundleParams);
|
|
22
|
-
console.log(
|
|
23
|
+
console.log((0, _i18n.t)('pluginDetected', {
|
|
24
|
+
name: plugin.name
|
|
25
|
+
}));
|
|
23
26
|
}
|
|
24
27
|
} catch (err) {
|
|
25
|
-
console.warn(
|
|
28
|
+
console.warn((0, _i18n.t)('pluginDetectionError', {
|
|
29
|
+
name: plugin.name,
|
|
30
|
+
error: err
|
|
31
|
+
}));
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
return params;
|
package/lib/versions.js
CHANGED
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "commands", {
|
|
|
10
10
|
});
|
|
11
11
|
const _api = require("./api");
|
|
12
12
|
const _utils = require("./utils");
|
|
13
|
+
const _i18n = require("./utils/i18n");
|
|
13
14
|
const _app = require("./app");
|
|
14
15
|
const _package = require("./package");
|
|
15
16
|
const _compareversions = require("compare-versions");
|
|
@@ -17,7 +18,9 @@ const _depversions = require("./utils/dep-versions");
|
|
|
17
18
|
const _git = require("./utils/git");
|
|
18
19
|
async function showVersion(appId, offset) {
|
|
19
20
|
const { data, count } = await (0, _api.get)(`/app/${appId}/version/list`);
|
|
20
|
-
console.log(
|
|
21
|
+
console.log((0, _i18n.t)('offset', {
|
|
22
|
+
offset
|
|
23
|
+
}));
|
|
21
24
|
for (const version of data){
|
|
22
25
|
var _version_packages;
|
|
23
26
|
const pkgCount = ((_version_packages = version.packages) == null ? void 0 : _version_packages.length) || 0;
|
|
@@ -104,7 +107,9 @@ const commands = {
|
|
|
104
107
|
});
|
|
105
108
|
// TODO local diff
|
|
106
109
|
(0, _utils.saveToLocal)(fn, `${appId}/ppk/${id}.ppk`);
|
|
107
|
-
console.log(
|
|
110
|
+
console.log((0, _i18n.t)('packageUploadSuccess', {
|
|
111
|
+
id
|
|
112
|
+
}));
|
|
108
113
|
const v = await (0, _utils.question)('是否现在将此热更应用到原生包上?(Y/N)');
|
|
109
114
|
if (v.toLowerCase() === 'y') {
|
|
110
115
|
await this.update({
|
|
@@ -138,10 +143,10 @@ const commands = {
|
|
|
138
143
|
try {
|
|
139
144
|
rollout = Number.parseInt(options.rollout);
|
|
140
145
|
} catch (e) {
|
|
141
|
-
throw new Error(
|
|
146
|
+
throw new Error((0, _i18n.t)('rolloutRangeError'));
|
|
142
147
|
}
|
|
143
148
|
if (rollout < 1 || rollout > 100) {
|
|
144
|
-
throw new Error(
|
|
149
|
+
throw new Error((0, _i18n.t)('rolloutRangeError'));
|
|
145
150
|
}
|
|
146
151
|
}
|
|
147
152
|
if (minPkgVersion) {
|
|
@@ -149,7 +154,9 @@ const commands = {
|
|
|
149
154
|
const { data } = await (0, _api.get)(`/app/${appId}/package/list?limit=1000`);
|
|
150
155
|
const pkgs = data.filter((pkg)=>(0, _compareversions.compare)(pkg.name, minPkgVersion, '>='));
|
|
151
156
|
if (pkgs.length === 0) {
|
|
152
|
-
throw new Error(
|
|
157
|
+
throw new Error((0, _i18n.t)('nativeVersionNotFound', {
|
|
158
|
+
version: minPkgVersion
|
|
159
|
+
}));
|
|
153
160
|
}
|
|
154
161
|
if (rollout !== undefined) {
|
|
155
162
|
const rolloutConfig = {};
|
|
@@ -161,15 +168,24 @@ const commands = {
|
|
|
161
168
|
rollout: rolloutConfig
|
|
162
169
|
}
|
|
163
170
|
});
|
|
164
|
-
console.log(
|
|
171
|
+
console.log(`${(0, _i18n.t)('rolloutConfigSet', {
|
|
172
|
+
versions: pkgs.map((pkg)=>pkg.name).join(', '),
|
|
173
|
+
rollout: rollout
|
|
174
|
+
})}`);
|
|
165
175
|
}
|
|
166
176
|
for (const pkg of pkgs){
|
|
167
177
|
await (0, _api.put)(`/app/${appId}/package/${pkg.id}`, {
|
|
168
178
|
versionId
|
|
169
179
|
});
|
|
170
|
-
console.log(
|
|
180
|
+
console.log(`${(0, _i18n.t)('versionBind', {
|
|
181
|
+
version: versionId,
|
|
182
|
+
nativeVersion: pkg.name,
|
|
183
|
+
id: pkg.id
|
|
184
|
+
})}`);
|
|
171
185
|
}
|
|
172
|
-
console.log(
|
|
186
|
+
console.log((0, _i18n.t)('operationComplete', {
|
|
187
|
+
count: pkgs.length
|
|
188
|
+
}));
|
|
173
189
|
return;
|
|
174
190
|
}
|
|
175
191
|
if (maxPkgVersion) {
|
|
@@ -177,7 +193,9 @@ const commands = {
|
|
|
177
193
|
const { data } = await (0, _api.get)(`/app/${appId}/package/list?limit=1000`);
|
|
178
194
|
const pkgs = data.filter((pkg)=>(0, _compareversions.compare)(pkg.name, maxPkgVersion, '<='));
|
|
179
195
|
if (pkgs.length === 0) {
|
|
180
|
-
throw new Error(
|
|
196
|
+
throw new Error((0, _i18n.t)('nativeVersionNotFoundLess', {
|
|
197
|
+
version: maxPkgVersion
|
|
198
|
+
}));
|
|
181
199
|
}
|
|
182
200
|
if (rollout !== undefined) {
|
|
183
201
|
const rolloutConfig = {};
|
|
@@ -189,15 +207,24 @@ const commands = {
|
|
|
189
207
|
rollout: rolloutConfig
|
|
190
208
|
}
|
|
191
209
|
});
|
|
192
|
-
console.log(
|
|
210
|
+
console.log(`${(0, _i18n.t)('rolloutConfigSet', {
|
|
211
|
+
versions: pkgs.map((pkg)=>pkg.name).join(', '),
|
|
212
|
+
rollout: rollout
|
|
213
|
+
})}`);
|
|
193
214
|
}
|
|
194
215
|
for (const pkg of pkgs){
|
|
195
216
|
await (0, _api.put)(`/app/${appId}/package/${pkg.id}`, {
|
|
196
217
|
versionId
|
|
197
218
|
});
|
|
198
|
-
console.log(
|
|
219
|
+
console.log(`${(0, _i18n.t)('versionBind', {
|
|
220
|
+
version: versionId,
|
|
221
|
+
nativeVersion: pkg.name,
|
|
222
|
+
id: pkg.id
|
|
223
|
+
})}`);
|
|
199
224
|
}
|
|
200
|
-
console.log(
|
|
225
|
+
console.log((0, _i18n.t)('operationComplete', {
|
|
226
|
+
count: pkgs.length
|
|
227
|
+
}));
|
|
201
228
|
return;
|
|
202
229
|
}
|
|
203
230
|
const { data } = await (0, _api.get)(`/app/${appId}/package/list?limit=1000`);
|
|
@@ -207,14 +234,16 @@ const commands = {
|
|
|
207
234
|
if (pkg) {
|
|
208
235
|
pkgId = pkg.id;
|
|
209
236
|
} else {
|
|
210
|
-
throw new Error(
|
|
237
|
+
throw new Error((0, _i18n.t)('nativeVersionNotFoundMatch', {
|
|
238
|
+
version: pkgVersion
|
|
239
|
+
}));
|
|
211
240
|
}
|
|
212
241
|
}
|
|
213
242
|
if (!pkgId) {
|
|
214
243
|
pkgId = options.packageId || (await (0, _package.choosePackage)(appId)).id;
|
|
215
244
|
}
|
|
216
245
|
if (!pkgId) {
|
|
217
|
-
throw new Error(
|
|
246
|
+
throw new Error((0, _i18n.t)('packageIdRequired'));
|
|
218
247
|
}
|
|
219
248
|
if (!pkgVersion) {
|
|
220
249
|
const pkg = data.find((pkg)=>String(pkg.id) === String(pkgId));
|
|
@@ -230,14 +259,22 @@ const commands = {
|
|
|
230
259
|
}
|
|
231
260
|
}
|
|
232
261
|
});
|
|
233
|
-
console.log(
|
|
262
|
+
console.log(`${(0, _i18n.t)('rolloutConfigSet', {
|
|
263
|
+
versions: pkgVersion,
|
|
264
|
+
rollout: rollout
|
|
265
|
+
})}`);
|
|
234
266
|
}
|
|
235
267
|
if (versionId !== undefined) {
|
|
236
268
|
await (0, _api.put)(`/app/${appId}/package/${pkgId}`, {
|
|
237
269
|
versionId
|
|
238
270
|
});
|
|
239
|
-
console.log(
|
|
271
|
+
console.log(`${(0, _i18n.t)('versionBind', {
|
|
272
|
+
version: versionId,
|
|
273
|
+
nativeVersion: pkgVersion,
|
|
274
|
+
id: pkgId
|
|
275
|
+
})}`);
|
|
240
276
|
}
|
|
277
|
+
console.log((0, _i18n.t)('operationSuccess'));
|
|
241
278
|
},
|
|
242
279
|
updateVersionInfo: async ({ args, options })=>{
|
|
243
280
|
const platform = (0, _app.checkPlatform)(options.platform || await (0, _utils.question)('平台(ios/android/harmony):'));
|
|
@@ -248,6 +285,6 @@ const commands = {
|
|
|
248
285
|
if (options.description) updateParams.description = options.description;
|
|
249
286
|
if (options.metaInfo) updateParams.metaInfo = options.metaInfo;
|
|
250
287
|
await (0, _api.put)(`/app/${appId}/version/${versionId}`, updateParams);
|
|
251
|
-
console.log('
|
|
288
|
+
console.log((0, _i18n.t)('operationSuccess'));
|
|
252
289
|
}
|
|
253
290
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.6",
|
|
4
4
|
"description": "command line tool for react-native-update (remote updates for react native)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"semver": "^7.7.1",
|
|
59
59
|
"tcp-ping": "^0.1.1",
|
|
60
60
|
"tty-table": "4.2",
|
|
61
|
-
"update-notifier": "^5.1.0",
|
|
62
61
|
"yauzl": "^3.2.0",
|
|
63
62
|
"yazl": "3.3.1"
|
|
64
63
|
},
|
|
@@ -67,18 +66,21 @@
|
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
68
|
"@biomejs/biome": "^1.9.4",
|
|
70
|
-
"@swc/cli": "^0.
|
|
71
|
-
"@swc/core": "^1.11.
|
|
69
|
+
"@swc/cli": "^0.7.2",
|
|
70
|
+
"@swc/core": "^1.11.21",
|
|
72
71
|
"@types/filesize-parser": "^1.5.3",
|
|
73
72
|
"@types/fs-extra": "^11.0.4",
|
|
74
|
-
"@types/node": "^22.14.
|
|
73
|
+
"@types/node": "^22.14.1",
|
|
75
74
|
"@types/node-fetch": "^2.6.12",
|
|
76
75
|
"@types/progress": "^2.0.7",
|
|
77
76
|
"@types/semver": "^7.7.0",
|
|
78
77
|
"@types/tcp-ping": "^0.1.6",
|
|
79
|
-
"@types/update-notifier": "^6.0.8",
|
|
80
78
|
"@types/yauzl": "^2.10.3",
|
|
81
79
|
"@types/yazl": "^2.4.6",
|
|
82
80
|
"typescript": "^5.8.3"
|
|
83
|
-
}
|
|
81
|
+
},
|
|
82
|
+
"trustedDependencies": [
|
|
83
|
+
"@biomejs/biome",
|
|
84
|
+
"@swc/core"
|
|
85
|
+
]
|
|
84
86
|
}
|
package/src/bundle.ts
CHANGED
|
@@ -214,17 +214,13 @@ async function runReactNativeBundleCommand({
|
|
|
214
214
|
|
|
215
215
|
reactNativeBundleProcess.on('close', async (exitCode) => {
|
|
216
216
|
if (exitCode) {
|
|
217
|
-
reject(
|
|
218
|
-
new Error(
|
|
219
|
-
`"react-native bundle" command exited with code ${exitCode}.`,
|
|
220
|
-
),
|
|
221
|
-
);
|
|
217
|
+
reject(new Error(t('bundleCommandError', { code: exitCode })));
|
|
222
218
|
} else {
|
|
223
219
|
let hermesEnabled: boolean | undefined = false;
|
|
224
220
|
|
|
225
221
|
if (disableHermes) {
|
|
226
222
|
hermesEnabled = false;
|
|
227
|
-
console.log('
|
|
223
|
+
console.log(t('hermesDisabled'));
|
|
228
224
|
} else if (platform === 'android') {
|
|
229
225
|
const gradlePropeties = await new Promise<{
|
|
230
226
|
hermesEnabled?: boolean;
|
|
@@ -283,8 +279,8 @@ async function copyHarmonyBundle(outputFolder: string) {
|
|
|
283
279
|
await fs.ensureDir(outputFolder);
|
|
284
280
|
await fs.copy(harmonyRawPath, outputFolder);
|
|
285
281
|
} catch (error: any) {
|
|
286
|
-
console.error('
|
|
287
|
-
throw new Error(
|
|
282
|
+
console.error(t('copyHarmonyBundleError', { error }));
|
|
283
|
+
throw new Error(t('copyFileFailed', { error: error.message }));
|
|
288
284
|
}
|
|
289
285
|
}
|
|
290
286
|
|
|
@@ -355,7 +351,7 @@ async function compileHermesByteCode(
|
|
|
355
351
|
);
|
|
356
352
|
args.push('-output-source-map');
|
|
357
353
|
}
|
|
358
|
-
console.log(
|
|
354
|
+
console.log(t('runningHermesc', { command: hermesCommand, args: args.join(' ') }));
|
|
359
355
|
spawnSync(hermesCommand, args, {
|
|
360
356
|
stdio: 'ignore',
|
|
361
357
|
});
|
|
@@ -365,7 +361,7 @@ async function compileHermesByteCode(
|
|
|
365
361
|
if (!fs.existsSync(composerPath)) {
|
|
366
362
|
return;
|
|
367
363
|
}
|
|
368
|
-
console.log('
|
|
364
|
+
console.log(t('composingSourceMap'));
|
|
369
365
|
spawnSync(
|
|
370
366
|
'node',
|
|
371
367
|
[
|
|
@@ -400,16 +396,14 @@ async function copyDebugidForSentry(
|
|
|
400
396
|
},
|
|
401
397
|
);
|
|
402
398
|
} catch (error) {
|
|
403
|
-
console.error(
|
|
404
|
-
'无法找到 Sentry copy-debugid.js 脚本文件,请确保已正确安装 @sentry/react-native',
|
|
405
|
-
);
|
|
399
|
+
console.error(t('sentryCliNotFound'));
|
|
406
400
|
return;
|
|
407
401
|
}
|
|
408
402
|
|
|
409
403
|
if (!fs.existsSync(copyDebugidPath)) {
|
|
410
404
|
return;
|
|
411
405
|
}
|
|
412
|
-
console.log('
|
|
406
|
+
console.log(t('copyingDebugId'));
|
|
413
407
|
spawnSync(
|
|
414
408
|
'node',
|
|
415
409
|
[
|
|
@@ -453,9 +447,9 @@ async function uploadSourcemapForSentry(
|
|
|
453
447
|
stdio: 'inherit',
|
|
454
448
|
},
|
|
455
449
|
);
|
|
456
|
-
console.log(
|
|
450
|
+
console.log(t('sentryReleaseCreated', { version }));
|
|
457
451
|
|
|
458
|
-
console.log('
|
|
452
|
+
console.log(t('uploadingSourcemap'));
|
|
459
453
|
spawnSync(
|
|
460
454
|
'node',
|
|
461
455
|
[
|
|
@@ -479,7 +473,7 @@ async function uploadSourcemapForSentry(
|
|
|
479
473
|
const ignorePackingFileNames = ['.', '..', 'index.bundlejs.map'];
|
|
480
474
|
const ignorePackingExtensions = ['DS_Store','txt.map'];
|
|
481
475
|
async function pack(dir: string, output: string) {
|
|
482
|
-
console.log('
|
|
476
|
+
console.log(t('packing'));
|
|
483
477
|
fs.ensureDirSync(path.dirname(output));
|
|
484
478
|
await new Promise<void>((resolve, reject) => {
|
|
485
479
|
const zipfile = new ZipFile();
|
|
@@ -516,7 +510,7 @@ async function pack(dir: string, output: string) {
|
|
|
516
510
|
});
|
|
517
511
|
zipfile.end();
|
|
518
512
|
});
|
|
519
|
-
console.log(t('
|
|
513
|
+
console.log(t('fileGenerated', { file: output }));
|
|
520
514
|
}
|
|
521
515
|
|
|
522
516
|
export function readEntire(entry: string, zipFile: ZipFile) {
|
|
@@ -671,7 +665,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|
|
671
665
|
|
|
672
666
|
for (const k in originEntries) {
|
|
673
667
|
if (!newEntries[k]) {
|
|
674
|
-
console.log(
|
|
668
|
+
console.log(t('deleteFile', { file: k }));
|
|
675
669
|
deletes[k] = 1;
|
|
676
670
|
}
|
|
677
671
|
}
|
|
@@ -844,7 +838,7 @@ export async function enumZipEntries(
|
|
|
844
838
|
await result;
|
|
845
839
|
}
|
|
846
840
|
} catch (error) {
|
|
847
|
-
console.error('
|
|
841
|
+
console.error(t('processingError', { error }));
|
|
848
842
|
}
|
|
849
843
|
|
|
850
844
|
zipfile.readEntry();
|
|
@@ -860,7 +854,7 @@ function diffArgsCheck(args, options, diffFn) {
|
|
|
860
854
|
const [origin, next] = args;
|
|
861
855
|
|
|
862
856
|
if (!origin || !next) {
|
|
863
|
-
console.error(
|
|
857
|
+
console.error(t('usageDiff', { command: diffFn }));
|
|
864
858
|
process.exit(1);
|
|
865
859
|
}
|
|
866
860
|
|
|
@@ -927,7 +921,7 @@ export const commands = {
|
|
|
927
921
|
const realOutput = output.replace(/\$\{time\}/g, `${Date.now()}`);
|
|
928
922
|
|
|
929
923
|
if (!platform) {
|
|
930
|
-
throw new Error('
|
|
924
|
+
throw new Error(t('platformRequired'));
|
|
931
925
|
}
|
|
932
926
|
|
|
933
927
|
console.log(`Bundling with react-native: ${depVersions['react-native']}`);
|
|
@@ -972,14 +966,14 @@ export const commands = {
|
|
|
972
966
|
async diff({ args, options }) {
|
|
973
967
|
const { origin, next, realOutput } = diffArgsCheck(args, options, 'diff');
|
|
974
968
|
|
|
975
|
-
await diffFromPPK(origin, next, realOutput
|
|
969
|
+
await diffFromPPK(origin, next, realOutput);
|
|
976
970
|
console.log(`${realOutput} generated.`);
|
|
977
971
|
},
|
|
978
972
|
|
|
979
973
|
async hdiff({ args, options }) {
|
|
980
974
|
const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
|
|
981
975
|
|
|
982
|
-
await diffFromPPK(origin, next, realOutput
|
|
976
|
+
await diffFromPPK(origin, next, realOutput);
|
|
983
977
|
console.log(`${realOutput} generated.`);
|
|
984
978
|
},
|
|
985
979
|
|
package/src/index.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { loadSession } from './api';
|
|
4
|
-
import updateNotifier from 'update-notifier';
|
|
5
4
|
import { printVersionCommand } from './utils';
|
|
6
|
-
import pkg from '../package.json';
|
|
7
5
|
import { t } from './utils/i18n';
|
|
8
6
|
|
|
9
|
-
updateNotifier({ pkg }).notify({
|
|
10
|
-
isGlobal: true,
|
|
11
|
-
message: t('updateNotifier'),
|
|
12
|
-
});
|
|
13
|
-
|
|
14
7
|
function printUsage() {
|
|
15
8
|
// const commandName = args[0];
|
|
16
9
|
// TODO: print usage of commandName, or print global usage.
|
package/src/locales/en.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
updateNotifier:
|
|
3
|
-
'Run `{updateCommand}` to update the CLI to get continuous improvements in features, performance, and security.',
|
|
4
2
|
loginFirst:
|
|
5
3
|
'Not logged in.\nPlease run `cresc login` in the project directory to login.',
|
|
6
4
|
lockNotFound:
|
|
@@ -29,7 +27,7 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
29
27
|
appId: 'App ID',
|
|
30
28
|
appName: 'App Name',
|
|
31
29
|
platform: 'Platform',
|
|
32
|
-
totalApps: 'Total {{count}} apps',
|
|
30
|
+
totalApps: 'Total {{count}} {{platform}} apps',
|
|
33
31
|
appNotSelected:
|
|
34
32
|
'App not selected. run `cresc selectApp --platform {{platform}}` first!',
|
|
35
33
|
enterAppIdQuestion: 'Enter AppId:',
|
|
@@ -38,6 +36,60 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
38
36
|
createAppSuccess: 'App created successfully (id: {{id}})',
|
|
39
37
|
cancelled: 'Cancelled',
|
|
40
38
|
operationSuccess: 'Operation successful',
|
|
41
|
-
failedToParseUpdateJson:
|
|
39
|
+
failedToParseUpdateJson:
|
|
40
|
+
'Failed to parse file `update.json`. Try to remove it manually.',
|
|
42
41
|
ppkPackageGenerated: 'ppk package generated and saved to: {{- output}}',
|
|
42
|
+
Message: 'Welcome to Cresc hot update service, {{name}}.',
|
|
43
|
+
loggedOut: 'Logged out',
|
|
44
|
+
usageUnderDevelopment: 'Usage is under development now.',
|
|
45
|
+
hermesDisabled: 'Hermes disabled',
|
|
46
|
+
hermesEnabled: 'Hermes enabled, now compiling to hermes bytecode:\n',
|
|
47
|
+
runningHermesc: 'Running hermesc: {{command}} {{args}}',
|
|
48
|
+
composingSourceMap: 'Composing source map',
|
|
49
|
+
copyingDebugId: 'Copying debugid',
|
|
50
|
+
sentryCliNotFound:
|
|
51
|
+
'Cannot find Sentry CLI tool, please make sure @sentry/cli is properly installed',
|
|
52
|
+
sentryReleaseCreated: 'Sentry release created for version: {{version}}',
|
|
53
|
+
uploadingSourcemap: 'Uploading sourcemap',
|
|
54
|
+
packing: 'Packing',
|
|
55
|
+
deletingFile: 'Delete {{- file}}',
|
|
56
|
+
bundlingWithRN: 'Bundling with react-native: {{version}}',
|
|
57
|
+
fileGenerated: '{{- file}} generated.',
|
|
58
|
+
processingError: 'Error processing file: {{error}}',
|
|
59
|
+
usageDiff: 'Usage: cresc {{command}} <origin> <next>',
|
|
60
|
+
pluginDetected: 'detected {{name}} plugin',
|
|
61
|
+
pluginDetectionError: 'error while detecting {{name}} plugin: {{error}}',
|
|
62
|
+
addedToGitignore: 'Added {{line}} to .gitignore',
|
|
63
|
+
processingStringPool: 'Processing the string pool ...',
|
|
64
|
+
processingPackage: 'Processing the package {{count}} ...',
|
|
65
|
+
typeStrings: 'Type strings:',
|
|
66
|
+
keyStrings: 'Key strings:',
|
|
67
|
+
failedToParseIcon: '[Warning] failed to parse icon: {{error}}',
|
|
68
|
+
errorInHarmonyApp: 'Error in getEntryFromHarmonyApp: {{error}}',
|
|
69
|
+
totalPackages: 'Total {{count}} packages',
|
|
70
|
+
usageUploadIpa: 'Usage: cresc uploadIpa <ipa file>',
|
|
71
|
+
usageUploadApk: 'Usage: cresc uploadApk <apk file>',
|
|
72
|
+
usageUploadApp: 'Usage: cresc uploadApp <app file>',
|
|
73
|
+
usageParseApp: 'Usage: cresc parseApp <app file>',
|
|
74
|
+
usageParseIpa: 'Usage: cresc parseIpa <ipa file>',
|
|
75
|
+
usageParseApk: 'Usage: cresc parseApk <apk file>',
|
|
76
|
+
offset: 'Offset {{offset}}',
|
|
77
|
+
packageUploadSuccess:
|
|
78
|
+
'Successfully uploaded new hot update package (id: {{id}})',
|
|
79
|
+
rolloutRangeError: 'rollout must be an integer between 1-100',
|
|
80
|
+
nativeVersionNotFound: 'No native version found >= {{version}}',
|
|
81
|
+
nativeVersionNotFoundLess: 'No native version found <= {{version}}',
|
|
82
|
+
nativeVersionNotFoundMatch: 'No matching native version found: {{version}}',
|
|
83
|
+
packageIdRequired: 'Please provide packageId or packageVersion parameter',
|
|
84
|
+
operationComplete: 'Operation complete, bound to {{count}} native versions',
|
|
85
|
+
platformRequired: 'Platform must be specified.',
|
|
86
|
+
bundleCommandError:
|
|
87
|
+
'"react-native bundle" command exited with code {{code}}.',
|
|
88
|
+
copyHarmonyBundleError: 'Error copying Harmony bundle: {{error}}',
|
|
89
|
+
copyFileFailed: 'Failed to copy file: {{error}}',
|
|
90
|
+
deleteFile: 'Delete {{- file}}',
|
|
91
|
+
rolloutConfigSet:
|
|
92
|
+
'Set {{rollout}}% rollout for version {{version}} on native version(s) {{versions}}',
|
|
93
|
+
versionBind:
|
|
94
|
+
'Bound version {{version}} to native version {{nativeVersion}} (id: {{id}})',
|
|
43
95
|
};
|
package/src/locales/zh.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
updateNotifier:
|
|
3
|
-
'建议运行 `{updateCommand}` 来更新命令行工具以获得功能、性能和安全性的持续改进',
|
|
4
2
|
loginFirst: '尚未登录。\n请在项目目录中运行`pushy login`命令来登录',
|
|
5
3
|
lockNotFound:
|
|
6
4
|
'没有检测到任何 lock 文件,这可能导致依赖关系不一致而使热更异常。',
|
|
@@ -27,7 +25,7 @@ export default {
|
|
|
27
25
|
appId: '应用 id',
|
|
28
26
|
appName: '应用名称',
|
|
29
27
|
platform: '平台',
|
|
30
|
-
totalApps: '共 {{count}} 个{{platform}}应用',
|
|
28
|
+
totalApps: '共 {{count}} 个 {{platform}} 应用',
|
|
31
29
|
appNotSelected:
|
|
32
30
|
'尚未选择应用。请先运行 `pushy selectApp --platform {{platform}}` 来选择应用',
|
|
33
31
|
enterAppIdQuestion: '输入应用 id:',
|
|
@@ -38,4 +36,54 @@ export default {
|
|
|
38
36
|
operationSuccess: '操作成功',
|
|
39
37
|
failedToParseUpdateJson: '无法解析文件 `update.json`。请手动删除它。',
|
|
40
38
|
ppkPackageGenerated: 'ppk 热更包已生成并保存到: {{- output}}',
|
|
39
|
+
welcomeMessage: '欢迎使用 pushy 热更新服务,{{name}}。',
|
|
40
|
+
loggedOut: '已退出登录',
|
|
41
|
+
usageUnderDevelopment: '使用说明正在开发中。',
|
|
42
|
+
hermesDisabled: 'Hermes 已禁用',
|
|
43
|
+
hermesEnabled: 'Hermes 已启用,正在编译为 hermes 字节码:\n',
|
|
44
|
+
runningHermesc: '运行 hermesc:{{command}} {{args}}',
|
|
45
|
+
composingSourceMap: '正在生成 source map',
|
|
46
|
+
copyingDebugId: '正在复制 debugid',
|
|
47
|
+
sentryCliNotFound: '无法找到 Sentry CLI 工具,请确保已正确安装 @sentry/cli',
|
|
48
|
+
sentryReleaseCreated: '已为版本 {{version}} 创建 Sentry release',
|
|
49
|
+
uploadingSourcemap: '正在上传 sourcemap',
|
|
50
|
+
packing: '正在打包',
|
|
51
|
+
deletingFile: '删除 {{- file}}',
|
|
52
|
+
bundlingWithRN: '正在使用 react-native {{version}} 打包',
|
|
53
|
+
fileGenerated: '已生成 {{- file}}。',
|
|
54
|
+
processingError: '处理文件时出错:{{error}}',
|
|
55
|
+
usageDiff: '用法:pushy {{command}} <origin> <next>',
|
|
56
|
+
pluginDetected: '检测到 {{name}} 插件',
|
|
57
|
+
pluginDetectionError: '检测 {{name}} 插件时出错:{{error}}',
|
|
58
|
+
addedToGitignore: '已将 {{line}} 添加到 .gitignore',
|
|
59
|
+
processingStringPool: '正在处理字符串池...',
|
|
60
|
+
processingPackage: '正在处理包 {{count}}...',
|
|
61
|
+
typeStrings: '类型字符串:',
|
|
62
|
+
keyStrings: '键字符串:',
|
|
63
|
+
failedToParseIcon: '[警告] 解析图标失败:{{error}}',
|
|
64
|
+
errorInHarmonyApp: '获取 Harmony 应用入口时出错:{{error}}',
|
|
65
|
+
totalPackages: '共 {{count}} 个包',
|
|
66
|
+
usageUploadIpa: '使用方法: pushy uploadIpa ipa后缀文件',
|
|
67
|
+
usageUploadApk: '使用方法: pushy uploadApk apk后缀文件',
|
|
68
|
+
usageUploadApp: '使用方法: pushy uploadApp app后缀文件',
|
|
69
|
+
usageParseApp: '使用方法: pushy parseApp app后缀文件',
|
|
70
|
+
usageParseIpa: '使用方法: pushy parseIpa ipa后缀文件',
|
|
71
|
+
usageParseApk: '使用方法: pushy parseApk apk后缀文件',
|
|
72
|
+
offset: '偏移量 {{offset}}',
|
|
73
|
+
packageUploadSuccess: '已成功上传新热更包(id: {{id}})',
|
|
74
|
+
rolloutRangeError: 'rollout 必须是 1-100 的整数',
|
|
75
|
+
nativeVersionNotFound: '未查询到 >= {{version}} 的原生版本',
|
|
76
|
+
nativeVersionNotFoundLess: '未查询到 <= {{version}} 的原生版本',
|
|
77
|
+
nativeVersionNotFoundMatch: '未查询到匹配原生版本:{{version}}',
|
|
78
|
+
packageIdRequired: '请提供 packageId 或 packageVersion 参数',
|
|
79
|
+
operationComplete: '操作完成,共已绑定 {{count}} 个原生版本',
|
|
80
|
+
platformRequired: '必须指定平台。',
|
|
81
|
+
bundleCommandError: '"react-native bundle" 命令退出,代码为 {{code}}。',
|
|
82
|
+
copyHarmonyBundleError: '复制 Harmony bundle 错误:{{error}}',
|
|
83
|
+
copyFileFailed: '复制文件失败:{{error}}',
|
|
84
|
+
deleteFile: '删除 {{- file}}',
|
|
85
|
+
rolloutConfigSet:
|
|
86
|
+
'已在原生版本 {{versions}} 上设置灰度发布 {{rollout}}% 热更版本 {{version}}',
|
|
87
|
+
versionBind:
|
|
88
|
+
'已将热更版本 {{version}} 绑定到原生版本 {{nativeVersion}} (id: {{id}})',
|
|
41
89
|
};
|
package/src/package.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { get, post, uploadFile } from './api';
|
|
2
2
|
import { question, saveToLocal } from './utils';
|
|
3
|
+
import { t } from './utils/i18n';
|
|
3
4
|
|
|
4
5
|
import { checkPlatform, getSelectedApp } from './app';
|
|
5
6
|
|
|
@@ -34,7 +35,7 @@ export async function listPackage(appId: string) {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
console.log(Table(header, rows).render());
|
|
37
|
-
console.log(
|
|
38
|
+
console.log(t('totalPackages', { count: data.length }));
|
|
38
39
|
return data;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -54,7 +55,7 @@ export const commands = {
|
|
|
54
55
|
uploadIpa: async ({ args }: { args: string[] }) => {
|
|
55
56
|
const fn = args[0];
|
|
56
57
|
if (!fn || !fn.endsWith('.ipa')) {
|
|
57
|
-
throw new Error('
|
|
58
|
+
throw new Error(t('usageUploadIpa'));
|
|
58
59
|
}
|
|
59
60
|
const {
|
|
60
61
|
versionName,
|
|
@@ -93,7 +94,7 @@ export const commands = {
|
|
|
93
94
|
uploadApk: async ({ args }: { args: string[] }) => {
|
|
94
95
|
const fn = args[0];
|
|
95
96
|
if (!fn || !fn.endsWith('.apk')) {
|
|
96
|
-
throw new Error('
|
|
97
|
+
throw new Error(t('usageUploadApk'));
|
|
97
98
|
}
|
|
98
99
|
const {
|
|
99
100
|
versionName,
|
|
@@ -132,7 +133,7 @@ export const commands = {
|
|
|
132
133
|
uploadApp: async ({ args }: { args: string[] }) => {
|
|
133
134
|
const fn = args[0];
|
|
134
135
|
if (!fn || !fn.endsWith('.app')) {
|
|
135
|
-
throw new Error('
|
|
136
|
+
throw new Error(t('usageUploadApp'));
|
|
136
137
|
}
|
|
137
138
|
const {
|
|
138
139
|
versionName,
|
|
@@ -171,21 +172,21 @@ export const commands = {
|
|
|
171
172
|
parseApp: async ({ args }: { args: string[] }) => {
|
|
172
173
|
const fn = args[0];
|
|
173
174
|
if (!fn || !fn.endsWith('.app')) {
|
|
174
|
-
throw new Error('
|
|
175
|
+
throw new Error(t('usageParseApp'));
|
|
175
176
|
}
|
|
176
177
|
console.log(await getAppInfo(fn));
|
|
177
178
|
},
|
|
178
179
|
parseIpa: async ({ args }: { args: string[] }) => {
|
|
179
180
|
const fn = args[0];
|
|
180
181
|
if (!fn || !fn.endsWith('.ipa')) {
|
|
181
|
-
throw new Error('
|
|
182
|
+
throw new Error(t('usageParseIpa'));
|
|
182
183
|
}
|
|
183
184
|
console.log(await getIpaInfo(fn));
|
|
184
185
|
},
|
|
185
186
|
parseApk: async ({ args }: { args: string[] }) => {
|
|
186
187
|
const fn = args[0];
|
|
187
188
|
if (!fn || !fn.endsWith('.apk')) {
|
|
188
|
-
throw new Error('
|
|
189
|
+
throw new Error(t('usageParseApk'));
|
|
189
190
|
}
|
|
190
191
|
console.log(await getApkInfo(fn));
|
|
191
192
|
},
|
package/src/user.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { question } from './utils';
|
|
2
2
|
import { post, get, replaceSession, saveSession, closeSession } from './api';
|
|
3
3
|
import crypto from 'node:crypto';
|
|
4
|
+
import { t } from './utils/i18n';
|
|
4
5
|
|
|
5
6
|
function md5(str: string) {
|
|
6
7
|
return crypto.createHash('md5').update(str).digest('hex');
|
|
@@ -16,11 +17,11 @@ export const commands = {
|
|
|
16
17
|
});
|
|
17
18
|
replaceSession({ token });
|
|
18
19
|
await saveSession();
|
|
19
|
-
console.log(
|
|
20
|
+
console.log(t('welcomeMessage', { name: info.name }));
|
|
20
21
|
},
|
|
21
22
|
logout: async () => {
|
|
22
23
|
await closeSession();
|
|
23
|
-
console.log('
|
|
24
|
+
console.log(t('loggedOut'));
|
|
24
25
|
},
|
|
25
26
|
me: async () => {
|
|
26
27
|
const me = await get('/user/me');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
// import path from 'node:path';
|
|
3
3
|
import { credentialFile, tempDir } from './constants';
|
|
4
|
+
import { t } from './i18n';
|
|
4
5
|
|
|
5
6
|
export function addGitIgnore() {
|
|
6
7
|
const shouldIgnore = [credentialFile, tempDir];
|
|
@@ -26,7 +27,7 @@ export function addGitIgnore() {
|
|
|
26
27
|
gitignoreLines.push('# react-native-update');
|
|
27
28
|
for (const line of shouldIgnore) {
|
|
28
29
|
gitignoreLines.push(line);
|
|
29
|
-
console.log(
|
|
30
|
+
console.log(t('addedToGitignore', { line }));
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
fs.writeFileSync(gitignorePath, gitignoreLines.join('\n'));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { plugins } from './plugin-config';
|
|
2
|
+
import { t } from './i18n';
|
|
2
3
|
|
|
3
4
|
interface BundleParams {
|
|
4
5
|
sentry: boolean;
|
|
@@ -17,10 +18,10 @@ export async function checkPlugins(): Promise<BundleParams> {
|
|
|
17
18
|
const isEnabled = await plugin.detect();
|
|
18
19
|
if (isEnabled && plugin.bundleParams) {
|
|
19
20
|
Object.assign(params, plugin.bundleParams);
|
|
20
|
-
console.log(
|
|
21
|
+
console.log(t('pluginDetected', { name: plugin.name }));
|
|
21
22
|
}
|
|
22
23
|
} catch (err) {
|
|
23
|
-
console.warn(
|
|
24
|
+
console.warn(t('pluginDetectionError', { name: plugin.name, error: err }));
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
package/src/versions.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { get, post, put, uploadFile } from './api';
|
|
2
2
|
import { question, saveToLocal } from './utils';
|
|
3
|
+
import { t } from './utils/i18n';
|
|
3
4
|
|
|
4
5
|
import { checkPlatform, getSelectedApp } from './app';
|
|
5
6
|
import { choosePackage } from './package';
|
|
@@ -35,7 +36,7 @@ interface CommandOptions {
|
|
|
35
36
|
|
|
36
37
|
async function showVersion(appId: string, offset: number) {
|
|
37
38
|
const { data, count } = await get(`/app/${appId}/version/list`);
|
|
38
|
-
console.log(
|
|
39
|
+
console.log(t('offset', { offset }));
|
|
39
40
|
for (const version of data) {
|
|
40
41
|
const pkgCount = version.packages?.length || 0;
|
|
41
42
|
let packageInfo = '';
|
|
@@ -149,7 +150,7 @@ export const commands = {
|
|
|
149
150
|
});
|
|
150
151
|
// TODO local diff
|
|
151
152
|
saveToLocal(fn, `${appId}/ppk/${id}.ppk`);
|
|
152
|
-
console.log(
|
|
153
|
+
console.log(t('packageUploadSuccess', { id }));
|
|
153
154
|
|
|
154
155
|
const v = await question('是否现在将此热更应用到原生包上?(Y/N)');
|
|
155
156
|
if (v.toLowerCase() === 'y') {
|
|
@@ -192,10 +193,10 @@ export const commands = {
|
|
|
192
193
|
try {
|
|
193
194
|
rollout = Number.parseInt(options.rollout);
|
|
194
195
|
} catch (e) {
|
|
195
|
-
throw new Error('
|
|
196
|
+
throw new Error(t('rolloutRangeError'));
|
|
196
197
|
}
|
|
197
198
|
if (rollout < 1 || rollout > 100) {
|
|
198
|
-
throw new Error('
|
|
199
|
+
throw new Error(t('rolloutRangeError'));
|
|
199
200
|
}
|
|
200
201
|
}
|
|
201
202
|
|
|
@@ -206,7 +207,7 @@ export const commands = {
|
|
|
206
207
|
compare(pkg.name, minPkgVersion, '>='),
|
|
207
208
|
);
|
|
208
209
|
if (pkgs.length === 0) {
|
|
209
|
-
throw new Error(
|
|
210
|
+
throw new Error(t('nativeVersionNotFound', { version: minPkgVersion }));
|
|
210
211
|
}
|
|
211
212
|
if (rollout !== undefined) {
|
|
212
213
|
const rolloutConfig: Record<string, number> = {};
|
|
@@ -219,9 +220,10 @@ export const commands = {
|
|
|
219
220
|
},
|
|
220
221
|
});
|
|
221
222
|
console.log(
|
|
222
|
-
|
|
223
|
-
.map((pkg: Package) => pkg.name)
|
|
224
|
-
|
|
223
|
+
`${t('rolloutConfigSet', {
|
|
224
|
+
versions: pkgs.map((pkg: Package) => pkg.name).join(', '),
|
|
225
|
+
rollout: rollout,
|
|
226
|
+
})}`,
|
|
225
227
|
);
|
|
226
228
|
}
|
|
227
229
|
for (const pkg of pkgs) {
|
|
@@ -229,10 +231,14 @@ export const commands = {
|
|
|
229
231
|
versionId,
|
|
230
232
|
});
|
|
231
233
|
console.log(
|
|
232
|
-
|
|
234
|
+
`${t('versionBind', {
|
|
235
|
+
version: versionId,
|
|
236
|
+
nativeVersion: pkg.name,
|
|
237
|
+
id: pkg.id,
|
|
238
|
+
})}`,
|
|
233
239
|
);
|
|
234
240
|
}
|
|
235
|
-
console.log(
|
|
241
|
+
console.log(t('operationComplete', { count: pkgs.length }));
|
|
236
242
|
return;
|
|
237
243
|
}
|
|
238
244
|
if (maxPkgVersion) {
|
|
@@ -242,7 +248,7 @@ export const commands = {
|
|
|
242
248
|
compare(pkg.name, maxPkgVersion, '<='),
|
|
243
249
|
);
|
|
244
250
|
if (pkgs.length === 0) {
|
|
245
|
-
throw new Error(
|
|
251
|
+
throw new Error(t('nativeVersionNotFoundLess', { version: maxPkgVersion }));
|
|
246
252
|
}
|
|
247
253
|
if (rollout !== undefined) {
|
|
248
254
|
const rolloutConfig: Record<string, number> = {};
|
|
@@ -255,9 +261,10 @@ export const commands = {
|
|
|
255
261
|
},
|
|
256
262
|
});
|
|
257
263
|
console.log(
|
|
258
|
-
|
|
259
|
-
.map((pkg: Package) => pkg.name)
|
|
260
|
-
|
|
264
|
+
`${t('rolloutConfigSet', {
|
|
265
|
+
versions: pkgs.map((pkg: Package) => pkg.name).join(', '),
|
|
266
|
+
rollout: rollout,
|
|
267
|
+
})}`,
|
|
261
268
|
);
|
|
262
269
|
}
|
|
263
270
|
for (const pkg of pkgs) {
|
|
@@ -265,10 +272,14 @@ export const commands = {
|
|
|
265
272
|
versionId,
|
|
266
273
|
});
|
|
267
274
|
console.log(
|
|
268
|
-
|
|
275
|
+
`${t('versionBind', {
|
|
276
|
+
version: versionId,
|
|
277
|
+
nativeVersion: pkg.name,
|
|
278
|
+
id: pkg.id,
|
|
279
|
+
})}`,
|
|
269
280
|
);
|
|
270
281
|
}
|
|
271
|
-
console.log(
|
|
282
|
+
console.log(t('operationComplete', { count: pkgs.length }));
|
|
272
283
|
return;
|
|
273
284
|
}
|
|
274
285
|
|
|
@@ -279,7 +290,7 @@ export const commands = {
|
|
|
279
290
|
if (pkg) {
|
|
280
291
|
pkgId = pkg.id;
|
|
281
292
|
} else {
|
|
282
|
-
throw new Error(
|
|
293
|
+
throw new Error(t('nativeVersionNotFoundMatch', { version: pkgVersion }));
|
|
283
294
|
}
|
|
284
295
|
}
|
|
285
296
|
if (!pkgId) {
|
|
@@ -287,7 +298,7 @@ export const commands = {
|
|
|
287
298
|
}
|
|
288
299
|
|
|
289
300
|
if (!pkgId) {
|
|
290
|
-
throw new Error('
|
|
301
|
+
throw new Error(t('packageIdRequired'));
|
|
291
302
|
}
|
|
292
303
|
|
|
293
304
|
if (!pkgVersion) {
|
|
@@ -306,7 +317,10 @@ export const commands = {
|
|
|
306
317
|
},
|
|
307
318
|
});
|
|
308
319
|
console.log(
|
|
309
|
-
|
|
320
|
+
`${t('rolloutConfigSet', {
|
|
321
|
+
versions: pkgVersion,
|
|
322
|
+
rollout: rollout,
|
|
323
|
+
})}`,
|
|
310
324
|
);
|
|
311
325
|
}
|
|
312
326
|
|
|
@@ -315,9 +329,14 @@ export const commands = {
|
|
|
315
329
|
versionId,
|
|
316
330
|
});
|
|
317
331
|
console.log(
|
|
318
|
-
|
|
332
|
+
`${t('versionBind', {
|
|
333
|
+
version: versionId,
|
|
334
|
+
nativeVersion: pkgVersion,
|
|
335
|
+
id: pkgId,
|
|
336
|
+
})}`,
|
|
319
337
|
);
|
|
320
338
|
}
|
|
339
|
+
console.log(t('operationSuccess'));
|
|
321
340
|
},
|
|
322
341
|
updateVersionInfo: async ({
|
|
323
342
|
args,
|
|
@@ -339,6 +358,6 @@ export const commands = {
|
|
|
339
358
|
if (options.metaInfo) updateParams.metaInfo = options.metaInfo;
|
|
340
359
|
|
|
341
360
|
await put(`/app/${appId}/version/${versionId}`, updateParams);
|
|
342
|
-
console.log('
|
|
361
|
+
console.log(t('operationSuccess'));
|
|
343
362
|
},
|
|
344
363
|
};
|