react-native-update-cli 1.45.1 → 1.45.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bundle.js CHANGED
@@ -26,7 +26,7 @@ const _yazl = require("yazl");
26
26
  const _yauzl = require("yauzl");
27
27
  const _app = require("./app");
28
28
  const _child_process = require("child_process");
29
- const _satisfies = /*#__PURE__*/ _interop_require_default(require("semver/functions/satisfies"));
29
+ const _compareversions = require("compare-versions");
30
30
  const _os = /*#__PURE__*/ _interop_require_default(require("os"));
31
31
  const _depversions = require("./utils/dep-versions");
32
32
  const _i18n = require("./utils/i18n");
@@ -120,7 +120,7 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
120
120
  ]
121
121
  })).toString()).version;
122
122
  // expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
123
- if ((0, _satisfies.default)(expoCliVersion, '>= 0.10.17')) {
123
+ if ((0, _compareversions.satisfies)(expoCliVersion, '>= 0.10.17')) {
124
124
  usingExpo = true;
125
125
  } else {
126
126
  cliPath = undefined;
@@ -39,7 +39,7 @@ const _os = /*#__PURE__*/ _interop_require_default(require("os"));
39
39
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
40
40
  const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
41
41
  const _appinfoparser = /*#__PURE__*/ _interop_require_default(require("./app-info-parser"));
42
- const _satisfies = /*#__PURE__*/ _interop_require_default(require("semver/functions/satisfies"));
42
+ const _compareversions = require("compare-versions");
43
43
  const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
44
44
  const _latestversion = /*#__PURE__*/ _interop_require_default(require("../utils/latest-version"));
45
45
  const _checkplugin = require("./check-plugin");
@@ -201,18 +201,18 @@ async function printVersionCommand() {
201
201
  })}` : '';
202
202
  console.log(`react-native-update: ${rnuVersion}${latestRnuVersion}`);
203
203
  if (_constants.IS_CRESC) {
204
- if ((0, _satisfies.default)(rnuVersion, '<10.27.0')) {
204
+ if ((0, _compareversions.satisfies)(rnuVersion, '<10.27.0')) {
205
205
  console.error('Unsupported version, please update to the latest version: npm i react-native-update@latest');
206
206
  process.exit(1);
207
207
  }
208
208
  } else {
209
- if ((0, _satisfies.default)(rnuVersion, '<8.5.2')) {
209
+ if ((0, _compareversions.satisfies)(rnuVersion, '<8.5.2')) {
210
210
  console.warn(`当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8 .
211
211
  如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`);
212
- } else if ((0, _satisfies.default)(rnuVersion, '9.0.0 - 9.2.1')) {
212
+ } else if ((0, _compareversions.satisfies)(rnuVersion, '9.0.0 - 9.2.1')) {
213
213
  console.warn(`当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动,可直接热更): npm i react-native-update@9 .
214
214
  如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`);
215
- } else if ((0, _satisfies.default)(rnuVersion, '10.0.0 - 10.17.0')) {
215
+ } else if ((0, _compareversions.satisfies)(rnuVersion, '10.0.0 - 10.17.0')) {
216
216
  console.warn('当前版本已不再支持,请升级到 v10 的最新小版本(代码无需改动,可直接热更): npm i react-native-update@10');
217
217
  }
218
218
  }
package/lib/versions.js CHANGED
@@ -23,12 +23,7 @@ const _app = require("./app");
23
23
  const _package = require("./package");
24
24
  const _depversions = require("./utils/dep-versions");
25
25
  const _git = require("./utils/git");
26
- const _satisfies = /*#__PURE__*/ _interop_require_default(require("semver/functions/satisfies"));
27
- function _interop_require_default(obj) {
28
- return obj && obj.__esModule ? obj : {
29
- default: obj
30
- };
31
- }
26
+ const _compareversions = require("compare-versions");
32
27
  async function showVersion(appId, offset) {
33
28
  const { data, count } = await (0, _api.get)(`/app/${appId}/version/list`);
34
29
  console.log((0, _i18n.t)('offset', {
@@ -202,7 +197,7 @@ const commands = {
202
197
  let pkgsToBind = [];
203
198
  if (minPkgVersion) {
204
199
  minPkgVersion = String(minPkgVersion).trim();
205
- pkgsToBind = allPkgs.filter((pkg)=>(0, _satisfies.default)(pkg.name, `>=${minPkgVersion}`));
200
+ pkgsToBind = allPkgs.filter((pkg)=>(0, _compareversions.satisfies)(pkg.name, `>=${minPkgVersion}`));
206
201
  if (pkgsToBind.length === 0) {
207
202
  throw new Error((0, _i18n.t)('nativeVersionNotFoundGte', {
208
203
  version: minPkgVersion
@@ -210,7 +205,7 @@ const commands = {
210
205
  }
211
206
  } else if (maxPkgVersion) {
212
207
  maxPkgVersion = String(maxPkgVersion).trim();
213
- pkgsToBind = allPkgs.filter((pkg)=>(0, _satisfies.default)(pkg.name, `<=${maxPkgVersion}`));
208
+ pkgsToBind = allPkgs.filter((pkg)=>(0, _compareversions.satisfies)(pkg.name, `<=${maxPkgVersion}`));
214
209
  if (pkgsToBind.length === 0) {
215
210
  throw new Error((0, _i18n.t)('nativeVersionNotFoundLte', {
216
211
  version: maxPkgVersion
@@ -230,7 +225,7 @@ const commands = {
230
225
  }
231
226
  } else if (semverRange) {
232
227
  semverRange = semverRange.trim();
233
- pkgsToBind = allPkgs.filter((pkg)=>(0, _satisfies.default)(pkg.name, semverRange));
228
+ pkgsToBind = allPkgs.filter((pkg)=>(0, _compareversions.satisfies)(pkg.name, semverRange));
234
229
  if (pkgsToBind.length === 0) {
235
230
  throw new Error((0, _i18n.t)('nativeVersionNotFoundMatch', {
236
231
  version: semverRange
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "1.45.1",
3
+ "version": "1.45.2",
4
4
  "description": "command line tool for react-native-update (remote updates for react native)",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -42,6 +42,7 @@
42
42
  "chalk": "4",
43
43
  "cli-arguments": "^0.2.1",
44
44
  "commander": "^13",
45
+ "compare-versions": "^6.1.1",
45
46
  "filesize-parser": "^1.5.1",
46
47
  "form-data": "^4.0.2",
47
48
  "fs-extra": "8",
package/src/bundle.ts CHANGED
@@ -8,9 +8,9 @@ import {
8
8
  type ZipFile as YauzlZipFile,
9
9
  } from 'yauzl';
10
10
  import { question, checkPlugins } from './utils';
11
- import { checkPlatform, getPlatform } from './app';
11
+ import { getPlatform } from './app';
12
12
  import { spawn, spawnSync } from 'child_process';
13
- import semverSatisfies from 'semver/functions/satisfies';
13
+ import { satisfies } from 'compare-versions';
14
14
  const g2js = require('gradle-to-js/lib/parser');
15
15
  import os from 'os';
16
16
  const properties = require('properties');
@@ -101,7 +101,7 @@ async function runReactNativeBundleCommand({
101
101
  .toString(),
102
102
  ).version;
103
103
  // expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
104
- if (semverSatisfies(expoCliVersion, '>= 0.10.17')) {
104
+ if (satisfies(expoCliVersion, '>= 0.10.17')) {
105
105
  usingExpo = true;
106
106
  } else {
107
107
  cliPath = undefined;
@@ -3,7 +3,7 @@ import os from 'os';
3
3
  import path from 'path';
4
4
  import pkg from '../../package.json';
5
5
  import AppInfoParser from './app-info-parser';
6
- import semverSatisfies from 'semver/functions/satisfies';
6
+ import { satisfies } from 'compare-versions';
7
7
  import chalk from 'chalk';
8
8
  import latestVersion from '../utils/latest-version';
9
9
  import { checkPlugins } from './check-plugin';
@@ -189,24 +189,24 @@ export async function printVersionCommand() {
189
189
  : '';
190
190
  console.log(`react-native-update: ${rnuVersion}${latestRnuVersion}`);
191
191
  if (IS_CRESC) {
192
- if (semverSatisfies(rnuVersion, '<10.27.0')) {
192
+ if (satisfies(rnuVersion, '<10.27.0')) {
193
193
  console.error(
194
194
  'Unsupported version, please update to the latest version: npm i react-native-update@latest',
195
195
  );
196
196
  process.exit(1);
197
197
  }
198
198
  } else {
199
- if (semverSatisfies(rnuVersion, '<8.5.2')) {
199
+ if (satisfies(rnuVersion, '<8.5.2')) {
200
200
  console.warn(
201
201
  `当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8 .
202
202
  如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
203
203
  );
204
- } else if (semverSatisfies(rnuVersion, '9.0.0 - 9.2.1')) {
204
+ } else if (satisfies(rnuVersion, '9.0.0 - 9.2.1')) {
205
205
  console.warn(
206
206
  `当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动,可直接热更): npm i react-native-update@9 .
207
207
  如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
208
208
  );
209
- } else if (semverSatisfies(rnuVersion, '10.0.0 - 10.17.0')) {
209
+ } else if (satisfies(rnuVersion, '10.0.0 - 10.17.0')) {
210
210
  console.warn(
211
211
  '当前版本已不再支持,请升级到 v10 的最新小版本(代码无需改动,可直接热更): npm i react-native-update@10',
212
212
  );
package/src/versions.ts CHANGED
@@ -7,7 +7,7 @@ import { choosePackage } from './package';
7
7
  import { depVersions } from './utils/dep-versions';
8
8
  import { getCommitInfo } from './utils/git';
9
9
  import type { Package, Platform, Version } from 'types';
10
- import semverSatisfies from 'semver/functions/satisfies';
10
+ import { satisfies } from 'compare-versions';
11
11
 
12
12
  interface CommandOptions {
13
13
  name?: string;
@@ -170,7 +170,8 @@ export const commands = {
170
170
  const { id } = await post(`/app/${appId}/version/create`, {
171
171
  name: versionName,
172
172
  hash,
173
- description: description || (await question(t('versionDescriptionQuestion'))),
173
+ description:
174
+ description || (await question(t('versionDescriptionQuestion'))),
174
175
  metaInfo: metaInfo || (await question(t('versionMetaInfoQuestion'))),
175
176
  deps: depVersions,
176
177
  commit: await getCommitInfo(),
@@ -233,7 +234,7 @@ export const commands = {
233
234
  if (minPkgVersion) {
234
235
  minPkgVersion = String(minPkgVersion).trim();
235
236
  pkgsToBind = allPkgs.filter((pkg: Package) =>
236
- semverSatisfies(pkg.name, `>=${minPkgVersion}`),
237
+ satisfies(pkg.name, `>=${minPkgVersion}`),
237
238
  );
238
239
  if (pkgsToBind.length === 0) {
239
240
  throw new Error(
@@ -243,7 +244,7 @@ export const commands = {
243
244
  } else if (maxPkgVersion) {
244
245
  maxPkgVersion = String(maxPkgVersion).trim();
245
246
  pkgsToBind = allPkgs.filter((pkg: Package) =>
246
- semverSatisfies(pkg.name, `<=${maxPkgVersion}`),
247
+ satisfies(pkg.name, `<=${maxPkgVersion}`),
247
248
  );
248
249
  if (pkgsToBind.length === 0) {
249
250
  throw new Error(
@@ -263,7 +264,7 @@ export const commands = {
263
264
  } else if (semverRange) {
264
265
  semverRange = semverRange.trim();
265
266
  pkgsToBind = allPkgs.filter((pkg: Package) =>
266
- semverSatisfies(pkg.name, semverRange!),
267
+ satisfies(pkg.name, semverRange!),
267
268
  );
268
269
  if (pkgsToBind.length === 0) {
269
270
  throw new Error(