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

fix version compare

This commit is contained in:
sunnylqm
2025-05-15 22:44:47 +08:00
parent bf0cea66b9
commit 18d772b1bc
5 changed files with 19 additions and 14 deletions

View File

@@ -10,6 +10,7 @@
"chalk": "4",
"cli-arguments": "^0.2.1",
"commander": "^13",
"compare-versions": "^6.1.1",
"filesize-parser": "^1.5.1",
"form-data": "^4.0.2",
"fs-extra": "8",
@@ -278,6 +279,8 @@
"commander": ["commander@13.1.0", "", {}, "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw=="],
"compare-versions": ["compare-versions@6.1.1", "", {}, "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg=="],
"config-chain": ["config-chain@1.1.13", "", { "dependencies": { "ini": "^1.3.4", "proto-list": "~1.2.1" } }, "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ=="],
"content-disposition": ["content-disposition@0.5.4", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ=="],

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update-cli",
"version": "1.45.1",
"version": "1.45.2",
"description": "command line tool for react-native-update (remote updates for react native)",
"main": "index.js",
"bin": {
@@ -42,6 +42,7 @@
"chalk": "4",
"cli-arguments": "^0.2.1",
"commander": "^13",
"compare-versions": "^6.1.1",
"filesize-parser": "^1.5.1",
"form-data": "^4.0.2",
"fs-extra": "8",

View File

@@ -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;

View File

@@ -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',
);

View File

@@ -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(