react-native-update-cli 1.27.0 → 1.29.0

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
@@ -68,6 +68,7 @@ async function runReactNativeBundleCommand(bundleName, development, entryFile, o
68
68
  let cliPath = require.resolve('react-native/local-cli/cli.js', {
69
69
  paths: [process.cwd()]
70
70
  });
71
+ let usingExpo = false;
71
72
  try {
72
73
  require.resolve('expo-router', {
73
74
  paths: [process.cwd()]
@@ -78,8 +79,9 @@ async function runReactNativeBundleCommand(bundleName, development, entryFile, o
78
79
  cliPath = require.resolve('@expo/cli', {
79
80
  paths: [process.cwd()]
80
81
  });
82
+ usingExpo = true;
81
83
  } catch (e) {}
82
- const bundleCommand = cliPath.includes('@expo/cli') ? 'export:embed' : 'bundle';
84
+ const bundleCommand = usingExpo ? 'export:embed' : 'bundle';
83
85
 
84
86
  Array.prototype.push.apply(reactNativeBundleArgs, [cliPath, bundleCommand, '--assets-dest', outputFolder, '--bundle-output', _path2.default.join(outputFolder, bundleName), '--dev', development, '--entry-file', entryFile, '--platform', platform, '--reset-cache']);
85
87
 
package/lib/index.js CHANGED
@@ -33,8 +33,8 @@ const commands = _extends({}, require('./user').commands, require('./bundle').co
33
33
  });
34
34
 
35
35
  function run() {
36
+ (0, _index.printVersionCommand)();
36
37
  if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
37
- (0, _index.printVersionCommand)();
38
38
  process.exit();
39
39
  }
40
40
 
@@ -35,6 +35,10 @@ var _appInfoParser = require('./app-info-parser');
35
35
 
36
36
  var _appInfoParser2 = _interopRequireDefault(_appInfoParser);
37
37
 
38
+ var _lt = require('semver/functions/lt');
39
+
40
+ var _lt2 = _interopRequireDefault(_lt);
41
+
38
42
  var _read = require('read');
39
43
 
40
44
  var _read2 = _interopRequireDefault(_read);
@@ -102,7 +106,7 @@ async function getApkInfo(fn) {
102
106
  }
103
107
  }
104
108
  if (buildTime == 0) {
105
- throw new Error('无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。');
109
+ throw new Error('无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。');
106
110
  }
107
111
  return _extends({ versionName, buildTime }, appCredential);
108
112
  }
@@ -125,7 +129,7 @@ async function getIpaInfo(fn) {
125
129
  buildTimeTxtBuffer = await appInfoParser.parser.getEntry(/payload\/.+?\.app\/frameworks\/react_native_update.framework\/pushy_build_time.txt/);
126
130
  }
127
131
  if (!buildTimeTxtBuffer) {
128
- throw new Error('无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。');
132
+ throw new Error('无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。');
129
133
  }
130
134
  const buildTime = buildTimeTxtBuffer.toString().replace('\n', '');
131
135
  return _extends({ versionName, buildTime }, appCredential);
@@ -142,14 +146,24 @@ function saveToLocal(originPath, destName) {
142
146
 
143
147
  function printVersionCommand() {
144
148
  console.log('react-native-update-cli: ' + _package2.default.version);
149
+ let pushyVersion = '';
145
150
  try {
146
151
  const PACKAGE_JSON_PATH = require.resolve('react-native-update/package.json', {
147
152
  paths: [process.cwd()]
148
153
  });
149
- console.log('react-native-update: ' + require(PACKAGE_JSON_PATH).version);
154
+ pushyVersion = require(PACKAGE_JSON_PATH).version;
155
+ console.log('react-native-update: ' + pushyVersion);
150
156
  } catch (e) {
151
157
  console.log('react-native-update: 无法获取版本号,请在项目目录中运行命令');
152
158
  }
159
+ if (pushyVersion) {
160
+ if ((0, _lt2.default)(pushyVersion, '8.5.1')) {
161
+ console.warn('当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8');
162
+ }
163
+ if ((0, _lt2.default)(pushyVersion, '9.2.1')) {
164
+ console.warn('当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动): npm i react-native-update@9');
165
+ }
166
+ }
153
167
  }
154
168
 
155
169
  const pricingPageUrl = exports.pricingPageUrl = 'https://pushy.reactnative.cn/pricing.html';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "1.27.0",
3
+ "version": "1.29.0",
4
4
  "description": "Command tools for javaScript updater with `pushy` service for react native apps.",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/bundle.js CHANGED
@@ -54,6 +54,7 @@ async function runReactNativeBundleCommand(
54
54
  let cliPath = require.resolve('react-native/local-cli/cli.js', {
55
55
  paths: [process.cwd()],
56
56
  });
57
+ let usingExpo = false;
57
58
  try {
58
59
  require.resolve('expo-router', {
59
60
  paths: [process.cwd()],
@@ -64,10 +65,9 @@ async function runReactNativeBundleCommand(
64
65
  cliPath = require.resolve('@expo/cli', {
65
66
  paths: [process.cwd()],
66
67
  });
68
+ usingExpo = true;
67
69
  } catch (e) {}
68
- const bundleCommand = cliPath.includes('@expo/cli')
69
- ? 'export:embed'
70
- : 'bundle';
70
+ const bundleCommand = usingExpo ? 'export:embed' : 'bundle';
71
71
 
72
72
  Array.prototype.push.apply(reactNativeBundleArgs, [
73
73
  cliPath,
@@ -204,7 +204,7 @@ async function compileHermesByteCode(
204
204
  }
205
205
 
206
206
  const hermesCommand = `${hermesPath}/hermesc`;
207
-
207
+
208
208
  const args = [
209
209
  '-emit-binary',
210
210
  '-out',
package/src/index.js CHANGED
@@ -28,8 +28,8 @@ const commands = {
28
28
  };
29
29
 
30
30
  function run() {
31
+ printVersionCommand();
31
32
  if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
32
- printVersionCommand();
33
33
  process.exit();
34
34
  }
35
35
 
@@ -3,6 +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 semverLt from 'semver/functions/lt';
6
7
 
7
8
  import read from 'read';
8
9
 
@@ -83,7 +84,7 @@ export async function getApkInfo(fn) {
83
84
  }
84
85
  if (buildTime == 0) {
85
86
  throw new Error(
86
- '无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
87
+ '无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
87
88
  );
88
89
  }
89
90
  return { versionName, buildTime, ...appCredential };
@@ -119,7 +120,7 @@ export async function getIpaInfo(fn) {
119
120
  }
120
121
  if (!buildTimeTxtBuffer) {
121
122
  throw new Error(
122
- '无法获取此包的编译时间戳。请更新react-native-update到最新版本后重新打包上传。',
123
+ '无法获取此包的编译时间戳。请更新 react-native-update 到最新版本后重新打包上传。',
123
124
  );
124
125
  }
125
126
  const buildTime = buildTimeTxtBuffer.toString().replace('\n', '');
@@ -137,6 +138,7 @@ export function saveToLocal(originPath, destName) {
137
138
 
138
139
  export function printVersionCommand() {
139
140
  console.log('react-native-update-cli: ' + pkg.version);
141
+ let pushyVersion = '';
140
142
  try {
141
143
  const PACKAGE_JSON_PATH = require.resolve(
142
144
  'react-native-update/package.json',
@@ -144,10 +146,23 @@ export function printVersionCommand() {
144
146
  paths: [process.cwd()],
145
147
  },
146
148
  );
147
- console.log('react-native-update: ' + require(PACKAGE_JSON_PATH).version);
149
+ pushyVersion = require(PACKAGE_JSON_PATH).version;
150
+ console.log('react-native-update: ' + pushyVersion);
148
151
  } catch (e) {
149
152
  console.log('react-native-update: 无法获取版本号,请在项目目录中运行命令');
150
153
  }
154
+ if (pushyVersion) {
155
+ if (semverLt(pushyVersion, '8.5.1')) {
156
+ console.warn(
157
+ '当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8',
158
+ );
159
+ }
160
+ if (semverLt(pushyVersion, '9.2.1')) {
161
+ console.warn(
162
+ '当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动): npm i react-native-update@9',
163
+ );
164
+ }
165
+ }
151
166
  }
152
167
 
153
168
  export const pricingPageUrl = 'https://pushy.reactnative.cn/pricing.html';