react-native-update-cli 2.30.0 → 2.30.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.d.ts +2 -1
- package/lib/bundle.js +8 -1
- package/lib/locales/en.d.ts +1 -0
- package/lib/locales/en.js +1 -0
- package/lib/locales/zh.d.ts +1 -0
- package/lib/locales/zh.js +1 -0
- package/lib/provider.js +2 -1
- package/lib/utils/index.d.ts +4 -3
- package/lib/utils/index.js +27 -12
- package/package.json +1 -1
package/lib/bundle.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ type NormalizedBundleOptions = {
|
|
|
8
8
|
taro: boolean;
|
|
9
9
|
expo: boolean;
|
|
10
10
|
rncli: boolean;
|
|
11
|
-
|
|
11
|
+
/** undefined = platform default (harmony compiles Hermes, others detect) */
|
|
12
|
+
hermes?: boolean;
|
|
12
13
|
hermesBase: string;
|
|
13
14
|
verifyHermesBase: boolean;
|
|
14
15
|
resetCache: boolean;
|
package/lib/bundle.js
CHANGED
|
@@ -55,7 +55,14 @@ function normalizeBundleOptions(translatedOptions, platform) {
|
|
|
55
55
|
taro: (0, options_1.getBooleanOption)(translatedOptions, 'taro', false),
|
|
56
56
|
expo: (0, options_1.getBooleanOption)(translatedOptions, 'expo', false),
|
|
57
57
|
rncli: (0, options_1.getBooleanOption)(translatedOptions, 'rncli', false),
|
|
58
|
-
|
|
58
|
+
// Keep "not given" distinct from false: harmony compiles Hermes unless
|
|
59
|
+
// the user opts out with `--no-hermes`, see
|
|
60
|
+
// runReactNativeBundleCommand.
|
|
61
|
+
hermes: isClearedFlag(translatedOptions, 'hermes')
|
|
62
|
+
? false
|
|
63
|
+
: translatedOptions.hermes === undefined
|
|
64
|
+
? undefined
|
|
65
|
+
: (0, options_1.getBooleanOption)(translatedOptions, 'hermes', false),
|
|
59
66
|
hermesBase: (0, options_1.getStringOption)(translatedOptions, 'hermesBase', 'auto'),
|
|
60
67
|
verifyHermesBase: (0, options_1.getBooleanOption)(translatedOptions, 'verifyHermesBase', true),
|
|
61
68
|
resetCache: (0, options_1.getBooleanOption)(translatedOptions, 'resetCache', true),
|
package/lib/locales/en.d.ts
CHANGED
package/lib/locales/en.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.default = {
|
|
|
25
25
|
autoUpdateSuccess: 'CLI was automatically updated in the background: {{from}} -> {{to}}',
|
|
26
26
|
apkUploadSuccess: 'Successfully uploaded APK native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
|
27
27
|
boundTo: ', bound to: {{name}} ({{id}})',
|
|
28
|
+
buildTimeIsDebug: 'The build timestamp of this package is 0, which means it is a debug build. Please build it in release mode and upload again.',
|
|
28
29
|
buildTimeNotFound: 'Cannot get the build timestamp of this package. Please update `react-native-update` to the latest version and re-package and upload.',
|
|
29
30
|
bundleCommandError: '"react-native bundle" command exited with code {{code}}.',
|
|
30
31
|
bundleNotFound: 'Bundle file not found. Please ensure that this {{packageType}} is a release version and the bundle file name is the default `{{entryFile}}`',
|
package/lib/locales/zh.d.ts
CHANGED
package/lib/locales/zh.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.default = {
|
|
|
25
25
|
autoUpdateSuccess: 'CLI 已在后台自动更新:{{from}} -> {{to}}',
|
|
26
26
|
apkUploadSuccess: '已成功上传apk原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
|
27
27
|
boundTo: ', 已绑定:{{name}} ({{id}})',
|
|
28
|
+
buildTimeIsDebug: '此包的编译时间戳为 0,说明它是 debug 构建。请用 release 构建打包后再上传。',
|
|
28
29
|
buildTimeNotFound: '无法获取此包的编译时间戳。请更新 `react-native-update` 到最新版本后重新打包上传。',
|
|
29
30
|
bundleCommandError: '"react-native bundle" 命令退出,代码为 {{code}}。',
|
|
30
31
|
bundleNotFound: '找不到 bundle 文件。请确保此 {{packageType}} 为 release 版本,且 bundle 文件名为默认的 `{{entryFile}}`',
|
package/lib/provider.js
CHANGED
|
@@ -87,7 +87,8 @@ class CLIProviderImpl {
|
|
|
87
87
|
taro: options.taro || false,
|
|
88
88
|
expo: options.expo || false,
|
|
89
89
|
rncli: options.rncli || false,
|
|
90
|
-
|
|
90
|
+
// omitted when unset: a present-but-undefined key reads as --no-hermes
|
|
91
|
+
...(options.hermes !== undefined && { hermes: options.hermes }),
|
|
91
92
|
hermesBase: options.hermesBase || 'auto',
|
|
92
93
|
verifyHermesBase: options.verifyHermesBase ?? true,
|
|
93
94
|
resetCache: options.resetCache ?? true,
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -39,9 +39,10 @@ export interface VersionCheck {
|
|
|
39
39
|
* network.
|
|
40
40
|
*
|
|
41
41
|
* With `wait: true` (the `-v`/`version` command) the registry is queried
|
|
42
|
-
* first and the latest versions are printed inline. Otherwise
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* first and the latest versions are printed inline. Otherwise a fresh cached
|
|
43
|
+
* answer is printed inline too; without one the registry check runs in the
|
|
44
|
+
* background and the returned `printHints` shows what is newer once the
|
|
45
|
+
* command is done — the command itself is never delayed by it.
|
|
45
46
|
*/
|
|
46
47
|
export declare function printVersionCommand({ wait, }?: {
|
|
47
48
|
wait?: boolean;
|
package/lib/utils/index.js
CHANGED
|
@@ -91,9 +91,17 @@ function requireBundle(bundleFile, packageType, entryFile) {
|
|
|
91
91
|
}
|
|
92
92
|
return bundleFile;
|
|
93
93
|
}
|
|
94
|
+
// Android and Harmony stamp debug builds with "0" on purpose (a debug rebuild
|
|
95
|
+
// must not look like a new binary), so a present-but-zero value means a debug
|
|
96
|
+
// package, not an outdated react-native-update.
|
|
94
97
|
function requireBuildTime(value) {
|
|
95
|
-
const buildTime =
|
|
96
|
-
|
|
98
|
+
const buildTime = value === undefined || value === null || value === ''
|
|
99
|
+
? Number.NaN
|
|
100
|
+
: Number(value);
|
|
101
|
+
if (buildTime === 0) {
|
|
102
|
+
throw new Error((0, i18n_1.t)('buildTimeIsDebug'));
|
|
103
|
+
}
|
|
104
|
+
if (!Number.isFinite(buildTime)) {
|
|
97
105
|
throw new Error((0, i18n_1.t)('buildTimeNotFound'));
|
|
98
106
|
}
|
|
99
107
|
return buildTime;
|
|
@@ -201,7 +209,7 @@ async function getAabInfo(fn) {
|
|
|
201
209
|
versionName = attr.value;
|
|
202
210
|
}
|
|
203
211
|
}
|
|
204
|
-
let buildTime
|
|
212
|
+
let buildTime;
|
|
205
213
|
const appCredential = {};
|
|
206
214
|
// Find application node
|
|
207
215
|
const applicationNode = manifestElement.child.find((child) => child.element?.name === 'application');
|
|
@@ -237,13 +245,10 @@ async function getAabInfo(fn) {
|
|
|
237
245
|
value = resolvedValue;
|
|
238
246
|
}
|
|
239
247
|
}
|
|
240
|
-
buildTime =
|
|
248
|
+
buildTime = value;
|
|
241
249
|
}
|
|
242
250
|
}
|
|
243
251
|
}
|
|
244
|
-
if (!Number.isFinite(buildTime) || buildTime === 0) {
|
|
245
|
-
throw new Error((0, i18n_1.t)('buildTimeNotFound'));
|
|
246
|
-
}
|
|
247
252
|
// The JS bundle lives in the base module; these are the same bytes the
|
|
248
253
|
// extracted APK carries (extractApk copies entries verbatim), so the hash
|
|
249
254
|
// matches what uploadAab ends up registering via getApkInfo. Lenient on
|
|
@@ -258,7 +263,7 @@ async function getAabInfo(fn) {
|
|
|
258
263
|
}
|
|
259
264
|
return {
|
|
260
265
|
versionName,
|
|
261
|
-
buildTime,
|
|
266
|
+
buildTime: requireBuildTime(buildTime),
|
|
262
267
|
...(bundleHash ? { bundleHash } : {}),
|
|
263
268
|
...appCredential,
|
|
264
269
|
};
|
|
@@ -355,9 +360,10 @@ function latestTag(version) {
|
|
|
355
360
|
* network.
|
|
356
361
|
*
|
|
357
362
|
* With `wait: true` (the `-v`/`version` command) the registry is queried
|
|
358
|
-
* first and the latest versions are printed inline. Otherwise
|
|
359
|
-
*
|
|
360
|
-
*
|
|
363
|
+
* first and the latest versions are printed inline. Otherwise a fresh cached
|
|
364
|
+
* answer is printed inline too; without one the registry check runs in the
|
|
365
|
+
* background and the returned `printHints` shows what is newer once the
|
|
366
|
+
* command is done — the command itself is never delayed by it.
|
|
361
367
|
*/
|
|
362
368
|
async function printVersionCommand({ wait = true, } = {}) {
|
|
363
369
|
// one dependency, not the whole map: this runs before every command
|
|
@@ -369,6 +375,15 @@ async function printVersionCommand({ wait = true, } = {}) {
|
|
|
369
375
|
if (wait) {
|
|
370
376
|
await check;
|
|
371
377
|
}
|
|
378
|
+
else {
|
|
379
|
+
// A fresh cache answers synchronously (only promise ticks), so yield one
|
|
380
|
+
// macrotask: on a cache hit the latest versions go on the startup lines
|
|
381
|
+
// and no second hint is printed at the end; a cold cache never waits here.
|
|
382
|
+
await Promise.race([
|
|
383
|
+
check,
|
|
384
|
+
new Promise((resolve) => setImmediate(resolve)),
|
|
385
|
+
]);
|
|
386
|
+
}
|
|
372
387
|
const [latestCliVersion, latestRnuVersion] = latest ?? [];
|
|
373
388
|
console.log(`react-native-update-cli: ${package_json_1.default.version}${latestTag(latestCliVersion)}`);
|
|
374
389
|
try {
|
|
@@ -414,7 +429,7 @@ async function printVersionCommand({ wait = true, } = {}) {
|
|
|
414
429
|
else {
|
|
415
430
|
console.log((0, i18n_1.t)('rnuVersionNotFound'));
|
|
416
431
|
}
|
|
417
|
-
let hinted =
|
|
432
|
+
let hinted = latest !== undefined; // inline tags already shown
|
|
418
433
|
const printHints = () => {
|
|
419
434
|
if (hinted || !latest) {
|
|
420
435
|
return;
|
package/package.json
CHANGED