mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-11-08 18:25:48 +08:00
warn version
This commit is contained in:
@@ -28,8 +28,8 @@ const commands = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
|
||||||
printVersionCommand();
|
printVersionCommand();
|
||||||
|
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import os from 'os';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import pkg from '../../package.json';
|
import pkg from '../../package.json';
|
||||||
import AppInfoParser from './app-info-parser';
|
import AppInfoParser from './app-info-parser';
|
||||||
|
import semverLt from 'semver/functions/lt';
|
||||||
|
|
||||||
import read from 'read';
|
import read from 'read';
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ export async function getApkInfo(fn) {
|
|||||||
}
|
}
|
||||||
if (buildTime == 0) {
|
if (buildTime == 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
|
'无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return { versionName, buildTime, ...appCredential };
|
return { versionName, buildTime, ...appCredential };
|
||||||
@@ -119,7 +120,7 @@ export async function getIpaInfo(fn) {
|
|||||||
}
|
}
|
||||||
if (!buildTimeTxtBuffer) {
|
if (!buildTimeTxtBuffer) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
|
'无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const buildTime = buildTimeTxtBuffer.toString().replace('\n', '');
|
const buildTime = buildTimeTxtBuffer.toString().replace('\n', '');
|
||||||
@@ -137,6 +138,7 @@ export function saveToLocal(originPath, destName) {
|
|||||||
|
|
||||||
export function printVersionCommand() {
|
export function printVersionCommand() {
|
||||||
console.log('react-native-update-cli: ' + pkg.version);
|
console.log('react-native-update-cli: ' + pkg.version);
|
||||||
|
let pushyVersion = '';
|
||||||
try {
|
try {
|
||||||
const PACKAGE_JSON_PATH = require.resolve(
|
const PACKAGE_JSON_PATH = require.resolve(
|
||||||
'react-native-update/package.json',
|
'react-native-update/package.json',
|
||||||
@@ -144,10 +146,23 @@ export function printVersionCommand() {
|
|||||||
paths: [process.cwd()],
|
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) {
|
} catch (e) {
|
||||||
console.log('react-native-update: 无法获取版本号,请在项目目录中运行命令');
|
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';
|
export const pricingPageUrl = 'https://pushy.reactnative.cn/pricing.html';
|
||||||
|
|||||||
Reference in New Issue
Block a user