mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-16 09:41:38 +08:00
检查bundle文件
This commit is contained in:
@@ -56,6 +56,12 @@ export function getRNVersion() {
|
|||||||
|
|
||||||
export async function getApkInfo(fn) {
|
export async function getApkInfo(fn) {
|
||||||
const appInfoParser = new AppInfoParser(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();
|
const { versionName, application } = await appInfoParser.parse();
|
||||||
let buildTime = 0;
|
let buildTime = 0;
|
||||||
if (Array.isArray(application.metaData)) {
|
if (Array.isArray(application.metaData)) {
|
||||||
@@ -73,6 +79,12 @@ export async function getApkInfo(fn) {
|
|||||||
|
|
||||||
export async function getIpaInfo(fn) {
|
export async function getIpaInfo(fn) {
|
||||||
const appInfoParser = new AppInfoParser(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 {
|
const {
|
||||||
CFBundleShortVersionString: versionName,
|
CFBundleShortVersionString: versionName,
|
||||||
} = await appInfoParser.parse();
|
} = await appInfoParser.parse();
|
||||||
|
Reference in New Issue
Block a user