mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-11-07 01:43:39 +08:00
fix version compare
This commit is contained in:
@@ -8,9 +8,9 @@ import {
|
||||
type ZipFile as YauzlZipFile,
|
||||
} from 'yauzl';
|
||||
import { question, checkPlugins } from './utils';
|
||||
import { checkPlatform, getPlatform } from './app';
|
||||
import { getPlatform } from './app';
|
||||
import { spawn, spawnSync } from 'child_process';
|
||||
import semverSatisfies from 'semver/functions/satisfies';
|
||||
import { satisfies } from 'compare-versions';
|
||||
const g2js = require('gradle-to-js/lib/parser');
|
||||
import os from 'os';
|
||||
const properties = require('properties');
|
||||
@@ -101,7 +101,7 @@ async function runReactNativeBundleCommand({
|
||||
.toString(),
|
||||
).version;
|
||||
// expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
|
||||
if (semverSatisfies(expoCliVersion, '>= 0.10.17')) {
|
||||
if (satisfies(expoCliVersion, '>= 0.10.17')) {
|
||||
usingExpo = true;
|
||||
} else {
|
||||
cliPath = undefined;
|
||||
|
||||
@@ -3,7 +3,7 @@ import os from 'os';
|
||||
import path from 'path';
|
||||
import pkg from '../../package.json';
|
||||
import AppInfoParser from './app-info-parser';
|
||||
import semverSatisfies from 'semver/functions/satisfies';
|
||||
import { satisfies } from 'compare-versions';
|
||||
import chalk from 'chalk';
|
||||
import latestVersion from '../utils/latest-version';
|
||||
import { checkPlugins } from './check-plugin';
|
||||
@@ -189,24 +189,24 @@ export async function printVersionCommand() {
|
||||
: '';
|
||||
console.log(`react-native-update: ${rnuVersion}${latestRnuVersion}`);
|
||||
if (IS_CRESC) {
|
||||
if (semverSatisfies(rnuVersion, '<10.27.0')) {
|
||||
if (satisfies(rnuVersion, '<10.27.0')) {
|
||||
console.error(
|
||||
'Unsupported version, please update to the latest version: npm i react-native-update@latest',
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
if (semverSatisfies(rnuVersion, '<8.5.2')) {
|
||||
if (satisfies(rnuVersion, '<8.5.2')) {
|
||||
console.warn(
|
||||
`当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8 .
|
||||
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
||||
);
|
||||
} else if (semverSatisfies(rnuVersion, '9.0.0 - 9.2.1')) {
|
||||
} else if (satisfies(rnuVersion, '9.0.0 - 9.2.1')) {
|
||||
console.warn(
|
||||
`当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动,可直接热更): npm i react-native-update@9 .
|
||||
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
||||
);
|
||||
} else if (semverSatisfies(rnuVersion, '10.0.0 - 10.17.0')) {
|
||||
} else if (satisfies(rnuVersion, '10.0.0 - 10.17.0')) {
|
||||
console.warn(
|
||||
'当前版本已不再支持,请升级到 v10 的最新小版本(代码无需改动,可直接热更): npm i react-native-update@10',
|
||||
);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { choosePackage } from './package';
|
||||
import { depVersions } from './utils/dep-versions';
|
||||
import { getCommitInfo } from './utils/git';
|
||||
import type { Package, Platform, Version } from 'types';
|
||||
import semverSatisfies from 'semver/functions/satisfies';
|
||||
import { satisfies } from 'compare-versions';
|
||||
|
||||
interface CommandOptions {
|
||||
name?: string;
|
||||
@@ -170,7 +170,8 @@ export const commands = {
|
||||
const { id } = await post(`/app/${appId}/version/create`, {
|
||||
name: versionName,
|
||||
hash,
|
||||
description: description || (await question(t('versionDescriptionQuestion'))),
|
||||
description:
|
||||
description || (await question(t('versionDescriptionQuestion'))),
|
||||
metaInfo: metaInfo || (await question(t('versionMetaInfoQuestion'))),
|
||||
deps: depVersions,
|
||||
commit: await getCommitInfo(),
|
||||
@@ -233,7 +234,7 @@ export const commands = {
|
||||
if (minPkgVersion) {
|
||||
minPkgVersion = String(minPkgVersion).trim();
|
||||
pkgsToBind = allPkgs.filter((pkg: Package) =>
|
||||
semverSatisfies(pkg.name, `>=${minPkgVersion}`),
|
||||
satisfies(pkg.name, `>=${minPkgVersion}`),
|
||||
);
|
||||
if (pkgsToBind.length === 0) {
|
||||
throw new Error(
|
||||
@@ -243,7 +244,7 @@ export const commands = {
|
||||
} else if (maxPkgVersion) {
|
||||
maxPkgVersion = String(maxPkgVersion).trim();
|
||||
pkgsToBind = allPkgs.filter((pkg: Package) =>
|
||||
semverSatisfies(pkg.name, `<=${maxPkgVersion}`),
|
||||
satisfies(pkg.name, `<=${maxPkgVersion}`),
|
||||
);
|
||||
if (pkgsToBind.length === 0) {
|
||||
throw new Error(
|
||||
@@ -263,7 +264,7 @@ export const commands = {
|
||||
} else if (semverRange) {
|
||||
semverRange = semverRange.trim();
|
||||
pkgsToBind = allPkgs.filter((pkg: Package) =>
|
||||
semverSatisfies(pkg.name, semverRange!),
|
||||
satisfies(pkg.name, semverRange!),
|
||||
);
|
||||
if (pkgsToBind.length === 0) {
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user