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

warn version

This commit is contained in:
sunnylqm
2024-09-22 17:44:31 +08:00
parent 5302c8968f
commit d3ee908227
2 changed files with 19 additions and 4 deletions

View File

@@ -28,8 +28,8 @@ const commands = {
};
function run() {
printVersionCommand();
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
printVersionCommand();
process.exit();
}

View File

@@ -3,6 +3,7 @@ import os from 'os';
import path from 'path';
import pkg from '../../package.json';
import AppInfoParser from './app-info-parser';
import semverLt from 'semver/functions/lt';
import read from 'read';
@@ -83,7 +84,7 @@ export async function getApkInfo(fn) {
}
if (buildTime == 0) {
throw new Error(
'无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
'无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
);
}
return { versionName, buildTime, ...appCredential };
@@ -119,7 +120,7 @@ export async function getIpaInfo(fn) {
}
if (!buildTimeTxtBuffer) {
throw new Error(
'无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
'无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
);
}
const buildTime = buildTimeTxtBuffer.toString().replace('\n', '');
@@ -137,6 +138,7 @@ export function saveToLocal(originPath, destName) {
export function printVersionCommand() {
console.log('react-native-update-cli: ' + pkg.version);
let pushyVersion = '';
try {
const PACKAGE_JSON_PATH = require.resolve(
'react-native-update/package.json',
@@ -144,10 +146,23 @@ export function printVersionCommand() {
paths: [process.cwd()],
},
);
console.log('react-native-update: ' + require(PACKAGE_JSON_PATH).version);
pushyVersion = require(PACKAGE_JSON_PATH).version;
console.log('react-native-update: ' + pushyVersion);
} catch (e) {
console.log('react-native-update: 无法获取版本号,请在项目目录中运行命令');
}
if (pushyVersion) {
if (semverLt(pushyVersion, '8.5.1')) {
console.warn(
'当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8',
);
}
if (semverLt(pushyVersion, '9.2.1')) {
console.warn(
'当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动): npm i react-native-update@9',
);
}
}
}
export const pricingPageUrl = 'https://pushy.reactnative.cn/pricing.html';