react-native-update-cli 1.43.5 → 1.44.0
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-lockfile.js +62 -11
- 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-lockfile.ts +71 -11
- 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, "checkLockFiles", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs"));
|
|
12
|
+
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
12
13
|
const _i18n = require("./i18n");
|
|
13
14
|
function _interop_require_default(obj) {
|
|
14
15
|
return obj && obj.__esModule ? obj : {
|
|
@@ -22,21 +23,71 @@ const lockFiles = [
|
|
|
22
23
|
'bun.lockb',
|
|
23
24
|
'bun.lock'
|
|
24
25
|
];
|
|
25
|
-
|
|
26
|
-
function
|
|
26
|
+
// Function to check if a package.json has a workspaces field
|
|
27
|
+
function hasWorkspaces(dir) {
|
|
28
|
+
const pkgPath = _nodepath.default.join(dir, 'package.json');
|
|
29
|
+
if (_nodefs.default.existsSync(pkgPath)) {
|
|
30
|
+
try {
|
|
31
|
+
const pkg = JSON.parse(_nodefs.default.readFileSync(pkgPath, 'utf-8'));
|
|
32
|
+
return !!pkg.workspaces;
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// Ignore parsing errors
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
// Helper function to find lock files in a specific directory
|
|
40
|
+
function findLockFilesInDir(directory) {
|
|
41
|
+
const found = [];
|
|
27
42
|
for (const file of lockFiles){
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
const filePath = _nodepath.default.join(directory, file);
|
|
44
|
+
if (_nodefs.default.existsSync(filePath)) {
|
|
45
|
+
found.push(filePath);
|
|
30
46
|
}
|
|
31
47
|
}
|
|
32
|
-
|
|
48
|
+
return found;
|
|
49
|
+
}
|
|
50
|
+
function checkLockFiles() {
|
|
51
|
+
const cwd = process.cwd();
|
|
52
|
+
let searchDir = cwd;
|
|
53
|
+
let foundLockFiles = findLockFilesInDir(searchDir);
|
|
54
|
+
// If no lock file in cwd, try to find monorepo root and check there
|
|
55
|
+
if (foundLockFiles.length === 0) {
|
|
56
|
+
// Search upwards for package.json with workspaces
|
|
57
|
+
let currentDir = _nodepath.default.dirname(cwd); // Start searching from parent
|
|
58
|
+
let projectRootDir = null;
|
|
59
|
+
while(true){
|
|
60
|
+
if (hasWorkspaces(currentDir)) {
|
|
61
|
+
projectRootDir = currentDir;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
const parentDir = _nodepath.default.dirname(currentDir);
|
|
65
|
+
if (parentDir === currentDir) {
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
currentDir = parentDir;
|
|
69
|
+
}
|
|
70
|
+
// If a potential root was found, switch search directory and re-check
|
|
71
|
+
if (projectRootDir) {
|
|
72
|
+
searchDir = projectRootDir;
|
|
73
|
+
foundLockFiles = findLockFilesInDir(searchDir);
|
|
74
|
+
}
|
|
75
|
+
// If no projectRootDir found, foundLockFiles remains empty and searchDir remains cwd
|
|
76
|
+
}
|
|
77
|
+
// Handle results based on findings in the final searchDir
|
|
78
|
+
if (foundLockFiles.length === 1) {
|
|
79
|
+
// Successfully found one lock file in the determined searchDir
|
|
33
80
|
return;
|
|
34
81
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
82
|
+
if (foundLockFiles.length > 1) {
|
|
83
|
+
// Found multiple lock files in the determined searchDir
|
|
84
|
+
console.warn((0, _i18n.t)('lockBestPractice'));
|
|
85
|
+
throw new Error((0, _i18n.t)('multipleLocksFound', {
|
|
86
|
+
lockFiles: foundLockFiles.join(', ')
|
|
87
|
+
}));
|
|
38
88
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
89
|
+
// If we reach here, foundLockFiles.length === 0
|
|
90
|
+
console.warn((0, _i18n.t)('lockBestPractice'));
|
|
91
|
+
// Warn instead of throwing an error if no lock file is found
|
|
92
|
+
console.warn((0, _i18n.t)('lockNotFound'));
|
|
42
93
|
}
|
|
@@ -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;
|