react-native-update-cli 1.11.0 → 1.13.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/api.js CHANGED
@@ -17,7 +17,7 @@ var _utils = require('./utils');
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
 
19
19
  const fetch = require('node-fetch');
20
- const defaultEndpoint = 'http://u.reactnative.cn/api';
20
+ const defaultEndpoint = 'https://update.reactnative.cn/api';
21
21
  let host = process.env.PUSHY_REGISTRY || defaultEndpoint;
22
22
  const fs = require('fs');
23
23
 
package/lib/bundle.js CHANGED
@@ -26,6 +26,7 @@ const path = require('path');
26
26
  const { spawn, spawnSync } = require('child_process');
27
27
  const g2js = require('gradle-to-js/lib/parser');
28
28
  const os = require('os');
29
+ const properties = require('properties');
29
30
 
30
31
  var bsdiff, hdiff, diff;
31
32
  try {
@@ -81,7 +82,26 @@ async function runReactNativeBundleCommand(bundleName, development, entryFile, o
81
82
  if (exitCode) {
82
83
  reject(new Error(`"react-native bundle" command exited with code ${exitCode}.`));
83
84
  } else {
84
- if (platform === 'android' && gradleConfig.enableHermes || platform === 'ios' && fs.existsSync('ios/Pods/hermes-engine')) {
85
+ let hermesEnabled = false;
86
+
87
+ if (platform === 'android') {
88
+ const gradlePropeties = await new Promise(resolve => {
89
+ properties.parse('./android/gradle.properties', { path: true }, function (error, props) {
90
+ if (error) {
91
+ console.error(error);
92
+ resolve(null);
93
+ }
94
+
95
+ resolve(props);
96
+ });
97
+ });
98
+ hermesEnabled = gradlePropeties.hermesEnabled;
99
+
100
+ if (typeof hermesEnabled !== 'boolean') hermesEnabled = gradleConfig.enableHermes;
101
+ } else if (platform === 'ios' && fs.existsSync('ios/Pods/hermes-engine')) {
102
+ hermesEnabled = true;
103
+ }
104
+ if (hermesEnabled) {
85
105
  await compileHermesByteCode(bundleName, outputFolder, sourcemapOutput);
86
106
  }
87
107
  resolve(null);
package/lib/package.js CHANGED
@@ -74,7 +74,7 @@ const commands = exports.commands = {
74
74
  } = await (0, _utils.getIpaInfo)(fn);
75
75
  const { appId, appKey } = await (0, _app.getSelectedApp)('ios');
76
76
 
77
- if (appIdInPkg && appIdInPkg !== appId) {
77
+ if (appIdInPkg && appIdInPkg != appId) {
78
78
  throw new Error(`appId不匹配!当前ipa: ${appIdInPkg}, 当前update.json: ${appId}`);
79
79
  }
80
80
 
@@ -105,7 +105,7 @@ const commands = exports.commands = {
105
105
  } = await (0, _utils.getApkInfo)(fn);
106
106
  const { appId, appKey } = await (0, _app.getSelectedApp)('android');
107
107
 
108
- if (appIdInPkg && appIdInPkg !== appId) {
108
+ if (appIdInPkg && appIdInPkg != appId) {
109
109
  throw new Error(`appId不匹配!当前apk: ${appIdInPkg}, 当前update.json: ${appId}`);
110
110
  }
111
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Command tools for javaScript updater with `pushy` service for react native apps.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -39,6 +39,7 @@
39
39
  "gradle-to-js": "^2.0.1",
40
40
  "node-fetch": "^2.6.1",
41
41
  "progress": "^2.0.3",
42
+ "properties": "^1.2.1",
42
43
  "read": "^1.0.7",
43
44
  "request": "^2.88.2",
44
45
  "tcp-ping": "^0.1.1",
package/src/api.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const fetch = require('node-fetch');
2
- const defaultEndpoint = 'http://u.reactnative.cn/api';
2
+ const defaultEndpoint = 'https://update.reactnative.cn/api';
3
3
  let host = process.env.PUSHY_REGISTRY || defaultEndpoint;
4
4
  const fs = require('fs');
5
5
  import request from 'request';
package/src/bundle.js CHANGED
@@ -8,6 +8,7 @@ import { checkPlatform } from './app';
8
8
  const { spawn, spawnSync } = require('child_process');
9
9
  const g2js = require('gradle-to-js/lib/parser');
10
10
  const os = require('os');
11
+ const properties = require('properties');
11
12
 
12
13
  var bsdiff, hdiff, diff;
13
14
  try {
@@ -94,10 +95,34 @@ async function runReactNativeBundleCommand(
94
95
  ),
95
96
  );
96
97
  } else {
97
- if (
98
- (platform === 'android' && gradleConfig.enableHermes) ||
99
- (platform === 'ios' && fs.existsSync('ios/Pods/hermes-engine'))
98
+ let hermesEnabled = false;
99
+
100
+ if (platform === 'android') {
101
+ const gradlePropeties = await new Promise((resolve) => {
102
+ properties.parse(
103
+ './android/gradle.properties',
104
+ { path: true },
105
+ function (error, props) {
106
+ if (error) {
107
+ console.error(error);
108
+ resolve(null);
109
+ }
110
+
111
+ resolve(props);
112
+ },
113
+ );
114
+ });
115
+ hermesEnabled = gradlePropeties.hermesEnabled;
116
+
117
+ if (typeof hermesEnabled !== 'boolean')
118
+ hermesEnabled = gradleConfig.enableHermes;
119
+ } else if (
120
+ platform === 'ios' &&
121
+ fs.existsSync('ios/Pods/hermes-engine')
100
122
  ) {
123
+ hermesEnabled = true;
124
+ }
125
+ if (hermesEnabled) {
101
126
  await compileHermesByteCode(
102
127
  bundleName,
103
128
  outputFolder,
package/src/package.js CHANGED
@@ -65,7 +65,7 @@ export const commands = {
65
65
  } = await getIpaInfo(fn);
66
66
  const { appId, appKey } = await getSelectedApp('ios');
67
67
 
68
- if (appIdInPkg && appIdInPkg !== appId) {
68
+ if (appIdInPkg && appIdInPkg != appId) {
69
69
  throw new Error(
70
70
  `appId不匹配!当前ipa: ${appIdInPkg}, 当前update.json: ${appId}`,
71
71
  );
@@ -100,7 +100,7 @@ export const commands = {
100
100
  } = await getApkInfo(fn);
101
101
  const { appId, appKey } = await getSelectedApp('android');
102
102
 
103
- if (appIdInPkg && appIdInPkg !== appId) {
103
+ if (appIdInPkg && appIdInPkg != appId) {
104
104
  throw new Error(
105
105
  `appId不匹配!当前apk: ${appIdInPkg}, 当前update.json: ${appId}`,
106
106
  );