1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 09:41:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

检查bundle文件

This commit is contained in:
sunnylqm
2020-03-20 15:51:35 +08:00
parent a9dea5c188
commit 84facadf3d

View File

@@ -56,6 +56,12 @@ export function getRNVersion() {
export async function getApkInfo(fn) {
const appInfoParser = new AppInfoParser(fn);
const bundleFile = await appInfoParser.parser.getEntry(
/assets\/index.android.bundle/,
);
if (!bundleFile) {
throw new Error('找不到bundle文件。请确保此apk为release版本且bundle文件名为默认的index.android.bundle');
}
const { versionName, application } = await appInfoParser.parse();
let buildTime = 0;
if (Array.isArray(application.metaData)) {
@@ -73,6 +79,12 @@ export async function getApkInfo(fn) {
export async function getIpaInfo(fn) {
const appInfoParser = new AppInfoParser(fn);
const bundleFile = await appInfoParser.parser.getEntry(
/payload\/.+?\.app\/main.jsbundle/,
);
if (!bundleFile) {
throw new Error('找不到bundle文件。请确保此ipa为release版本且bundle文件名为默认的main.jsbundle');
}
const {
CFBundleShortVersionString: versionName,
} = await appInfoParser.parse();