react-native-update-cli 2.9.6 → 2.10.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/README.md +6 -9
- package/README.zh-CN.md +6 -9
- package/cli.json +0 -27
- package/lib/api.js +3 -4
- package/lib/app.js +1 -1
- package/lib/bundle-pack.js +1 -1
- package/lib/bundle-runner.js +2 -2
- package/lib/diff.d.ts +0 -4
- package/lib/diff.js +18 -61
- package/lib/exports.d.ts +8 -8
- package/lib/exports.js +7 -7
- package/lib/index.d.ts +2 -2
- package/lib/locales/en.d.ts +0 -1
- package/lib/locales/en.js +0 -1
- package/lib/locales/zh.d.ts +0 -1
- package/lib/locales/zh.js +0 -1
- package/lib/modules/index.d.ts +3 -3
- package/lib/package.js +1 -1
- package/lib/utils/app-info-parser/aab.js +1 -1
- package/lib/utils/app-info-parser/ipa.js +1 -1
- package/lib/utils/app-info-parser/utils.d.ts +1 -1
- package/lib/utils/check-plugin.js +22 -10
- package/lib/utils/git.js +1 -1
- package/lib/utils/index.js +3 -3
- package/lib/utils/latest-version/cli.js +1 -1
- package/lib/utils/latest-version/index.d.ts +1 -1
- package/lib/utils/latest-version/index.js +2 -2
- package/lib/utils/zip-options.d.ts +2 -1
- package/lib/utils/zip-options.js +10 -1
- package/lib/versions.d.ts +1 -1
- package/lib/versions.js +4 -4
- package/package.json +12 -9
- package/src/api.ts +4 -5
- package/src/app.ts +1 -2
- package/src/bundle-pack.ts +1 -1
- package/src/bundle-runner.ts +2 -2
- package/src/diff.ts +15 -64
- package/src/exports.ts +17 -20
- package/src/index.ts +2 -2
- package/src/locales/en.ts +0 -2
- package/src/locales/zh.ts +0 -2
- package/src/modules/index.ts +3 -3
- package/src/package.ts +1 -1
- package/src/utils/app-info-parser/aab.ts +1 -1
- package/src/utils/app-info-parser/ipa.ts +1 -1
- package/src/utils/app-info-parser/utils.ts +5 -5
- package/src/utils/check-plugin.ts +18 -11
- package/src/utils/git.ts +1 -1
- package/src/utils/index.ts +4 -5
- package/src/utils/latest-version/cli.ts +4 -4
- package/src/utils/latest-version/index.ts +5 -6
- package/src/utils/zip-options.ts +5 -1
- package/src/versions.ts +5 -10
package/lib/utils/zip-options.js
CHANGED
|
@@ -9,6 +9,9 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
get MANIFEST_COMPRESSION_THRESHOLD_BYTES () {
|
|
13
|
+
return MANIFEST_COMPRESSION_THRESHOLD_BYTES;
|
|
14
|
+
},
|
|
12
15
|
get ZIP_ENTRY_SNIFF_BYTES () {
|
|
13
16
|
return ZIP_ENTRY_SNIFF_BYTES;
|
|
14
17
|
},
|
|
@@ -74,6 +77,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
74
77
|
return newObj;
|
|
75
78
|
}
|
|
76
79
|
const ZIP_ENTRY_SNIFF_BYTES = 64;
|
|
80
|
+
const MANIFEST_COMPRESSION_THRESHOLD_BYTES = 256;
|
|
77
81
|
const alreadyCompressedExtensions = new Set([
|
|
78
82
|
'.7z',
|
|
79
83
|
'.aab',
|
|
@@ -236,7 +240,12 @@ function zipOptionsForPatchEntry() {
|
|
|
236
240
|
compress: false
|
|
237
241
|
};
|
|
238
242
|
}
|
|
239
|
-
function zipOptionsForManifestEntry() {
|
|
243
|
+
function zipOptionsForManifestEntry(byteLength = 0) {
|
|
244
|
+
if (byteLength >= MANIFEST_COMPRESSION_THRESHOLD_BYTES) {
|
|
245
|
+
return {
|
|
246
|
+
compressionLevel: 9
|
|
247
|
+
};
|
|
248
|
+
}
|
|
240
249
|
return {
|
|
241
250
|
compress: false
|
|
242
251
|
};
|
package/lib/versions.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare const versionCommands: {
|
|
|
36
36
|
updateVersionInfo: ({ options, }: {
|
|
37
37
|
options: VersionCommandOptions;
|
|
38
38
|
}) => Promise<void>;
|
|
39
|
-
deleteVersion: ({ options
|
|
39
|
+
deleteVersion: ({ options }: {
|
|
40
40
|
options: VersionCommandOptions;
|
|
41
41
|
}) => Promise<void>;
|
|
42
42
|
};
|
package/lib/versions.js
CHANGED
|
@@ -16,16 +16,16 @@ _export(exports, {
|
|
|
16
16
|
return versionCommands;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _api = require("./api");
|
|
20
|
-
const _utils = require("./utils");
|
|
21
|
-
const _i18n = require("./utils/i18n");
|
|
22
19
|
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
23
20
|
const _compareversions = require("compare-versions");
|
|
24
21
|
const _ttytable = /*#__PURE__*/ _interop_require_default(require("tty-table"));
|
|
22
|
+
const _api = require("./api");
|
|
25
23
|
const _app = require("./app");
|
|
26
24
|
const _package = require("./package");
|
|
25
|
+
const _utils = require("./utils");
|
|
27
26
|
const _depversions = require("./utils/dep-versions");
|
|
28
27
|
const _git = require("./utils/git");
|
|
28
|
+
const _i18n = require("./utils/i18n");
|
|
29
29
|
function _interop_require_default(obj) {
|
|
30
30
|
return obj && obj.__esModule ? obj : {
|
|
31
31
|
default: obj
|
|
@@ -375,7 +375,7 @@ const versionCommands = {
|
|
|
375
375
|
let minPkgVersion = options.minPackageVersion;
|
|
376
376
|
let maxPkgVersion = options.maxPackageVersion;
|
|
377
377
|
let packageVersionRange = options.packageVersionRange;
|
|
378
|
-
let rollout
|
|
378
|
+
let rollout;
|
|
379
379
|
if (options.rollout !== undefined) {
|
|
380
380
|
rollout = Number.parseInt(options.rollout, 10);
|
|
381
381
|
if (Number.isNaN(rollout) || rollout < 1 || rollout > 100) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "command line tool for react-native-update (remote updates for react native)",
|
|
5
5
|
"main": "lib/exports.js",
|
|
6
6
|
"types": "lib/exports.d.ts",
|
|
@@ -37,9 +37,12 @@
|
|
|
37
37
|
"cli.json"
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "rm -rf lib && swc src -d lib --strip-leading-paths &&
|
|
41
|
-
"prepublishOnly": "bun
|
|
42
|
-
"
|
|
40
|
+
"build": "rm -rf lib && swc src -d lib --strip-leading-paths && bun run typecheck:build",
|
|
41
|
+
"prepublishOnly": "bun run build && chmod +x lib/index.js",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"typecheck:build": "tsc -p tsconfig.build.json",
|
|
44
|
+
"lint": "bun run typecheck && biome check .",
|
|
45
|
+
"lint:fix": "bun run typecheck && biome check --write .",
|
|
43
46
|
"test": "bun test",
|
|
44
47
|
"test:coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov"
|
|
45
48
|
},
|
|
@@ -74,7 +77,7 @@
|
|
|
74
77
|
"fs-extra": "8",
|
|
75
78
|
"global-dirs": "^4.0.0",
|
|
76
79
|
"gradle-to-js": "^2.0.1",
|
|
77
|
-
"i18next": "^
|
|
80
|
+
"i18next": "^26.0.4",
|
|
78
81
|
"isomorphic-git": "^1.37.5",
|
|
79
82
|
"isomorphic-unzip": "^1.1.5",
|
|
80
83
|
"node-fetch": "^2.6.1",
|
|
@@ -86,17 +89,17 @@
|
|
|
86
89
|
"registry-auth-token": "^5.1.1",
|
|
87
90
|
"semver": "^7.7.4",
|
|
88
91
|
"tcp-ping": "^0.1.1",
|
|
89
|
-
"tty-table": "
|
|
92
|
+
"tty-table": "5.0",
|
|
90
93
|
"yauzl": "^3.3.0",
|
|
91
94
|
"yazl": "3.3.1"
|
|
92
95
|
},
|
|
93
96
|
"engines": {
|
|
94
|
-
"node": ">=
|
|
97
|
+
"node": ">= 16.6.0"
|
|
95
98
|
},
|
|
96
99
|
"devDependencies": {
|
|
97
|
-
"@biomejs/biome": "^2.4.
|
|
100
|
+
"@biomejs/biome": "^2.4.12",
|
|
98
101
|
"@swc/cli": "0.8.1",
|
|
99
|
-
"@swc/core": "^1.15.
|
|
102
|
+
"@swc/core": "^1.15.26",
|
|
100
103
|
"@types/bun": "^1.3.12",
|
|
101
104
|
"@types/filesize-parser": "^1.5.3",
|
|
102
105
|
"@types/fs-extra": "^11.0.4",
|
package/src/api.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import util from 'util';
|
|
4
1
|
import filesizeParser from 'filesize-parser';
|
|
5
2
|
import FormData from 'form-data';
|
|
3
|
+
import fs from 'fs';
|
|
6
4
|
import fetch from 'node-fetch';
|
|
5
|
+
import path from 'path';
|
|
7
6
|
import ProgressBar from 'progress';
|
|
8
7
|
import tcpp from 'tcp-ping';
|
|
8
|
+
import util from 'util';
|
|
9
9
|
import { getBaseUrl } from 'utils/http-helper';
|
|
10
10
|
import packageJson from '../package.json';
|
|
11
11
|
import type { Package, Session } from './types';
|
|
12
|
-
import {
|
|
12
|
+
import { credentialFile, IS_CRESC, pricingPageUrl } from './utils/constants';
|
|
13
13
|
import { t } from './utils/i18n';
|
|
14
14
|
|
|
15
15
|
const tcpPing = util.promisify(tcpp.ping);
|
|
@@ -163,7 +163,6 @@ export async function uploadFile(fn: string, key?: string) {
|
|
|
163
163
|
});
|
|
164
164
|
let realUrl = url;
|
|
165
165
|
if (backupUrl) {
|
|
166
|
-
// @ts-ignore
|
|
167
166
|
if (global.USE_ACC_OSS) {
|
|
168
167
|
realUrl = backupUrl;
|
|
169
168
|
} else {
|
package/src/app.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import Table from 'tty-table';
|
|
3
|
-
import { question } from './utils';
|
|
4
|
-
|
|
5
3
|
import { doDelete, get, post } from './api';
|
|
6
4
|
import type { Platform } from './types';
|
|
5
|
+
import { question } from './utils';
|
|
7
6
|
import { t } from './utils/i18n';
|
|
8
7
|
|
|
9
8
|
interface AppSummary {
|
package/src/bundle-pack.ts
CHANGED
package/src/bundle-runner.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spawn, spawnSync } from 'child_process';
|
|
2
|
-
import os from 'os';
|
|
3
|
-
import path from 'path';
|
|
4
2
|
import { satisfies } from 'compare-versions';
|
|
5
3
|
import * as fs from 'fs-extra';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
import path from 'path';
|
|
6
6
|
import { t } from './utils/i18n';
|
|
7
7
|
|
|
8
8
|
const g2js = require('gradle-to-js/lib/parser');
|
package/src/diff.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import * as fs from 'fs-extra';
|
|
3
2
|
import { npm, yarn } from 'global-dirs';
|
|
3
|
+
import path from 'path';
|
|
4
4
|
import { ZipFile as YazlZipFile } from 'yazl';
|
|
5
5
|
import type { CommandContext } from './types';
|
|
6
6
|
import { translateOptions } from './utils';
|
|
@@ -22,9 +22,6 @@ type Diff = (oldSource?: Buffer, newSource?: Buffer) => Buffer;
|
|
|
22
22
|
type HdiffModule = {
|
|
23
23
|
diff?: Diff;
|
|
24
24
|
};
|
|
25
|
-
type BsdiffModule = {
|
|
26
|
-
diff?: Diff;
|
|
27
|
-
};
|
|
28
25
|
type EntryMap = Record<string, { crc32: number; fileName: string }>;
|
|
29
26
|
type CrcMap = Record<number, string>;
|
|
30
27
|
type CopyMap = Record<string, string>;
|
|
@@ -38,7 +35,6 @@ type DiffTarget =
|
|
|
38
35
|
};
|
|
39
36
|
type DiffCommandConfig = {
|
|
40
37
|
diffFnName: string;
|
|
41
|
-
useHdiff: boolean;
|
|
42
38
|
target: DiffTarget;
|
|
43
39
|
};
|
|
44
40
|
|
|
@@ -56,10 +52,9 @@ const loadModule = <T>(pkgName: string): T | undefined => {
|
|
|
56
52
|
};
|
|
57
53
|
|
|
58
54
|
const hdiff = loadModule<HdiffModule>('node-hdiffpatch');
|
|
59
|
-
const bsdiff = loadModule<BsdiffModule>('node-bsdiff');
|
|
60
55
|
|
|
61
56
|
function basename(fn: string): string | undefined {
|
|
62
|
-
const m = /^(.+\/)[
|
|
57
|
+
const m = /^(.+\/)[^/]+\/?$/.exec(fn);
|
|
63
58
|
return m?.[1];
|
|
64
59
|
}
|
|
65
60
|
|
|
@@ -203,10 +198,11 @@ async function diffFromPPK(
|
|
|
203
198
|
}
|
|
204
199
|
|
|
205
200
|
//console.log({copies, deletes});
|
|
201
|
+
const diffManifest = Buffer.from(JSON.stringify({ copies, deletes }));
|
|
206
202
|
zipfile.addBuffer(
|
|
207
|
-
|
|
203
|
+
diffManifest,
|
|
208
204
|
'__diff.json',
|
|
209
|
-
zipOptionsForManifestEntry(),
|
|
205
|
+
zipOptionsForManifestEntry(diffManifest.length),
|
|
210
206
|
);
|
|
211
207
|
zipfile.end();
|
|
212
208
|
await writePromise;
|
|
@@ -317,10 +313,11 @@ async function diffFromPackage(
|
|
|
317
313
|
}
|
|
318
314
|
});
|
|
319
315
|
|
|
316
|
+
const diffManifest = Buffer.from(JSON.stringify({ copies }));
|
|
320
317
|
zipfile.addBuffer(
|
|
321
|
-
|
|
318
|
+
diffManifest,
|
|
322
319
|
'__diff.json',
|
|
323
|
-
zipOptionsForManifestEntry(),
|
|
320
|
+
zipOptionsForManifestEntry(diffManifest.length),
|
|
324
321
|
);
|
|
325
322
|
zipfile.end();
|
|
326
323
|
await writePromise;
|
|
@@ -332,33 +329,22 @@ type DiffCommandOptions = {
|
|
|
332
329
|
[key: string]: any;
|
|
333
330
|
};
|
|
334
331
|
|
|
335
|
-
function resolveDiffImplementation(
|
|
336
|
-
useHdiff: boolean,
|
|
337
|
-
options: DiffCommandOptions,
|
|
338
|
-
): Diff {
|
|
332
|
+
function resolveDiffImplementation(options: DiffCommandOptions): Diff {
|
|
339
333
|
if (options.customDiff) {
|
|
340
334
|
return options.customDiff;
|
|
341
335
|
}
|
|
342
336
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
throw new Error(t('nodeHdiffpatchRequired', { scriptName }));
|
|
347
|
-
}
|
|
348
|
-
return hdiffModule.diff;
|
|
337
|
+
const hdiffModule = options.customHdiffModule ?? hdiff;
|
|
338
|
+
if (!hdiffModule?.diff) {
|
|
339
|
+
throw new Error(t('nodeHdiffpatchRequired', { scriptName }));
|
|
349
340
|
}
|
|
350
|
-
|
|
351
|
-
if (!bsdiff?.diff) {
|
|
352
|
-
throw new Error(t('nodeBsdiffRequired', { scriptName }));
|
|
353
|
-
}
|
|
354
|
-
return bsdiff.diff;
|
|
341
|
+
return hdiffModule.diff;
|
|
355
342
|
}
|
|
356
343
|
|
|
357
344
|
function diffArgsCheck(
|
|
358
345
|
args: string[],
|
|
359
346
|
options: DiffCommandOptions,
|
|
360
347
|
diffFnName: string,
|
|
361
|
-
useHdiff: boolean,
|
|
362
348
|
) {
|
|
363
349
|
const [origin, next] = args;
|
|
364
350
|
|
|
@@ -366,7 +352,7 @@ function diffArgsCheck(
|
|
|
366
352
|
throw new Error(t('usageDiff', { command: diffFnName }));
|
|
367
353
|
}
|
|
368
354
|
|
|
369
|
-
const diffFn = resolveDiffImplementation(
|
|
355
|
+
const diffFn = resolveDiffImplementation(options);
|
|
370
356
|
const { output } = translateOptions({
|
|
371
357
|
...options,
|
|
372
358
|
tempDir,
|
|
@@ -389,13 +375,12 @@ const transformIpaPackagePath: PackagePathTransform = (v) => {
|
|
|
389
375
|
};
|
|
390
376
|
|
|
391
377
|
const createDiffCommand =
|
|
392
|
-
({ diffFnName,
|
|
378
|
+
({ diffFnName, target }: DiffCommandConfig) =>
|
|
393
379
|
async ({ args, options }: CommandContext) => {
|
|
394
380
|
const { origin, next, realOutput, diffFn } = diffArgsCheck(
|
|
395
381
|
args,
|
|
396
382
|
options as DiffCommandOptions,
|
|
397
383
|
diffFnName,
|
|
398
|
-
useHdiff,
|
|
399
384
|
);
|
|
400
385
|
|
|
401
386
|
if (target.kind === 'ppk') {
|
|
@@ -415,60 +400,26 @@ const createDiffCommand =
|
|
|
415
400
|
};
|
|
416
401
|
|
|
417
402
|
export const diffCommands = {
|
|
418
|
-
diff: createDiffCommand({
|
|
419
|
-
diffFnName: 'diff',
|
|
420
|
-
useHdiff: false,
|
|
421
|
-
target: { kind: 'ppk' },
|
|
422
|
-
}),
|
|
423
403
|
hdiff: createDiffCommand({
|
|
424
404
|
diffFnName: 'hdiff',
|
|
425
|
-
useHdiff: true,
|
|
426
405
|
target: { kind: 'ppk' },
|
|
427
406
|
}),
|
|
428
|
-
diffFromApk: createDiffCommand({
|
|
429
|
-
diffFnName: 'diffFromApk',
|
|
430
|
-
useHdiff: false,
|
|
431
|
-
target: {
|
|
432
|
-
kind: 'package',
|
|
433
|
-
originBundleName: 'assets/index.android.bundle',
|
|
434
|
-
},
|
|
435
|
-
}),
|
|
436
407
|
hdiffFromApk: createDiffCommand({
|
|
437
408
|
diffFnName: 'hdiffFromApk',
|
|
438
|
-
useHdiff: true,
|
|
439
409
|
target: {
|
|
440
410
|
kind: 'package',
|
|
441
411
|
originBundleName: 'assets/index.android.bundle',
|
|
442
412
|
},
|
|
443
413
|
}),
|
|
444
|
-
diffFromApp: createDiffCommand({
|
|
445
|
-
diffFnName: 'diffFromApp',
|
|
446
|
-
useHdiff: false,
|
|
447
|
-
target: {
|
|
448
|
-
kind: 'package',
|
|
449
|
-
originBundleName: 'resources/rawfile/bundle.harmony.js',
|
|
450
|
-
},
|
|
451
|
-
}),
|
|
452
414
|
hdiffFromApp: createDiffCommand({
|
|
453
415
|
diffFnName: 'hdiffFromApp',
|
|
454
|
-
useHdiff: true,
|
|
455
416
|
target: {
|
|
456
417
|
kind: 'package',
|
|
457
418
|
originBundleName: 'resources/rawfile/bundle.harmony.js',
|
|
458
419
|
},
|
|
459
420
|
}),
|
|
460
|
-
diffFromIpa: createDiffCommand({
|
|
461
|
-
diffFnName: 'diffFromIpa',
|
|
462
|
-
useHdiff: false,
|
|
463
|
-
target: {
|
|
464
|
-
kind: 'package',
|
|
465
|
-
originBundleName: 'main.jsbundle',
|
|
466
|
-
transformPackagePath: transformIpaPackagePath,
|
|
467
|
-
},
|
|
468
|
-
}),
|
|
469
421
|
hdiffFromIpa: createDiffCommand({
|
|
470
422
|
diffFnName: 'hdiffFromIpa',
|
|
471
|
-
useHdiff: true,
|
|
472
423
|
target: {
|
|
473
424
|
kind: 'package',
|
|
474
425
|
originBundleName: 'main.jsbundle',
|
package/src/exports.ts
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
|
+
export { getSession, loadSession } from './api';
|
|
2
|
+
export { getPlatform, getSelectedApp } from './app';
|
|
3
|
+
export { diffCommands } from './diff';
|
|
1
4
|
export { moduleManager } from './module-manager';
|
|
5
|
+
export { builtinModules } from './modules';
|
|
6
|
+
export { appModule } from './modules/app-module';
|
|
7
|
+
export { bundleModule } from './modules/bundle-module';
|
|
8
|
+
export { packageModule } from './modules/package-module';
|
|
9
|
+
export { userModule } from './modules/user-module';
|
|
10
|
+
export { versionModule } from './modules/version-module';
|
|
2
11
|
export { CLIProviderImpl } from './provider';
|
|
3
|
-
|
|
4
12
|
export type {
|
|
5
|
-
|
|
13
|
+
BundleOptions,
|
|
6
14
|
CLIModule,
|
|
7
|
-
|
|
8
|
-
CustomWorkflow,
|
|
9
|
-
WorkflowStep,
|
|
15
|
+
CLIProvider,
|
|
10
16
|
CommandContext,
|
|
17
|
+
CommandDefinition,
|
|
11
18
|
CommandResult,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
UploadOptions,
|
|
19
|
+
CustomWorkflow,
|
|
20
|
+
Package,
|
|
15
21
|
Platform,
|
|
22
|
+
PublishOptions,
|
|
16
23
|
Session,
|
|
24
|
+
UploadOptions,
|
|
17
25
|
Version,
|
|
18
|
-
|
|
26
|
+
WorkflowStep,
|
|
19
27
|
} from './types';
|
|
20
|
-
|
|
21
|
-
export { builtinModules } from './modules';
|
|
22
|
-
export { bundleModule } from './modules/bundle-module';
|
|
23
|
-
export { versionModule } from './modules/version-module';
|
|
24
|
-
export { appModule } from './modules/app-module';
|
|
25
|
-
export { userModule } from './modules/user-module';
|
|
26
|
-
export { packageModule } from './modules/package-module';
|
|
27
|
-
|
|
28
|
-
export { loadSession, getSession } from './api';
|
|
29
|
-
export { getPlatform, getSelectedApp } from './app';
|
|
30
|
-
export { diffCommands } from './diff';
|
|
31
28
|
export { question, saveToLocal } from './utils';
|
package/src/index.ts
CHANGED
|
@@ -146,14 +146,14 @@ async function run() {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export { moduleManager };
|
|
150
149
|
export { CLIProviderImpl } from './provider';
|
|
151
150
|
export type {
|
|
152
|
-
CLIProvider,
|
|
153
151
|
CLIModule,
|
|
152
|
+
CLIProvider,
|
|
154
153
|
CommandDefinition,
|
|
155
154
|
CustomWorkflow,
|
|
156
155
|
WorkflowStep,
|
|
157
156
|
} from './types';
|
|
157
|
+
export { moduleManager };
|
|
158
158
|
|
|
159
159
|
run();
|
package/src/locales/en.ts
CHANGED
|
@@ -174,8 +174,6 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
174
174
|
bundleFileNotFound:
|
|
175
175
|
'Bundle file not found! Please use default bundle file name and path.',
|
|
176
176
|
diffPackageGenerated: '{{- output}} generated.',
|
|
177
|
-
nodeBsdiffRequired:
|
|
178
|
-
'This function needs "node-bsdiff". Please run "{{scriptName}} install node-bsdiff" to install',
|
|
179
177
|
nodeHdiffpatchRequired:
|
|
180
178
|
'This function needs "node-hdiffpatch". Please run "{{scriptName}} install node-hdiffpatch" to install',
|
|
181
179
|
apkExtracted: 'APK extracted to {{output}}',
|
package/src/locales/zh.ts
CHANGED
|
@@ -161,8 +161,6 @@ export default {
|
|
|
161
161
|
deleteVersionError: '删除热更包 {{versionId}} 失败: {{error}}',
|
|
162
162
|
bundleFileNotFound: '未找到 bundle 文件!请使用默认的 bundle 文件名和路径。',
|
|
163
163
|
diffPackageGenerated: '{{- output}} 已生成。',
|
|
164
|
-
nodeBsdiffRequired:
|
|
165
|
-
'此功能需要 "node-bsdiff"。请运行 "{{scriptName}} install node-bsdiff" 来安装',
|
|
166
164
|
nodeHdiffpatchRequired:
|
|
167
165
|
'此功能需要 "node-hdiffpatch"。请运行 "{{scriptName}} install node-hdiffpatch" 来安装',
|
|
168
166
|
apkExtracted: 'APK 已提取到 {{output}}',
|
package/src/modules/index.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { packageModule } from './package-module';
|
|
|
4
4
|
import { userModule } from './user-module';
|
|
5
5
|
import { versionModule } from './version-module';
|
|
6
6
|
|
|
7
|
-
export { bundleModule } from './bundle-module';
|
|
8
|
-
export { versionModule } from './version-module';
|
|
9
7
|
export { appModule } from './app-module';
|
|
10
|
-
export {
|
|
8
|
+
export { bundleModule } from './bundle-module';
|
|
11
9
|
export { packageModule } from './package-module';
|
|
10
|
+
export { userModule } from './user-module';
|
|
11
|
+
export { versionModule } from './version-module';
|
|
12
12
|
|
|
13
13
|
export const builtinModules = [
|
|
14
14
|
bundleModule,
|
package/src/package.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
|
+
import fs from 'fs-extra';
|
|
2
3
|
import os from 'os';
|
|
3
4
|
import path from 'path';
|
|
4
|
-
import fs from 'fs-extra';
|
|
5
5
|
import { open as openZipFile } from 'yauzl';
|
|
6
6
|
import { t } from '../i18n';
|
|
7
7
|
import { ResourceFinder } from './resource-finder';
|
|
@@ -5,7 +5,7 @@ const cgbiToPng = require('cgbi-to-png');
|
|
|
5
5
|
import { findIpaIconPath, getBase64FromBuffer, isBrowser } from './utils';
|
|
6
6
|
import { Zip } from './zip';
|
|
7
7
|
|
|
8
|
-
const PlistName = /payload\/[
|
|
8
|
+
const PlistName = /payload\/[^/]+?.app\/info.plist$/i;
|
|
9
9
|
const ProvisionName = /payload\/.+?\.app\/embedded.mobileprovision/;
|
|
10
10
|
|
|
11
11
|
export class IpaParser extends Zip {
|
|
@@ -149,13 +149,13 @@ const decodeNullUnicode = (value: string | RegExp) => {
|
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
export {
|
|
152
|
+
decodeNullUnicode,
|
|
153
|
+
findApkIconPath,
|
|
154
|
+
findIpaIconPath,
|
|
155
|
+
getBase64FromBuffer,
|
|
152
156
|
isArray,
|
|
157
|
+
isBrowser,
|
|
153
158
|
isObject,
|
|
154
159
|
isPrimitive,
|
|
155
|
-
isBrowser,
|
|
156
160
|
mapInfoResource,
|
|
157
|
-
findApkIconPath,
|
|
158
|
-
findIpaIconPath,
|
|
159
|
-
getBase64FromBuffer,
|
|
160
|
-
decodeNullUnicode,
|
|
161
161
|
};
|
|
@@ -13,19 +13,26 @@ export async function checkPlugins(): Promise<BundleParams> {
|
|
|
13
13
|
sourcemap: false,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const results = await Promise.all(
|
|
17
|
+
plugins.map(async (plugin) => {
|
|
18
|
+
try {
|
|
19
|
+
const isEnabled = await plugin.detect();
|
|
20
|
+
return { isEnabled, error: null };
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return { isEnabled: false, error };
|
|
22
23
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
results.forEach(({ isEnabled, error }, index) => {
|
|
28
|
+
const plugin = plugins[index];
|
|
29
|
+
if (error) {
|
|
30
|
+
console.warn(t('pluginDetectionError', { name: plugin.name, error }));
|
|
31
|
+
} else if (isEnabled && plugin.bundleParams) {
|
|
32
|
+
Object.assign(params, plugin.bundleParams);
|
|
33
|
+
console.log(t('pluginDetected', { name: plugin.name }));
|
|
27
34
|
}
|
|
28
|
-
}
|
|
35
|
+
});
|
|
29
36
|
|
|
30
37
|
return params;
|
|
31
38
|
}
|
package/src/utils/git.ts
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import os from 'os';
|
|
2
|
-
import path from 'path';
|
|
3
1
|
import chalk from 'chalk';
|
|
4
2
|
import { satisfies } from 'compare-versions';
|
|
5
3
|
import fs from 'fs-extra';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
import path from 'path';
|
|
6
6
|
import type { Root as ProtobufRoot } from 'protobufjs';
|
|
7
|
-
import {
|
|
7
|
+
import { read } from 'read';
|
|
8
|
+
import { open as openZipFile, type Entry as YauzlEntry } from 'yauzl';
|
|
8
9
|
import pkg from '../../package.json';
|
|
9
10
|
import latestVersion from '../utils/latest-version';
|
|
10
11
|
import AppInfoParser from './app-info-parser';
|
|
11
12
|
import { checkPlugins } from './check-plugin';
|
|
12
|
-
|
|
13
|
-
import { read } from 'read';
|
|
14
13
|
import { IS_CRESC, tempDir } from './constants';
|
|
15
14
|
import { depVersions } from './dep-versions';
|
|
16
15
|
import { t } from './i18n';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'fs';
|
|
2
|
-
import { dirname } from 'path';
|
|
3
1
|
import {
|
|
4
2
|
blue,
|
|
5
3
|
bold,
|
|
@@ -14,13 +12,15 @@ import {
|
|
|
14
12
|
underline,
|
|
15
13
|
yellow,
|
|
16
14
|
} from '@colors/colors/safe';
|
|
15
|
+
import { existsSync, readFileSync } from 'fs';
|
|
16
|
+
import { dirname } from 'path';
|
|
17
17
|
import semverDiff from 'semver/functions/diff';
|
|
18
18
|
import semverMajor from 'semver/functions/major';
|
|
19
19
|
import latestVersion, {
|
|
20
|
+
type LatestVersionOptions,
|
|
21
|
+
type LatestVersionPackage,
|
|
20
22
|
type Package,
|
|
21
23
|
type PackageJson,
|
|
22
|
-
type LatestVersionPackage,
|
|
23
|
-
type LatestVersionOptions,
|
|
24
24
|
} from '.';
|
|
25
25
|
|
|
26
26
|
interface TableColumn {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import { npm, yarn } from 'global-dirs';
|
|
2
3
|
import type {
|
|
3
4
|
Agent,
|
|
4
5
|
RequestOptions as HttpRequestOptions,
|
|
@@ -7,13 +8,11 @@ import type {
|
|
|
7
8
|
import type { RequestOptions as HttpsRequestOptions } from 'https';
|
|
8
9
|
import { homedir } from 'os';
|
|
9
10
|
import { dirname, join, parse, resolve as pathResolve } from 'path';
|
|
10
|
-
import { URL } from 'url';
|
|
11
|
-
import { npm, yarn } from 'global-dirs';
|
|
12
|
-
|
|
13
11
|
import registryAuthToken from 'registry-auth-token';
|
|
14
12
|
import getRegistryUrl from 'registry-auth-token/registry-url';
|
|
15
13
|
import gt from 'semver/functions/gt';
|
|
16
14
|
import maxSatisfying from 'semver/ranges/max-satisfying';
|
|
15
|
+
import { URL } from 'url';
|
|
17
16
|
|
|
18
17
|
interface RegistryVersions {
|
|
19
18
|
/**
|
|
@@ -486,13 +485,13 @@ const latestVersion: LatestVersion = async (
|
|
|
486
485
|
|
|
487
486
|
export type {
|
|
488
487
|
LatestVersion,
|
|
488
|
+
LatestVersionOptions,
|
|
489
|
+
LatestVersionPackage,
|
|
489
490
|
Package,
|
|
490
|
-
PackageRange,
|
|
491
491
|
PackageJson,
|
|
492
492
|
PackageJsonDependencies,
|
|
493
|
+
PackageRange,
|
|
493
494
|
RegistryVersions,
|
|
494
|
-
LatestVersionPackage,
|
|
495
495
|
RequestOptions,
|
|
496
|
-
LatestVersionOptions,
|
|
497
496
|
};
|
|
498
497
|
export default latestVersion;
|