react-native-update-cli 2.8.5 → 2.9.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/api.d.ts +18 -0
- package/lib/app.d.ts +38 -0
- package/lib/app.js +5 -4
- package/lib/bundle-pack.d.ts +1 -0
- package/lib/bundle-pack.js +104 -0
- package/lib/bundle-runner.d.ts +20 -0
- package/lib/bundle-runner.js +404 -0
- package/lib/bundle.d.ts +6 -0
- package/lib/bundle.js +73 -471
- package/lib/diff.d.ts +13 -0
- package/lib/diff.js +144 -123
- package/lib/exports.d.ts +12 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +5 -13
- package/lib/install.d.ts +4 -0
- package/lib/locales/en.d.ts +137 -0
- package/lib/locales/zh.d.ts +136 -0
- package/lib/module-manager.d.ts +20 -0
- package/lib/module-manager.js +3 -9
- package/lib/modules/app-module.d.ts +2 -0
- package/lib/modules/app-module.js +84 -44
- package/lib/modules/bundle-module.d.ts +2 -0
- package/lib/modules/bundle-module.js +7 -8
- package/lib/modules/index.d.ts +6 -0
- package/lib/modules/package-module.d.ts +2 -0
- package/lib/modules/user-module.d.ts +2 -0
- package/lib/modules/user-module.js +55 -44
- package/lib/modules/version-module.d.ts +2 -0
- package/lib/package.d.ts +58 -0
- package/lib/package.js +103 -139
- package/lib/provider.d.ts +26 -0
- package/lib/provider.js +115 -217
- package/lib/types.d.ts +120 -0
- package/lib/user.d.ts +8 -0
- package/lib/utils/add-gitignore.d.ts +1 -0
- package/lib/utils/app-info-parser/aab.d.ts +22 -0
- package/lib/utils/app-info-parser/aab.js +0 -4
- package/lib/utils/app-info-parser/apk.d.ts +14 -0
- package/lib/utils/app-info-parser/apk.js +6 -4
- package/lib/utils/app-info-parser/app.d.ts +4 -0
- package/lib/utils/app-info-parser/app.js +3 -0
- package/lib/utils/app-info-parser/index.d.ts +16 -0
- package/lib/utils/app-info-parser/index.js +2 -0
- package/lib/utils/app-info-parser/ipa.d.ts +14 -0
- package/lib/utils/app-info-parser/ipa.js +1 -1
- package/lib/utils/app-info-parser/resource-finder.d.ts +49 -0
- package/lib/utils/app-info-parser/utils.d.ts +31 -0
- package/lib/utils/app-info-parser/utils.js +1 -0
- package/lib/utils/app-info-parser/xml-parser/binary.d.ts +56 -0
- package/lib/utils/app-info-parser/xml-parser/manifest.d.ts +10 -0
- package/lib/utils/app-info-parser/zip.d.ts +18 -0
- package/lib/utils/app-info-parser/zip.js +7 -9
- package/lib/utils/check-lockfile.d.ts +1 -0
- package/lib/utils/check-plugin.d.ts +7 -0
- package/lib/utils/command-result.d.ts +3 -0
- package/lib/utils/command-result.js +35 -0
- package/lib/utils/constants.d.ts +9 -0
- package/lib/utils/dep-versions.d.ts +1 -0
- package/lib/utils/git.d.ts +8 -0
- package/lib/utils/http-helper.d.ts +4 -0
- package/lib/utils/i18n.d.ts +12 -0
- package/lib/utils/index.d.ts +22 -0
- package/lib/utils/index.js +52 -22
- package/lib/utils/latest-version/cli.d.ts +1 -0
- package/lib/utils/latest-version/cli.js +24 -60
- package/lib/utils/latest-version/index.d.ts +146 -0
- package/lib/utils/latest-version/index.js +22 -22
- package/lib/utils/options.d.ts +4 -0
- package/lib/utils/options.js +63 -0
- package/lib/utils/plugin-config.d.ts +9 -0
- package/lib/utils/zip-entries.d.ts +3 -0
- package/lib/versions.d.ts +43 -0
- package/lib/workflow-runner.d.ts +2 -0
- package/lib/workflow-runner.js +25 -0
- package/package.json +20 -5
- package/src/api.ts +1 -1
- package/src/app.ts +20 -11
- package/src/bundle-pack.ts +51 -0
- package/src/bundle-runner.ts +463 -0
- package/src/bundle.ts +184 -571
- package/src/diff.ts +208 -174
- package/src/index.ts +15 -17
- package/src/module-manager.ts +15 -15
- package/src/modules/app-module.ts +120 -48
- package/src/modules/bundle-module.ts +21 -11
- package/src/modules/package-module.ts +0 -1
- package/src/modules/user-module.ts +117 -58
- package/src/package.ts +158 -138
- package/src/provider.ts +164 -240
- package/src/types.ts +13 -8
- package/src/utils/app-info-parser/aab.ts +0 -7
- package/src/utils/app-info-parser/apk.ts +9 -6
- package/src/utils/app-info-parser/app.ts +5 -1
- package/src/utils/app-info-parser/index.ts +11 -6
- package/src/utils/app-info-parser/ipa.ts +1 -1
- package/src/utils/app-info-parser/utils.ts +3 -0
- package/src/utils/app-info-parser/xml-parser/manifest.ts +3 -1
- package/src/utils/app-info-parser/zip.ts +12 -14
- package/src/utils/command-result.ts +24 -0
- package/src/utils/index.ts +138 -39
- package/src/utils/latest-version/cli.ts +22 -20
- package/src/utils/latest-version/index.ts +20 -20
- package/src/utils/options.ts +56 -0
- package/src/utils/zip-entries.ts +1 -1
- package/src/workflow-runner.ts +24 -0
- package/index.js +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AabParser } from './aab';
|
|
2
|
+
import { ApkParser } from './apk';
|
|
3
|
+
import { AppParser } from './app';
|
|
4
|
+
import { IpaParser } from './ipa';
|
|
5
|
+
type AppInfoInnerParser = AabParser | ApkParser | AppParser | IpaParser;
|
|
6
|
+
declare class AppInfoParser {
|
|
7
|
+
file: string | File;
|
|
8
|
+
parser: AppInfoInnerParser;
|
|
9
|
+
/**
|
|
10
|
+
* parser for parsing .ipa or .apk file
|
|
11
|
+
* @param {String | File} file // file's path in Node, instance of File in Browser
|
|
12
|
+
*/
|
|
13
|
+
constructor(file: string | File);
|
|
14
|
+
parse<T = unknown>(): Promise<T>;
|
|
15
|
+
}
|
|
16
|
+
export default AppInfoParser;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Zip } from './zip';
|
|
2
|
+
export declare class IpaParser extends Zip {
|
|
3
|
+
parse(): Promise<any>;
|
|
4
|
+
/**
|
|
5
|
+
* Parse plist
|
|
6
|
+
* @param {Buffer} buffer // plist file's buffer
|
|
7
|
+
*/
|
|
8
|
+
private _parsePlist;
|
|
9
|
+
/**
|
|
10
|
+
* parse provision
|
|
11
|
+
* @param {Buffer} buffer // provision file's buffer
|
|
12
|
+
*/
|
|
13
|
+
private _parseProvision;
|
|
14
|
+
}
|
|
@@ -55,7 +55,7 @@ class IpaParser extends _zip.Zip {
|
|
|
55
55
|
*/ _parsePlist(buffer) {
|
|
56
56
|
let result;
|
|
57
57
|
const bufferType = buffer[0];
|
|
58
|
-
if (bufferType === 60 || bufferType ===
|
|
58
|
+
if (bufferType === 60 || bufferType === 239) {
|
|
59
59
|
result = parsePlist(buffer.toString());
|
|
60
60
|
} else if (bufferType === 98) {
|
|
61
61
|
result = parseBplist(buffer)[0];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code translated from a C# project https://github.com/hylander0/Iteedee.ApkReader/blob/master/Iteedee.ApkReader/ApkResourceFinder.cs
|
|
3
|
+
*
|
|
4
|
+
* Decode binary file `resources.arsc` from a .apk file to a JavaScript Object.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ResourceFinder {
|
|
7
|
+
private valueStringPool;
|
|
8
|
+
private typeStringPool;
|
|
9
|
+
private keyStringPool;
|
|
10
|
+
private packageId;
|
|
11
|
+
private responseMap;
|
|
12
|
+
private entryMap;
|
|
13
|
+
/**
|
|
14
|
+
* Same to C# BinaryReader.readBytes
|
|
15
|
+
*
|
|
16
|
+
* @param bb ByteBuffer
|
|
17
|
+
* @param len length
|
|
18
|
+
* @returns {Buffer}
|
|
19
|
+
*/
|
|
20
|
+
static readBytes(bb: any, len: number): any;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {ByteBuffer} bb
|
|
24
|
+
* @return {Map<String, Set<String>>}
|
|
25
|
+
*/
|
|
26
|
+
processResourceTable(resourceBuffer: Buffer): Record<string, any[]>;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param {ByteBuffer} bb
|
|
30
|
+
*/
|
|
31
|
+
private processPackage;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param {ByteBuffer} bb
|
|
35
|
+
*/
|
|
36
|
+
private processType;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param {ByteBuffer} bb
|
|
40
|
+
* @return {Array}
|
|
41
|
+
*/
|
|
42
|
+
private processStringPool;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param {ByteBuffer} bb
|
|
46
|
+
*/
|
|
47
|
+
private processTypeSpec;
|
|
48
|
+
private putIntoMap;
|
|
49
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare const isArray: (value: unknown) => value is unknown[];
|
|
2
|
+
declare const isObject: (value: unknown) => value is Record<string, unknown>;
|
|
3
|
+
declare const isPrimitive: (value: unknown) => boolean;
|
|
4
|
+
declare const isBrowser: () => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* map file place with resourceMap
|
|
7
|
+
* @param {Object} apkInfo // json info parsed from .apk file
|
|
8
|
+
* @param {Object} resourceMap // resourceMap
|
|
9
|
+
*/
|
|
10
|
+
declare const mapInfoResource: (apkInfo: Record<string, any>, resourceMap: Record<string, any>) => Record<string, any>;
|
|
11
|
+
/**
|
|
12
|
+
* find .apk file's icon path from json info
|
|
13
|
+
* @param info // json info parsed from .apk file
|
|
14
|
+
*/
|
|
15
|
+
declare const findApkIconPath: (info: any) => string;
|
|
16
|
+
/**
|
|
17
|
+
* find .ipa file's icon path from json info
|
|
18
|
+
* @param info // json info parsed from .ipa file
|
|
19
|
+
*/
|
|
20
|
+
declare const findIpaIconPath: (info: any) => any;
|
|
21
|
+
/**
|
|
22
|
+
* transform buffer to base64
|
|
23
|
+
* @param {Buffer} buffer
|
|
24
|
+
*/
|
|
25
|
+
declare const getBase64FromBuffer: (buffer: Buffer | string) => string;
|
|
26
|
+
/**
|
|
27
|
+
* 去除unicode空字符
|
|
28
|
+
* @param {String} str
|
|
29
|
+
*/
|
|
30
|
+
declare const decodeNullUnicode: (value: string | RegExp) => string | RegExp;
|
|
31
|
+
export { isArray, isObject, isPrimitive, isBrowser, mapInfoResource, findApkIconPath, findIpaIconPath, getBase64FromBuffer, decodeNullUnicode, };
|
|
@@ -46,6 +46,7 @@ const isPrimitive = (value)=>value === null || [
|
|
|
46
46
|
'string',
|
|
47
47
|
'undefined'
|
|
48
48
|
].includes(objectType(value));
|
|
49
|
+
const isBrowser = ()=>typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
49
50
|
/**
|
|
50
51
|
* map file place with resourceMap
|
|
51
52
|
* @param {Object} apkInfo // json info parsed from .apk file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
type BinaryXmlParserOptions = {
|
|
2
|
+
debug?: boolean;
|
|
3
|
+
};
|
|
4
|
+
export declare class BinaryXmlParser {
|
|
5
|
+
buffer: Buffer;
|
|
6
|
+
cursor: number;
|
|
7
|
+
strings: string[];
|
|
8
|
+
resources: number[];
|
|
9
|
+
document: any;
|
|
10
|
+
parent: any;
|
|
11
|
+
stack: any[];
|
|
12
|
+
debug: boolean;
|
|
13
|
+
constructor(buffer: Buffer, options?: BinaryXmlParserOptions);
|
|
14
|
+
readU8(): number;
|
|
15
|
+
readU16(): number;
|
|
16
|
+
readS32(): number;
|
|
17
|
+
readU32(): number;
|
|
18
|
+
readLength8(): number;
|
|
19
|
+
readLength16(): number;
|
|
20
|
+
readDimension(): {
|
|
21
|
+
value: number | null;
|
|
22
|
+
unit: string | null;
|
|
23
|
+
rawUnit: number | null;
|
|
24
|
+
};
|
|
25
|
+
readFraction(): {
|
|
26
|
+
value: number | null;
|
|
27
|
+
type: string | null;
|
|
28
|
+
rawType: number | null;
|
|
29
|
+
};
|
|
30
|
+
readHex24(): string;
|
|
31
|
+
readHex32(): string;
|
|
32
|
+
readTypedValue(): {
|
|
33
|
+
value: any;
|
|
34
|
+
type: string | null;
|
|
35
|
+
rawType: number | null;
|
|
36
|
+
};
|
|
37
|
+
convertIntToFloat(int: number): number;
|
|
38
|
+
readString(encoding: string): string;
|
|
39
|
+
readChunkHeader(): {
|
|
40
|
+
startOffset: number;
|
|
41
|
+
chunkType: number;
|
|
42
|
+
headerSize: number;
|
|
43
|
+
chunkSize: number;
|
|
44
|
+
};
|
|
45
|
+
readStringPool(header: any): null;
|
|
46
|
+
readResourceMap(header: any): null;
|
|
47
|
+
readXmlNamespaceStart(): null;
|
|
48
|
+
readXmlNamespaceEnd(): null;
|
|
49
|
+
readXmlElementStart(): any;
|
|
50
|
+
readXmlAttribute(): any;
|
|
51
|
+
readXmlElementEnd(): null;
|
|
52
|
+
readXmlCData(): any;
|
|
53
|
+
readNull(header: any): null;
|
|
54
|
+
parse(): any;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class ManifestParser {
|
|
2
|
+
private buffer;
|
|
3
|
+
private xmlParser;
|
|
4
|
+
constructor(buffer: Buffer, options?: Record<string, any>);
|
|
5
|
+
private collapseAttributes;
|
|
6
|
+
private parseIntents;
|
|
7
|
+
private parseApplication;
|
|
8
|
+
private isLauncherActivity;
|
|
9
|
+
parse(): Record<string, any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class Zip {
|
|
2
|
+
file: string | File;
|
|
3
|
+
unzip: any;
|
|
4
|
+
constructor(file: string | File);
|
|
5
|
+
/**
|
|
6
|
+
* get entries by regexps, the return format is: { <filename>: <Buffer|Blob> }
|
|
7
|
+
* @param {Array} regexps // regexps for matching files
|
|
8
|
+
* @param {String} type // return type, can be buffer or blob, default buffer
|
|
9
|
+
*/
|
|
10
|
+
getEntries(regexps: Array<RegExp | string>, type?: 'buffer' | 'blob'): Promise<Record<string, Buffer<ArrayBufferLike> | Blob>>;
|
|
11
|
+
/**
|
|
12
|
+
* get entry by regex, return an instance of Buffer or Blob
|
|
13
|
+
* @param {Regex} regex // regex for matching file
|
|
14
|
+
* @param {String} type // return type, can be buffer or blob, default buffer
|
|
15
|
+
*/
|
|
16
|
+
getEntry(regex: RegExp | string, type?: 'buffer' | 'blob'): Promise<Buffer<ArrayBufferLike> | Blob | undefined>;
|
|
17
|
+
getEntryFromHarmonyApp(regex: RegExp): Promise<Buffer | Blob | undefined>;
|
|
18
|
+
}
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "Zip", {
|
|
|
8
8
|
return Zip;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _utils = require("./utils");
|
|
12
11
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
12
|
+
const _utils = require("./utils");
|
|
13
13
|
const _zipentries = require("../zip-entries");
|
|
14
14
|
function _interop_require_default(obj) {
|
|
15
15
|
return obj && obj.__esModule ? obj : {
|
|
@@ -51,11 +51,12 @@ class Zip {
|
|
|
51
51
|
async getEntryFromHarmonyApp(regex) {
|
|
52
52
|
try {
|
|
53
53
|
let originSource;
|
|
54
|
-
|
|
54
|
+
if (typeof this.file !== 'string') {
|
|
55
|
+
throw new Error('Param error: [file] must be file path in Node.');
|
|
56
|
+
}
|
|
57
|
+
await (0, _zipentries.enumZipEntries)(this.file, async (entry, zipFile)=>{
|
|
55
58
|
if (regex.test(entry.fileName)) {
|
|
56
|
-
|
|
57
|
-
originSource = value;
|
|
58
|
-
});
|
|
59
|
+
originSource = await (0, _zipentries.readEntry)(entry, zipFile);
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
return originSource;
|
|
@@ -64,10 +65,7 @@ class Zip {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
constructor(file){
|
|
67
|
-
|
|
68
|
-
throw new Error('Param error: [file] must be file path in Node.');
|
|
69
|
-
}
|
|
70
|
-
this.file = _path.default.resolve(file);
|
|
68
|
+
this.file = typeof file === 'string' ? _path.default.resolve(file) : file;
|
|
71
69
|
this.unzip = new Unzip(this.file);
|
|
72
70
|
}
|
|
73
71
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkLockFiles(): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CommandResult } from '../types';
|
|
2
|
+
export declare function toErrorMessage(error: unknown, fallback: string): string;
|
|
3
|
+
export declare function runAsCommandResult<T>(task: () => Promise<T>, fallbackError: string, mapSuccess?: (result: T) => unknown): Promise<CommandResult>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
runAsCommandResult: function() {
|
|
13
|
+
return runAsCommandResult;
|
|
14
|
+
},
|
|
15
|
+
toErrorMessage: function() {
|
|
16
|
+
return toErrorMessage;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function toErrorMessage(error, fallback) {
|
|
20
|
+
return error instanceof Error ? error.message : fallback;
|
|
21
|
+
}
|
|
22
|
+
async function runAsCommandResult(task, fallbackError, mapSuccess) {
|
|
23
|
+
try {
|
|
24
|
+
const result = await task();
|
|
25
|
+
return {
|
|
26
|
+
success: true,
|
|
27
|
+
data: mapSuccess ? mapSuccess(result) : result
|
|
28
|
+
};
|
|
29
|
+
} catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
error: toErrorMessage(error, fallbackError)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const scriptName: "cresc" | "pushy";
|
|
2
|
+
export declare const IS_CRESC: boolean;
|
|
3
|
+
export declare const ppkBundleFileNames: string[];
|
|
4
|
+
export declare const isPPKBundleFileName: (fileName: string) => boolean;
|
|
5
|
+
export declare const credentialFile: string;
|
|
6
|
+
export declare const updateJson: string;
|
|
7
|
+
export declare const tempDir: string;
|
|
8
|
+
export declare const pricingPageUrl: string;
|
|
9
|
+
export declare const defaultEndpoints: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const depVersions: Record<string, string>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function promiseAny<T>(promises: Promise<T>[]): Promise<T>;
|
|
2
|
+
export declare const ping: (url: string) => Promise<string | null>;
|
|
3
|
+
export declare const testUrls: (urls?: string[]) => Promise<string | null>;
|
|
4
|
+
export declare const getBaseUrl: Promise<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import en from '../locales/en';
|
|
2
|
+
import zh from '../locales/zh';
|
|
3
|
+
declare module 'i18next' {
|
|
4
|
+
interface CustomTypeOptions {
|
|
5
|
+
defaultNS: 'en';
|
|
6
|
+
resources: {
|
|
7
|
+
en: typeof en;
|
|
8
|
+
zh: typeof zh;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare function t(key: string, options?: any): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { checkPlugins } from './check-plugin';
|
|
2
|
+
export declare function question(query: string, password?: boolean): Promise<string>;
|
|
3
|
+
export declare function translateOptions<T extends Record<string, unknown>>(options: T): T & Record<string, unknown>;
|
|
4
|
+
export declare function getApkInfo(fn: string): Promise<{
|
|
5
|
+
versionName: string;
|
|
6
|
+
buildTime: number;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function getAppInfo(fn: string): Promise<{
|
|
9
|
+
versionName: string | undefined;
|
|
10
|
+
buildTime: number;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function getIpaInfo(fn: string): Promise<{
|
|
13
|
+
versionName: string;
|
|
14
|
+
buildTime: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function getAabInfo(fn: string): Promise<{
|
|
17
|
+
versionName: string;
|
|
18
|
+
buildTime: number;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function saveToLocal(originPath: string, destName: string): void;
|
|
21
|
+
export declare function printVersionCommand(): Promise<void>;
|
|
22
|
+
export { checkPlugins };
|
package/lib/utils/index.js
CHANGED
|
@@ -42,6 +42,7 @@ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
|
42
42
|
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
43
43
|
const _compareversions = require("compare-versions");
|
|
44
44
|
const _fsextra = /*#__PURE__*/ _interop_require_default(require("fs-extra"));
|
|
45
|
+
const _yauzl = require("yauzl");
|
|
45
46
|
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
|
|
46
47
|
const _latestversion = /*#__PURE__*/ _interop_require_default(require("./latest-version"));
|
|
47
48
|
const _appinfoparser = /*#__PURE__*/ _interop_require_default(require("./app-info-parser"));
|
|
@@ -68,11 +69,18 @@ async function question(query, password) {
|
|
|
68
69
|
function translateOptions(options) {
|
|
69
70
|
const ret = {};
|
|
70
71
|
for(const key in options){
|
|
71
|
-
const
|
|
72
|
-
if (typeof
|
|
73
|
-
ret[key] =
|
|
72
|
+
const value = options[key];
|
|
73
|
+
if (typeof value === 'string') {
|
|
74
|
+
ret[key] = value.replace(/\$\{(\w+)\}/g, (placeholder, name)=>{
|
|
75
|
+
var _options_name;
|
|
76
|
+
const replacement = (_options_name = options[name]) != null ? _options_name : process.env[name];
|
|
77
|
+
if (typeof replacement === 'string' || typeof replacement === 'number' || typeof replacement === 'boolean') {
|
|
78
|
+
return String(replacement);
|
|
79
|
+
}
|
|
80
|
+
return placeholder;
|
|
81
|
+
});
|
|
74
82
|
} else {
|
|
75
|
-
ret[key] =
|
|
83
|
+
ret[key] = value;
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
return ret;
|
|
@@ -96,7 +104,12 @@ async function getApkInfo(fn) {
|
|
|
96
104
|
if (Array.isArray(application.metaData)) {
|
|
97
105
|
for (const meta of application.metaData){
|
|
98
106
|
if (meta.name === 'pushy_build_time') {
|
|
99
|
-
|
|
107
|
+
if (Array.isArray(meta.value)) {
|
|
108
|
+
const firstValue = meta.value[0];
|
|
109
|
+
buildTime = Number(firstValue);
|
|
110
|
+
} else if (meta.value !== undefined) {
|
|
111
|
+
buildTime = Number(meta.value);
|
|
112
|
+
}
|
|
100
113
|
}
|
|
101
114
|
}
|
|
102
115
|
}
|
|
@@ -131,7 +144,7 @@ async function getAppInfo(fn) {
|
|
|
131
144
|
const { versionName, pushy_build_time } = metaData;
|
|
132
145
|
let buildTime = 0;
|
|
133
146
|
if (pushy_build_time) {
|
|
134
|
-
buildTime = pushy_build_time;
|
|
147
|
+
buildTime = Number(pushy_build_time);
|
|
135
148
|
}
|
|
136
149
|
if (buildTime == 0) {
|
|
137
150
|
throw new Error((0, _i18n.t)('buildTimeNotFound'));
|
|
@@ -198,14 +211,25 @@ async function getAabInfo(fn) {
|
|
|
198
211
|
let buildTime = 0;
|
|
199
212
|
const appCredential = {};
|
|
200
213
|
// Find application node
|
|
201
|
-
const applicationNode = manifestElement.child.find((
|
|
202
|
-
|
|
203
|
-
|
|
214
|
+
const applicationNode = manifestElement.child.find((child)=>{
|
|
215
|
+
var _child_element;
|
|
216
|
+
return ((_child_element = child.element) == null ? void 0 : _child_element.name) === 'application';
|
|
217
|
+
});
|
|
218
|
+
const applicationElement = applicationNode == null ? void 0 : applicationNode.element;
|
|
219
|
+
if (applicationElement) {
|
|
220
|
+
const metaDataNodes = applicationElement.child.filter((child)=>{
|
|
221
|
+
var _child_element;
|
|
222
|
+
return ((_child_element = child.element) == null ? void 0 : _child_element.name) === 'meta-data';
|
|
223
|
+
});
|
|
204
224
|
for (const meta of metaDataNodes){
|
|
205
225
|
let name = '';
|
|
206
226
|
let value = '';
|
|
207
227
|
let resourceId = 0;
|
|
208
|
-
|
|
228
|
+
const metaElement = meta.element;
|
|
229
|
+
if (!metaElement) {
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
for (const attr of metaElement.attribute){
|
|
209
233
|
if (attr.name === 'name') {
|
|
210
234
|
name = attr.value;
|
|
211
235
|
}
|
|
@@ -240,19 +264,24 @@ async function getAabInfo(fn) {
|
|
|
240
264
|
};
|
|
241
265
|
}
|
|
242
266
|
async function readZipEntry(fn, entryName) {
|
|
243
|
-
const yauzl = require('yauzl');
|
|
244
267
|
return new Promise((resolve, reject)=>{
|
|
245
|
-
|
|
268
|
+
(0, _yauzl.open)(fn, {
|
|
246
269
|
lazyEntries: true
|
|
247
270
|
}, (err, zipfile)=>{
|
|
248
|
-
if (err
|
|
271
|
+
if (err || !zipfile) {
|
|
272
|
+
reject(err != null ? err : new Error('Failed to open zip file'));
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
249
275
|
let found = false;
|
|
250
276
|
zipfile.readEntry();
|
|
251
277
|
zipfile.on('entry', (entry)=>{
|
|
252
278
|
if (entry.fileName === entryName) {
|
|
253
279
|
found = true;
|
|
254
|
-
zipfile.openReadStream(entry, (
|
|
255
|
-
if (
|
|
280
|
+
zipfile.openReadStream(entry, (streamError, readStream)=>{
|
|
281
|
+
if (streamError || !readStream) {
|
|
282
|
+
reject(streamError != null ? streamError : new Error('Failed to read zip entry'));
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
256
285
|
const chunks = [];
|
|
257
286
|
readStream.on('data', (chunk)=>chunks.push(chunk));
|
|
258
287
|
readStream.on('end', ()=>resolve(Buffer.concat(chunks)));
|
|
@@ -285,20 +314,21 @@ async function resolveResource(fn, resourceId, root) {
|
|
|
285
314
|
arrays: true
|
|
286
315
|
});
|
|
287
316
|
// Find package
|
|
288
|
-
const pkg = object.package.find((
|
|
317
|
+
const pkg = object.package.find((pkgItem)=>pkgItem.packageId === pkgId);
|
|
289
318
|
if (!pkg) return null;
|
|
290
319
|
// Find type
|
|
291
|
-
const type = pkg.type.find((
|
|
320
|
+
const type = pkg.type.find((typeItem)=>typeItem.typeId === typeId);
|
|
292
321
|
if (!type) return null;
|
|
293
322
|
// Find entry
|
|
294
|
-
const entry = type.entry.find((
|
|
323
|
+
const entry = type.entry.find((entryItem)=>entryItem.entryId === entryId);
|
|
295
324
|
if (!entry) return null;
|
|
296
325
|
// Get value from configValue
|
|
297
326
|
if (entry.configValue && entry.configValue.length > 0) {
|
|
298
|
-
var _val_item;
|
|
299
|
-
const val = entry.configValue[0].value;
|
|
300
|
-
|
|
301
|
-
|
|
327
|
+
var _entry_configValue_, _val_item_str, _val_item;
|
|
328
|
+
const val = (_entry_configValue_ = entry.configValue[0]) == null ? void 0 : _entry_configValue_.value;
|
|
329
|
+
const stringValue = val == null ? void 0 : (_val_item = val.item) == null ? void 0 : (_val_item_str = _val_item.str) == null ? void 0 : _val_item_str.value;
|
|
330
|
+
if (typeof stringValue === 'string') {
|
|
331
|
+
return stringValue;
|
|
302
332
|
}
|
|
303
333
|
}
|
|
304
334
|
} catch (e) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|