react-native-update-cli 1.30.2 → 1.30.4

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
@@ -103,7 +103,11 @@ async function query(url, options) {
103
103
  try {
104
104
  json = JSON.parse(text);
105
105
  } catch (e) {
106
- throw new Error(`Server error: ${text}`);
106
+ if (resp.statusText.includes('Unauthorized')) {
107
+ throw new Error('登录信息已过期,请使用 pushy login 命令重新登录');
108
+ } else {
109
+ throw new Error(`Server error: ${resp.statusText}`);
110
+ }
107
111
  }
108
112
 
109
113
  if (resp.status !== 200) {
@@ -195,7 +199,7 @@ async function uploadFile(fn, key) {
195
199
  return reject(err);
196
200
  }
197
201
  if (resp.statusCode > 299) {
198
- return reject(Object.assign(new Error(JSON.stringify(body)), {
202
+ return reject(Object.assign(new Error(body), {
199
203
  status: resp.statusCode
200
204
  }));
201
205
  }
@@ -158,9 +158,11 @@ function printVersionCommand() {
158
158
  }
159
159
  if (pushyVersion) {
160
160
  if ((0, _satisfies2.default)(pushyVersion, '<8.5.1')) {
161
- console.warn('当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8');
161
+ console.warn(`当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8 .
162
+ 如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`);
162
163
  } else if ((0, _satisfies2.default)(pushyVersion, '9.0.0 - 9.2.0')) {
163
- console.warn('当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动): npm i react-native-update@9');
164
+ console.warn(`当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动): npm i react-native-update@9 .
165
+ 如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`);
164
166
  }
165
167
  }
166
168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "1.30.2",
3
+ "version": "1.30.4",
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/api.js CHANGED
@@ -66,7 +66,11 @@ async function query(url, options) {
66
66
  try {
67
67
  json = JSON.parse(text);
68
68
  } catch (e) {
69
- throw new Error(`Server error: ${text}`);
69
+ if (resp.statusText.includes('Unauthorized')) {
70
+ throw new Error('登录信息已过期,请使用 pushy login 命令重新登录');
71
+ } else {
72
+ throw new Error(`Server error: ${resp.statusText}`);
73
+ }
70
74
  }
71
75
 
72
76
  if (resp.status !== 200) {
@@ -166,7 +170,7 @@ export async function uploadFile(fn, key) {
166
170
  }
167
171
  if (resp.statusCode > 299) {
168
172
  return reject(
169
- Object.assign(new Error(JSON.stringify(body)), {
173
+ Object.assign(new Error(body), {
170
174
  status: resp.statusCode,
171
175
  }),
172
176
  );
@@ -154,11 +154,13 @@ export function printVersionCommand() {
154
154
  if (pushyVersion) {
155
155
  if (semverSatisfies(pushyVersion, '<8.5.1')) {
156
156
  console.warn(
157
- '当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8',
157
+ `当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8 .
158
+ 如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
158
159
  );
159
160
  } else if (semverSatisfies(pushyVersion, '9.0.0 - 9.2.0')) {
160
161
  console.warn(
161
- '当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动): npm i react-native-update@9',
162
+ `当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动): npm i react-native-update@9 .
163
+ 如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
162
164
  );
163
165
  }
164
166
  }
package/src/.DS_Store DELETED
Binary file
Binary file