get version from apk/ipa file.
This commit is contained in:
parent
fef8e35884
commit
ae628b310a
@ -4,6 +4,8 @@
|
||||
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import ApkReader from 'node-apk-parser';
|
||||
import ipaMetadata from 'ipa-metadata';
|
||||
|
||||
var read = require('read');
|
||||
|
||||
@ -40,4 +42,18 @@ export function getRNVersion() {
|
||||
major: match[1] | 0,
|
||||
minor: match[2] | 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function getApkVersion(fn) {
|
||||
const reader = ApkReader.readFile(fn);
|
||||
const manifest = reader.readManifestSync();
|
||||
return Promise.resolve(manifest.versionName);
|
||||
}
|
||||
|
||||
export function getIPAVersion(fn) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipaMetadata(fn, (err, data) => {
|
||||
err ? reject(err) : resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -29,8 +29,10 @@
|
||||
"dependencies": {
|
||||
"cli-arguments": "^0.2.1",
|
||||
"fs-promise": "^0.4.1",
|
||||
"ipa-metadata": "^1.4.0",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"mkdir-recursive": "^0.2.1",
|
||||
"node-apk-parser": "^0.2.3",
|
||||
"node-bsdiff": "^0.1.2",
|
||||
"read": "^1.0.7",
|
||||
"yauzl": "^2.4.1",
|
||||
|
Loading…
Reference in New Issue
Block a user