react-native-update-cli 2.9.6 → 2.9.7

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/api.js CHANGED
@@ -49,14 +49,14 @@ _export(exports, {
49
49
  return uploadFile;
50
50
  }
51
51
  });
52
- const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
53
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
54
- const _util = /*#__PURE__*/ _interop_require_default(require("util"));
55
52
  const _filesizeparser = /*#__PURE__*/ _interop_require_default(require("filesize-parser"));
56
53
  const _formdata = /*#__PURE__*/ _interop_require_default(require("form-data"));
54
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
57
55
  const _nodefetch = /*#__PURE__*/ _interop_require_default(require("node-fetch"));
56
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
58
57
  const _progress = /*#__PURE__*/ _interop_require_default(require("progress"));
59
58
  const _tcpping = /*#__PURE__*/ _interop_require_default(require("tcp-ping"));
59
+ const _util = /*#__PURE__*/ _interop_require_default(require("util"));
60
60
  const _httphelper = require("./utils/http-helper");
61
61
  const _packagejson = /*#__PURE__*/ _interop_require_default(require("../package.json"));
62
62
  const _constants = require("./utils/constants");
@@ -189,7 +189,6 @@ async function uploadFile(fn, key) {
189
189
  });
190
190
  let realUrl = url;
191
191
  if (backupUrl) {
192
- // @ts-ignore
193
192
  if (global.USE_ACC_OSS) {
194
193
  realUrl = backupUrl;
195
194
  } else {
package/lib/app.js CHANGED
@@ -30,8 +30,8 @@ _export(exports, {
30
30
  });
31
31
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
32
32
  const _ttytable = /*#__PURE__*/ _interop_require_default(require("tty-table"));
33
- const _utils = require("./utils");
34
33
  const _api = require("./api");
34
+ const _utils = require("./utils");
35
35
  const _i18n = require("./utils/i18n");
36
36
  function _interop_require_default(obj) {
37
37
  return obj && obj.__esModule ? obj : {
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "packBundle", {
8
8
  return packBundle;
9
9
  }
10
10
  });
11
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
11
  const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
12
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
13
  const _yazl = require("yazl");
14
14
  const _i18n = require("./utils/i18n");
15
15
  const _zipoptions = require("./utils/zip-options");
@@ -26,10 +26,10 @@ _export(exports, {
26
26
  }
27
27
  });
28
28
  const _child_process = require("child_process");
29
- const _os = /*#__PURE__*/ _interop_require_default(require("os"));
30
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
31
29
  const _compareversions = require("compare-versions");
32
30
  const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
31
+ const _os = /*#__PURE__*/ _interop_require_default(require("os"));
32
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
33
33
  const _i18n = require("./utils/i18n");
34
34
  function _interop_require_default(obj) {
35
35
  return obj && obj.__esModule ? obj : {
package/lib/diff.js CHANGED
@@ -19,9 +19,9 @@ _export(exports, {
19
19
  return _zipentries.readEntry;
20
20
  }
21
21
  });
22
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
23
22
  const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
24
23
  const _globaldirs = require("global-dirs");
24
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
25
25
  const _yazl = require("yazl");
26
26
  const _utils = require("./utils");
27
27
  const _constants = require("./utils/constants");
@@ -91,7 +91,7 @@ const loadModule = (pkgName)=>{
91
91
  const hdiff = loadModule('node-hdiffpatch');
92
92
  const bsdiff = loadModule('node-bsdiff');
93
93
  function basename(fn) {
94
- const m = /^(.+\/)[^\/]+\/?$/.exec(fn);
94
+ const m = /^(.+\/)[^/]+\/?$/.exec(fn);
95
95
  return m == null ? void 0 : m[1];
96
96
  }
97
97
  async function diffFromPPK(origin, next, output, diffFn) {
@@ -198,10 +198,11 @@ async function diffFromPPK(origin, next, output, diffFn) {
198
198
  }
199
199
  }
200
200
  //console.log({copies, deletes});
201
- zipfile.addBuffer(Buffer.from(JSON.stringify({
201
+ const diffManifest = Buffer.from(JSON.stringify({
202
202
  copies,
203
203
  deletes
204
- })), '__diff.json', (0, _zipoptions.zipOptionsForManifestEntry)());
204
+ }));
205
+ zipfile.addBuffer(diffManifest, '__diff.json', (0, _zipoptions.zipOptionsForManifestEntry)(diffManifest.length));
205
206
  zipfile.end();
206
207
  await writePromise;
207
208
  }
@@ -277,9 +278,10 @@ async function diffFromPackage(origin, next, output, diffFn, originBundleName, t
277
278
  });
278
279
  }
279
280
  });
280
- zipfile.addBuffer(Buffer.from(JSON.stringify({
281
+ const diffManifest = Buffer.from(JSON.stringify({
281
282
  copies
282
- })), '__diff.json', (0, _zipoptions.zipOptionsForManifestEntry)());
283
+ }));
284
+ zipfile.addBuffer(diffManifest, '__diff.json', (0, _zipoptions.zipOptionsForManifestEntry)(diffManifest.length));
283
285
  zipfile.end();
284
286
  await writePromise;
285
287
  }
package/lib/exports.d.ts CHANGED
@@ -1,13 +1,13 @@
1
+ export { getSession, loadSession } from './api';
2
+ export { getPlatform, getSelectedApp } from './app';
3
+ export { diffCommands } from './diff';
1
4
  export { moduleManager } from './module-manager';
2
- export { CLIProviderImpl } from './provider';
3
- export type { CLIProvider, CLIModule, CommandDefinition, CustomWorkflow, WorkflowStep, CommandContext, CommandResult, BundleOptions, PublishOptions, UploadOptions, Platform, Session, Version, Package, } from './types';
4
5
  export { builtinModules } from './modules';
5
- export { bundleModule } from './modules/bundle-module';
6
- export { versionModule } from './modules/version-module';
7
6
  export { appModule } from './modules/app-module';
8
- export { userModule } from './modules/user-module';
7
+ export { bundleModule } from './modules/bundle-module';
9
8
  export { packageModule } from './modules/package-module';
10
- export { loadSession, getSession } from './api';
11
- export { getPlatform, getSelectedApp } from './app';
12
- export { diffCommands } from './diff';
9
+ export { userModule } from './modules/user-module';
10
+ export { versionModule } from './modules/version-module';
11
+ export { CLIProviderImpl } from './provider';
12
+ export type { BundleOptions, CLIModule, CLIProvider, CommandContext, CommandDefinition, CommandResult, CustomWorkflow, Package, Platform, PublishOptions, Session, UploadOptions, Version, WorkflowStep, } from './types';
13
13
  export { question, saveToLocal } from './utils';
package/lib/exports.js CHANGED
@@ -55,15 +55,15 @@ _export(exports, {
55
55
  return _versionmodule.versionModule;
56
56
  }
57
57
  });
58
+ const _api = require("./api");
59
+ const _app = require("./app");
60
+ const _diff = require("./diff");
58
61
  const _modulemanager = require("./module-manager");
59
- const _provider = require("./provider");
60
62
  const _modules = require("./modules");
61
- const _bundlemodule = require("./modules/bundle-module");
62
- const _versionmodule = require("./modules/version-module");
63
63
  const _appmodule = require("./modules/app-module");
64
- const _usermodule = require("./modules/user-module");
64
+ const _bundlemodule = require("./modules/bundle-module");
65
65
  const _packagemodule = require("./modules/package-module");
66
- const _api = require("./api");
67
- const _app = require("./app");
68
- const _diff = require("./diff");
66
+ const _usermodule = require("./modules/user-module");
67
+ const _versionmodule = require("./modules/version-module");
68
+ const _provider = require("./provider");
69
69
  const _utils = require("./utils");
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { moduleManager } from './module-manager';
3
- export { moduleManager };
4
3
  export { CLIProviderImpl } from './provider';
5
- export type { CLIProvider, CLIModule, CommandDefinition, CustomWorkflow, WorkflowStep, } from './types';
4
+ export type { CLIModule, CLIProvider, CommandDefinition, CustomWorkflow, WorkflowStep, } from './types';
5
+ export { moduleManager };
@@ -1,6 +1,6 @@
1
- export { bundleModule } from './bundle-module';
2
- export { versionModule } from './version-module';
3
1
  export { appModule } from './app-module';
4
- export { userModule } from './user-module';
2
+ export { bundleModule } from './bundle-module';
5
3
  export { packageModule } from './package-module';
4
+ export { userModule } from './user-module';
5
+ export { versionModule } from './version-module';
6
6
  export declare const builtinModules: import("..").CLIModule[];
package/lib/package.js CHANGED
@@ -22,9 +22,9 @@ _export(exports, {
22
22
  return packageCommands;
23
23
  }
24
24
  });
25
+ const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
25
26
  const _os = /*#__PURE__*/ _interop_require_default(require("os"));
26
27
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
27
- const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
28
28
  const _ttytable = /*#__PURE__*/ _interop_require_default(require("tty-table"));
29
29
  const _api = require("./api");
30
30
  const _app = require("./app");
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "AabParser", {
9
9
  }
10
10
  });
11
11
  const _child_process = require("child_process");
12
+ const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
12
13
  const _os = /*#__PURE__*/ _interop_require_default(require("os"));
13
14
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
14
- const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
15
15
  const _yauzl = require("yauzl");
16
16
  const _i18n = require("../i18n");
17
17
  const _resourcefinder = require("./resource-finder");
@@ -13,7 +13,7 @@ const _zip = require("./zip");
13
13
  const parsePlist = require('plist').parse;
14
14
  const parseBplist = require('bplist-parser').parseBuffer;
15
15
  const cgbiToPng = require('cgbi-to-png');
16
- const PlistName = /payload\/[^\/]+?.app\/info.plist$/i;
16
+ const PlistName = /payload\/[^/]+?.app\/info.plist$/i;
17
17
  const ProvisionName = /payload\/.+?\.app\/embedded.mobileprovision/;
18
18
  class IpaParser extends _zip.Zip {
19
19
  parse() {
@@ -28,4 +28,4 @@ declare const getBase64FromBuffer: (buffer: Buffer | string) => string;
28
28
  * @param {String} str
29
29
  */
30
30
  declare const decodeNullUnicode: (value: string | RegExp) => string | RegExp;
31
- export { isArray, isObject, isPrimitive, isBrowser, mapInfoResource, findApkIconPath, findIpaIconPath, getBase64FromBuffer, decodeNullUnicode, };
31
+ export { decodeNullUnicode, findApkIconPath, findIpaIconPath, getBase64FromBuffer, isArray, isBrowser, isObject, isPrimitive, mapInfoResource, };
package/lib/utils/git.js CHANGED
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "getCommitInfo", {
9
9
  }
10
10
  });
11
11
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
12
  const _isomorphicgit = /*#__PURE__*/ _interop_require_default(require("isomorphic-git"));
13
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
14
14
  function _interop_require_default(obj) {
15
15
  return obj && obj.__esModule ? obj : {
16
16
  default: obj
@@ -37,17 +37,17 @@ _export(exports, {
37
37
  return translateOptions;
38
38
  }
39
39
  });
40
- const _os = /*#__PURE__*/ _interop_require_default(require("os"));
41
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
42
40
  const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
43
41
  const _compareversions = require("compare-versions");
44
42
  const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
43
+ const _os = /*#__PURE__*/ _interop_require_default(require("os"));
44
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
45
+ const _read = require("read");
45
46
  const _yauzl = require("yauzl");
46
47
  const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
47
48
  const _latestversion = /*#__PURE__*/ _interop_require_default(require("./latest-version"));
48
49
  const _appinfoparser = /*#__PURE__*/ _interop_require_default(require("./app-info-parser"));
49
50
  const _checkplugin = require("./check-plugin");
50
- const _read = require("read");
51
51
  const _constants = require("./constants");
52
52
  const _depversions = require("./dep-versions");
53
53
  const _i18n = require("./i18n");
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ const _safe = require("@colors/colors/safe");
5
6
  const _fs = require("fs");
6
7
  const _path = require("path");
7
- const _safe = require("@colors/colors/safe");
8
8
  const _diff = /*#__PURE__*/ _interop_require_default(require("semver/functions/diff"));
9
9
  const _major = /*#__PURE__*/ _interop_require_default(require("semver/functions/major"));
10
10
  const _ = /*#__PURE__*/ _interop_require_default(require("."));
@@ -142,5 +142,5 @@ type PackageJson = Record<string, any> & ({
142
142
  });
143
143
  export declare const ONE_DAY: number;
144
144
  declare const latestVersion: LatestVersion;
145
- export type { LatestVersion, Package, PackageRange, PackageJson, PackageJsonDependencies, RegistryVersions, LatestVersionPackage, RequestOptions, LatestVersionOptions, };
145
+ export type { LatestVersion, LatestVersionOptions, LatestVersionPackage, Package, PackageJson, PackageJsonDependencies, PackageRange, RegistryVersions, RequestOptions, };
146
146
  export default latestVersion;
@@ -17,14 +17,14 @@ _export(exports, {
17
17
  }
18
18
  });
19
19
  const _fs = require("fs");
20
+ const _globaldirs = require("global-dirs");
20
21
  const _os = require("os");
21
22
  const _path = require("path");
22
- const _url = require("url");
23
- const _globaldirs = require("global-dirs");
24
23
  const _registryauthtoken = /*#__PURE__*/ _interop_require_default(require("registry-auth-token"));
25
24
  const _registryurl = /*#__PURE__*/ _interop_require_default(require("registry-auth-token/registry-url"));
26
25
  const _gt = /*#__PURE__*/ _interop_require_default(require("semver/functions/gt"));
27
26
  const _maxsatisfying = /*#__PURE__*/ _interop_require_default(require("semver/ranges/max-satisfying"));
27
+ const _url = require("url");
28
28
  function _interop_require_default(obj) {
29
29
  return obj && obj.__esModule ? obj : {
30
30
  default: obj
@@ -3,7 +3,8 @@ export type ZipEntryOptions = {
3
3
  compressionLevel?: number;
4
4
  };
5
5
  export declare const ZIP_ENTRY_SNIFF_BYTES = 64;
6
+ export declare const MANIFEST_COMPRESSION_THRESHOLD_BYTES = 256;
6
7
  export declare function zipOptionsForPatchEntry(): ZipEntryOptions;
7
- export declare function zipOptionsForManifestEntry(): ZipEntryOptions;
8
+ export declare function zipOptionsForManifestEntry(byteLength?: number): ZipEntryOptions;
8
9
  export declare function zipOptionsForPayloadEntry(fileName: string, prefix?: Buffer): ZipEntryOptions;
9
10
  export declare function zipOptionsForPayloadFile(filePath: string, entryName?: string): ZipEntryOptions;
@@ -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 = undefined;
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.9.6",
3
+ "version": "2.9.7",
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 && tsc -p tsconfig.build.json",
41
- "prepublishOnly": "bun scripts/prepublish.ts && bun run build && chmod +x lib/index.js",
42
- "lint": "tsc --noEmit && biome check --write .",
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": "^24.2.3",
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,7 +89,7 @@
86
89
  "registry-auth-token": "^5.1.1",
87
90
  "semver": "^7.7.4",
88
91
  "tcp-ping": "^0.1.1",
89
- "tty-table": "4.2",
92
+ "tty-table": "5.0",
90
93
  "yauzl": "^3.3.0",
91
94
  "yazl": "3.3.1"
92
95
  },
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 { IS_CRESC, credentialFile, pricingPageUrl } from './utils/constants';
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 {
@@ -1,5 +1,5 @@
1
- import path from 'path';
2
1
  import * as fs from 'fs-extra';
2
+ import path from 'path';
3
3
  import { ZipFile as YazlZipFile } from 'yazl';
4
4
  import { t } from './utils/i18n';
5
5
  import { zipOptionsForPayloadFile } from './utils/zip-options';
@@ -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';
@@ -59,7 +59,7 @@ const hdiff = loadModule<HdiffModule>('node-hdiffpatch');
59
59
  const bsdiff = loadModule<BsdiffModule>('node-bsdiff');
60
60
 
61
61
  function basename(fn: string): string | undefined {
62
- const m = /^(.+\/)[^\/]+\/?$/.exec(fn);
62
+ const m = /^(.+\/)[^/]+\/?$/.exec(fn);
63
63
  return m?.[1];
64
64
  }
65
65
 
@@ -203,10 +203,11 @@ async function diffFromPPK(
203
203
  }
204
204
 
205
205
  //console.log({copies, deletes});
206
+ const diffManifest = Buffer.from(JSON.stringify({ copies, deletes }));
206
207
  zipfile.addBuffer(
207
- Buffer.from(JSON.stringify({ copies, deletes })),
208
+ diffManifest,
208
209
  '__diff.json',
209
- zipOptionsForManifestEntry(),
210
+ zipOptionsForManifestEntry(diffManifest.length),
210
211
  );
211
212
  zipfile.end();
212
213
  await writePromise;
@@ -317,10 +318,11 @@ async function diffFromPackage(
317
318
  }
318
319
  });
319
320
 
321
+ const diffManifest = Buffer.from(JSON.stringify({ copies }));
320
322
  zipfile.addBuffer(
321
- Buffer.from(JSON.stringify({ copies })),
323
+ diffManifest,
322
324
  '__diff.json',
323
- zipOptionsForManifestEntry(),
325
+ zipOptionsForManifestEntry(diffManifest.length),
324
326
  );
325
327
  zipfile.end();
326
328
  await writePromise;
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
- CLIProvider,
13
+ BundleOptions,
6
14
  CLIModule,
7
- CommandDefinition,
8
- CustomWorkflow,
9
- WorkflowStep,
15
+ CLIProvider,
10
16
  CommandContext,
17
+ CommandDefinition,
11
18
  CommandResult,
12
- BundleOptions,
13
- PublishOptions,
14
- UploadOptions,
19
+ CustomWorkflow,
20
+ Package,
15
21
  Platform,
22
+ PublishOptions,
16
23
  Session,
24
+ UploadOptions,
17
25
  Version,
18
- Package,
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();
@@ -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 { userModule } from './user-module';
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,6 +1,6 @@
1
+ import fs from 'fs-extra';
1
2
  import os from 'os';
2
3
  import path from 'path';
3
- import fs from 'fs-extra';
4
4
  import Table from 'tty-table';
5
5
  import { doDelete, getAllPackages, post, uploadFile } from './api';
6
6
  import { getPlatform, getSelectedApp } from './app';
@@ -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\/[^\/]+?.app\/info.plist$/i;
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
  };
package/src/utils/git.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from 'fs';
2
- import path from 'path';
3
2
  import git from 'isomorphic-git';
3
+ import path from 'path';
4
4
 
5
5
  export interface CommitInfo {
6
6
  hash: string;
@@ -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 { type Entry as YauzlEntry, open as openZipFile } from 'yauzl';
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;
@@ -7,6 +7,7 @@ export type ZipEntryOptions = {
7
7
  };
8
8
 
9
9
  export const ZIP_ENTRY_SNIFF_BYTES = 64;
10
+ export const MANIFEST_COMPRESSION_THRESHOLD_BYTES = 256;
10
11
 
11
12
  const alreadyCompressedExtensions = new Set([
12
13
  '.7z',
@@ -136,7 +137,10 @@ export function zipOptionsForPatchEntry(): ZipEntryOptions {
136
137
  return { compress: false };
137
138
  }
138
139
 
139
- export function zipOptionsForManifestEntry(): ZipEntryOptions {
140
+ export function zipOptionsForManifestEntry(byteLength = 0): ZipEntryOptions {
141
+ if (byteLength >= MANIFEST_COMPRESSION_THRESHOLD_BYTES) {
142
+ return { compressionLevel: 9 };
143
+ }
140
144
  return { compress: false };
141
145
  }
142
146
 
package/src/versions.ts CHANGED
@@ -1,15 +1,14 @@
1
- import { doDelete, get, getAllPackages, post, put, uploadFile } from './api';
2
- import { question, saveToLocal } from './utils';
3
- import { t } from './utils/i18n';
4
-
5
1
  import chalk from 'chalk';
6
2
  import { satisfies } from 'compare-versions';
7
3
  import Table from 'tty-table';
4
+ import { doDelete, get, getAllPackages, post, put, uploadFile } from './api';
8
5
  import { getPlatform, getSelectedApp } from './app';
9
6
  import { choosePackage } from './package';
10
7
  import type { Package, Platform, Version } from './types';
8
+ import { question, saveToLocal } from './utils';
11
9
  import { depVersions } from './utils/dep-versions';
12
10
  import { getCommitInfo } from './utils/git';
11
+ import { t } from './utils/i18n';
13
12
 
14
13
  interface VersionCommandOptions {
15
14
  appId?: string;
@@ -496,7 +495,7 @@ export const versionCommands = {
496
495
  let minPkgVersion = options.minPackageVersion;
497
496
  let maxPkgVersion = options.maxPackageVersion;
498
497
  let packageVersionRange = options.packageVersionRange;
499
- let rollout: number | undefined = undefined;
498
+ let rollout: number | undefined;
500
499
 
501
500
  if (options.rollout !== undefined) {
502
501
  rollout = Number.parseInt(options.rollout, 10);
@@ -604,11 +603,7 @@ export const versionCommands = {
604
603
  await put(`/app/${String(appId)}/version/${versionId}`, updateParams);
605
604
  console.log(t('operationSuccess'));
606
605
  },
607
- deleteVersion: async ({
608
- options,
609
- }: {
610
- options: VersionCommandOptions;
611
- }) => {
606
+ deleteVersion: async ({ options }: { options: VersionCommandOptions }) => {
612
607
  let appId = options.appId;
613
608
  if (!appId) {
614
609
  const platform = await getPlatform(options.platform);