react-native-update-cli 1.44.1 → 1.44.3
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/cli.json +13 -1
- package/lib/bundle.js +37 -18
- package/lib/index.js +0 -1
- package/lib/locales/en.js +80 -61
- package/lib/locales/zh.js +79 -61
- package/lib/package.js +49 -18
- package/lib/utils/i18n.js +3 -0
- package/lib/utils/index.js +5 -6
- package/lib/versions.js +1 -1
- package/package.json +9 -6
- package/src/bundle.ts +74 -35
- package/src/index.ts +0 -1
- package/src/locales/en.ts +102 -72
- package/src/locales/zh.ts +96 -67
- package/src/package.ts +18 -35
- package/src/utils/i18n.ts +3 -0
- package/src/utils/index.ts +7 -10
- package/src/versions.ts +9 -7
package/lib/package.js
CHANGED
|
@@ -35,10 +35,10 @@ async function listPackage(appId) {
|
|
|
35
35
|
const { data } = await (0, _api.get)(`/app/${appId}/package/list?limit=1000`);
|
|
36
36
|
const header = [
|
|
37
37
|
{
|
|
38
|
-
value:
|
|
38
|
+
value: (0, _i18n.t)('nativePackageId')
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
value: '
|
|
41
|
+
value: (0, _i18n.t)('nativeVersion')
|
|
42
42
|
}
|
|
43
43
|
];
|
|
44
44
|
const rows = [];
|
|
@@ -46,16 +46,17 @@ async function listPackage(appId) {
|
|
|
46
46
|
const { version } = pkg;
|
|
47
47
|
let versionInfo = '';
|
|
48
48
|
if (version) {
|
|
49
|
-
versionInfo =
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
versionInfo = (0, _i18n.t)('boundTo', {
|
|
50
|
+
name: version.name,
|
|
51
|
+
id: version.id
|
|
52
|
+
});
|
|
52
53
|
}
|
|
53
54
|
let output = pkg.name;
|
|
54
55
|
if (pkg.status === 'paused') {
|
|
55
|
-
output +=
|
|
56
|
+
output += (0, _i18n.t)('pausedStatus');
|
|
56
57
|
}
|
|
57
58
|
if (pkg.status === 'expired') {
|
|
58
|
-
output +=
|
|
59
|
+
output += (0, _i18n.t)('expiredStatus');
|
|
59
60
|
}
|
|
60
61
|
output += versionInfo;
|
|
61
62
|
rows.push([
|
|
@@ -72,7 +73,7 @@ async function listPackage(appId) {
|
|
|
72
73
|
async function choosePackage(appId) {
|
|
73
74
|
const list = await listPackage(appId);
|
|
74
75
|
while(true){
|
|
75
|
-
const id = await (0, _utils.question)(
|
|
76
|
+
const id = await (0, _utils.question)((0, _i18n.t)('enterNativePackageId'));
|
|
76
77
|
const app = list.find((v)=>v.id === Number(id));
|
|
77
78
|
if (app) {
|
|
78
79
|
return app;
|
|
@@ -88,10 +89,16 @@ const commands = {
|
|
|
88
89
|
const { versionName, buildTime, appId: appIdInPkg, appKey: appKeyInPkg } = await (0, _utils.getIpaInfo)(fn);
|
|
89
90
|
const { appId, appKey } = await (0, _app.getSelectedApp)('ios');
|
|
90
91
|
if (appIdInPkg && appIdInPkg != appId) {
|
|
91
|
-
throw new Error(
|
|
92
|
+
throw new Error((0, _i18n.t)('appIdMismatchIpa', {
|
|
93
|
+
appIdInPkg,
|
|
94
|
+
appId
|
|
95
|
+
}));
|
|
92
96
|
}
|
|
93
97
|
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
|
94
|
-
throw new Error(
|
|
98
|
+
throw new Error((0, _i18n.t)('appKeyMismatchIpa', {
|
|
99
|
+
appKeyInPkg,
|
|
100
|
+
appKey
|
|
101
|
+
}));
|
|
95
102
|
}
|
|
96
103
|
const { hash } = await (0, _api.uploadFile)(fn);
|
|
97
104
|
const { id } = await (0, _api.post)(`/app/${appId}/package/create`, {
|
|
@@ -102,7 +109,11 @@ const commands = {
|
|
|
102
109
|
commit: await (0, _git.getCommitInfo)()
|
|
103
110
|
});
|
|
104
111
|
(0, _utils.saveToLocal)(fn, `${appId}/package/${id}.ipa`);
|
|
105
|
-
console.log(
|
|
112
|
+
console.log((0, _i18n.t)('ipaUploadSuccess', {
|
|
113
|
+
id,
|
|
114
|
+
version: versionName,
|
|
115
|
+
buildTime
|
|
116
|
+
}));
|
|
106
117
|
},
|
|
107
118
|
uploadApk: async ({ args })=>{
|
|
108
119
|
const fn = args[0];
|
|
@@ -112,10 +123,16 @@ const commands = {
|
|
|
112
123
|
const { versionName, buildTime, appId: appIdInPkg, appKey: appKeyInPkg } = await (0, _utils.getApkInfo)(fn);
|
|
113
124
|
const { appId, appKey } = await (0, _app.getSelectedApp)('android');
|
|
114
125
|
if (appIdInPkg && appIdInPkg != appId) {
|
|
115
|
-
throw new Error(
|
|
126
|
+
throw new Error((0, _i18n.t)('appIdMismatchApk', {
|
|
127
|
+
appIdInPkg,
|
|
128
|
+
appId
|
|
129
|
+
}));
|
|
116
130
|
}
|
|
117
131
|
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
|
118
|
-
throw new Error(
|
|
132
|
+
throw new Error((0, _i18n.t)('appKeyMismatchApk', {
|
|
133
|
+
appKeyInPkg,
|
|
134
|
+
appKey
|
|
135
|
+
}));
|
|
119
136
|
}
|
|
120
137
|
const { hash } = await (0, _api.uploadFile)(fn);
|
|
121
138
|
const { id } = await (0, _api.post)(`/app/${appId}/package/create`, {
|
|
@@ -126,7 +143,11 @@ const commands = {
|
|
|
126
143
|
commit: await (0, _git.getCommitInfo)()
|
|
127
144
|
});
|
|
128
145
|
(0, _utils.saveToLocal)(fn, `${appId}/package/${id}.apk`);
|
|
129
|
-
console.log(
|
|
146
|
+
console.log((0, _i18n.t)('apkUploadSuccess', {
|
|
147
|
+
id,
|
|
148
|
+
version: versionName,
|
|
149
|
+
buildTime
|
|
150
|
+
}));
|
|
130
151
|
},
|
|
131
152
|
uploadApp: async ({ args })=>{
|
|
132
153
|
const fn = args[0];
|
|
@@ -136,10 +157,16 @@ const commands = {
|
|
|
136
157
|
const { versionName, buildTime, appId: appIdInPkg, appKey: appKeyInPkg } = await (0, _utils.getAppInfo)(fn);
|
|
137
158
|
const { appId, appKey } = await (0, _app.getSelectedApp)('harmony');
|
|
138
159
|
if (appIdInPkg && appIdInPkg != appId) {
|
|
139
|
-
throw new Error(
|
|
160
|
+
throw new Error((0, _i18n.t)('appIdMismatchApp', {
|
|
161
|
+
appIdInPkg,
|
|
162
|
+
appId
|
|
163
|
+
}));
|
|
140
164
|
}
|
|
141
165
|
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
|
142
|
-
throw new Error(
|
|
166
|
+
throw new Error((0, _i18n.t)('appKeyMismatchApp', {
|
|
167
|
+
appKeyInPkg,
|
|
168
|
+
appKey
|
|
169
|
+
}));
|
|
143
170
|
}
|
|
144
171
|
const { hash } = await (0, _api.uploadFile)(fn);
|
|
145
172
|
const { id } = await (0, _api.post)(`/app/${appId}/package/create`, {
|
|
@@ -150,7 +177,11 @@ const commands = {
|
|
|
150
177
|
commit: await (0, _git.getCommitInfo)()
|
|
151
178
|
});
|
|
152
179
|
(0, _utils.saveToLocal)(fn, `${appId}/package/${id}.app`);
|
|
153
|
-
console.log(
|
|
180
|
+
console.log((0, _i18n.t)('appUploadSuccess', {
|
|
181
|
+
id,
|
|
182
|
+
version: versionName,
|
|
183
|
+
buildTime
|
|
184
|
+
}));
|
|
154
185
|
},
|
|
155
186
|
parseApp: async ({ args })=>{
|
|
156
187
|
const fn = args[0];
|
|
@@ -174,7 +205,7 @@ const commands = {
|
|
|
174
205
|
console.log(await (0, _utils.getApkInfo)(fn));
|
|
175
206
|
},
|
|
176
207
|
packages: async ({ options })=>{
|
|
177
|
-
const platform = (0, _app.checkPlatform)(options.platform || await (0, _utils.question)(
|
|
208
|
+
const platform = (0, _app.checkPlatform)(options.platform || await (0, _utils.question)((0, _i18n.t)('platformPrompt')));
|
|
178
209
|
const { appId } = await (0, _app.getSelectedApp)(platform);
|
|
179
210
|
await listPackage(appId);
|
|
180
211
|
}
|
package/lib/utils/i18n.js
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -194,13 +194,12 @@ async function printVersionCommand() {
|
|
|
194
194
|
version: _chalk.default.green(latestRnuCliVersion)
|
|
195
195
|
})}` : '';
|
|
196
196
|
console.log(`react-native-update-cli: ${_packagejson.default.version}${latestRnuCliVersion}`);
|
|
197
|
-
|
|
198
|
-
rnuVersion = _depversions.depVersions['react-native-update'];
|
|
199
|
-
latestRnuVersion = latestRnuVersion ? ` ${(0, _i18n.t)('latestVersionTag', {
|
|
200
|
-
version: _chalk.default.green(latestRnuVersion)
|
|
201
|
-
})}` : '';
|
|
202
|
-
console.log(`react-native-update: ${rnuVersion}${latestRnuVersion}`);
|
|
197
|
+
const rnuVersion = _depversions.depVersions['react-native-update'];
|
|
203
198
|
if (rnuVersion) {
|
|
199
|
+
latestRnuVersion = latestRnuVersion ? ` ${(0, _i18n.t)('latestVersionTag', {
|
|
200
|
+
version: _chalk.default.green(latestRnuVersion)
|
|
201
|
+
})}` : '';
|
|
202
|
+
console.log(`react-native-update: ${rnuVersion}${latestRnuVersion}`);
|
|
204
203
|
if (_constants.IS_CRESC) {
|
|
205
204
|
if ((0, _satisfies.default)(rnuVersion, '<10.27.0')) {
|
|
206
205
|
console.error('Unsupported version, please update to the latest version: npm i react-native-update@latest');
|
package/lib/versions.js
CHANGED
|
@@ -91,7 +91,7 @@ const commands = {
|
|
|
91
91
|
const fn = args[0];
|
|
92
92
|
const { name, description, metaInfo } = options;
|
|
93
93
|
if (!fn || !fn.endsWith('.ppk')) {
|
|
94
|
-
throw new Error(
|
|
94
|
+
throw new Error((0, _i18n.t)('publishUsage'));
|
|
95
95
|
}
|
|
96
96
|
const platform = (0, _app.checkPlatform)(options.platform || await (0, _utils.question)('平台(ios/android/harmony):'));
|
|
97
97
|
const { appId } = await (0, _app.getSelectedApp)(platform);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "1.44.
|
|
3
|
+
"version": "1.44.3",
|
|
4
4
|
"description": "command line tool for react-native-update (remote updates for react native)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "swc src -d lib --strip-leading-paths",
|
|
17
|
-
"
|
|
17
|
+
"prepublishOnly": "npm run build && chmod +x lib/index.js",
|
|
18
18
|
"lint": "tsc --noEmit & biome check --write ."
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/reactnativecn/react-native-pushy/tree/master/react-native-pushy-cli",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@badisi/latest-version": "^7.0.
|
|
38
|
+
"@badisi/latest-version": "^7.0.14",
|
|
39
39
|
"bplist-parser": "^0.3.2",
|
|
40
40
|
"bytebuffer": "^5.0.1",
|
|
41
41
|
"cgbi-to-png": "^1.0.7",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@biomejs/biome": "^1.9.4",
|
|
69
|
-
"@swc/cli": "
|
|
70
|
-
"@swc/core": "^1.11.
|
|
69
|
+
"@swc/cli": "0.7.3",
|
|
70
|
+
"@swc/core": "^1.11.24",
|
|
71
71
|
"@types/filesize-parser": "^1.5.3",
|
|
72
72
|
"@types/fs-extra": "^11.0.4",
|
|
73
73
|
"@types/node": "^22.14.1",
|
|
@@ -82,5 +82,8 @@
|
|
|
82
82
|
"trustedDependencies": [
|
|
83
83
|
"@biomejs/biome",
|
|
84
84
|
"@swc/core"
|
|
85
|
-
]
|
|
85
|
+
],
|
|
86
|
+
"patchedDependencies": {
|
|
87
|
+
"@badisi/latest-version@7.0.14": "patches/@badisi%2Flatest-version@7.0.14.patch"
|
|
88
|
+
}
|
|
86
89
|
}
|
package/src/bundle.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { translateOptions } from './utils';
|
|
3
3
|
import * as fs from 'fs-extra';
|
|
4
|
-
import { ZipFile } from 'yazl';
|
|
5
|
-
import {
|
|
4
|
+
import { ZipFile as YazlZipFile } from 'yazl';
|
|
5
|
+
import {
|
|
6
|
+
type Entry,
|
|
7
|
+
open as openZipFile,
|
|
8
|
+
type ZipFile as YauzlZipFile,
|
|
9
|
+
} from 'yauzl';
|
|
6
10
|
import { question, checkPlugins } from './utils';
|
|
7
11
|
import { checkPlatform } from './app';
|
|
8
12
|
import { spawn, spawnSync } from 'node:child_process';
|
|
@@ -15,10 +19,13 @@ import { t } from './utils/i18n';
|
|
|
15
19
|
import { tempDir } from './utils/constants';
|
|
16
20
|
import { checkLockFiles } from './utils/check-lockfile';
|
|
17
21
|
import { addGitIgnore } from './utils/add-gitignore';
|
|
22
|
+
import { commands as versionCommands } from './versions';
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let
|
|
24
|
+
type Diff = (oldSource?: Buffer, newSource?: Buffer) => Buffer;
|
|
25
|
+
|
|
26
|
+
let bsdiff: Diff;
|
|
27
|
+
let hdiff: Diff;
|
|
28
|
+
let diff: Diff;
|
|
22
29
|
try {
|
|
23
30
|
bsdiff = require('node-bsdiff').diff;
|
|
24
31
|
} catch (e) {}
|
|
@@ -59,9 +66,7 @@ async function runReactNativeBundleCommand({
|
|
|
59
66
|
if (platform === 'android') {
|
|
60
67
|
gradleConfig = await checkGradleConfig();
|
|
61
68
|
if (gradleConfig.crunchPngs !== false) {
|
|
62
|
-
console.warn(
|
|
63
|
-
'android 的 crunchPngs 选项似乎尚未禁用(如已禁用则请忽略此提示),这可能导致热更包体积异常增大,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8-android-%E7%9A%84-crunch-%E4%BC%98%E5%8C%96 \n',
|
|
64
|
-
);
|
|
69
|
+
console.warn(t('androidCrunchPngsWarning'));
|
|
65
70
|
}
|
|
66
71
|
}
|
|
67
72
|
|
|
@@ -321,7 +326,7 @@ async function compileHermesByteCode(
|
|
|
321
326
|
sourcemapOutput: string,
|
|
322
327
|
shouldCleanSourcemap: boolean,
|
|
323
328
|
) {
|
|
324
|
-
console.log('
|
|
329
|
+
console.log(t('hermesEnabledCompiling'));
|
|
325
330
|
// >= rn 0.69
|
|
326
331
|
const rnDir = path.dirname(
|
|
327
332
|
require.resolve('react-native', {
|
|
@@ -351,7 +356,9 @@ async function compileHermesByteCode(
|
|
|
351
356
|
);
|
|
352
357
|
args.push('-output-source-map');
|
|
353
358
|
}
|
|
354
|
-
console.log(
|
|
359
|
+
console.log(
|
|
360
|
+
t('runningHermesc', { command: hermesCommand, args: args.join(' ') }),
|
|
361
|
+
);
|
|
355
362
|
spawnSync(hermesCommand, args, {
|
|
356
363
|
stdio: 'ignore',
|
|
357
364
|
});
|
|
@@ -387,7 +394,7 @@ async function copyDebugidForSentry(
|
|
|
387
394
|
sourcemapOutput: string,
|
|
388
395
|
) {
|
|
389
396
|
if (sourcemapOutput) {
|
|
390
|
-
let copyDebugidPath;
|
|
397
|
+
let copyDebugidPath: string | undefined;
|
|
391
398
|
try {
|
|
392
399
|
copyDebugidPath = require.resolve(
|
|
393
400
|
'@sentry/react-native/scripts/copy-debugid.js',
|
|
@@ -426,13 +433,13 @@ async function uploadSourcemapForSentry(
|
|
|
426
433
|
version: string,
|
|
427
434
|
) {
|
|
428
435
|
if (sourcemapOutput) {
|
|
429
|
-
let sentryCliPath;
|
|
436
|
+
let sentryCliPath: string | undefined;
|
|
430
437
|
try {
|
|
431
438
|
sentryCliPath = require.resolve('@sentry/cli/bin/sentry-cli', {
|
|
432
439
|
paths: [process.cwd()],
|
|
433
440
|
});
|
|
434
441
|
} catch (error) {
|
|
435
|
-
console.error('
|
|
442
|
+
console.error(t('sentryCliNotFound'));
|
|
436
443
|
return;
|
|
437
444
|
}
|
|
438
445
|
|
|
@@ -471,12 +478,12 @@ async function uploadSourcemapForSentry(
|
|
|
471
478
|
}
|
|
472
479
|
|
|
473
480
|
const ignorePackingFileNames = ['.', '..', 'index.bundlejs.map'];
|
|
474
|
-
const ignorePackingExtensions = ['DS_Store','txt.map'];
|
|
481
|
+
const ignorePackingExtensions = ['DS_Store', 'txt.map'];
|
|
475
482
|
async function pack(dir: string, output: string) {
|
|
476
483
|
console.log(t('packing'));
|
|
477
484
|
fs.ensureDirSync(path.dirname(output));
|
|
478
485
|
await new Promise<void>((resolve, reject) => {
|
|
479
|
-
const zipfile = new
|
|
486
|
+
const zipfile = new YazlZipFile();
|
|
480
487
|
|
|
481
488
|
function addDirectory(root: string, rel: string) {
|
|
482
489
|
if (rel) {
|
|
@@ -513,10 +520,13 @@ async function pack(dir: string, output: string) {
|
|
|
513
520
|
console.log(t('fileGenerated', { file: output }));
|
|
514
521
|
}
|
|
515
522
|
|
|
516
|
-
export function
|
|
523
|
+
export function readEntry(
|
|
524
|
+
entry: Entry,
|
|
525
|
+
zipFile: YauzlZipFile,
|
|
526
|
+
): Promise<Buffer> {
|
|
517
527
|
const buffers: Buffer[] = [];
|
|
518
528
|
return new Promise((resolve, reject) => {
|
|
519
|
-
zipFile.openReadStream(entry, (err
|
|
529
|
+
zipFile.openReadStream(entry, (err, stream) => {
|
|
520
530
|
stream.pipe({
|
|
521
531
|
write(chunk: Buffer) {
|
|
522
532
|
buffers.push(chunk);
|
|
@@ -544,7 +554,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|
|
544
554
|
const originEntries = {};
|
|
545
555
|
const originMap = {};
|
|
546
556
|
|
|
547
|
-
let originSource;
|
|
557
|
+
let originSource: Buffer | undefined;
|
|
548
558
|
|
|
549
559
|
await enumZipEntries(origin, (entry, zipFile) => {
|
|
550
560
|
originEntries[entry.fileName] = entry;
|
|
@@ -557,7 +567,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|
|
557
567
|
entry.fileName === 'bundle.harmony.js'
|
|
558
568
|
) {
|
|
559
569
|
// This is source.
|
|
560
|
-
return
|
|
570
|
+
return readEntry(entry, zipFile).then((v) => (originSource = v));
|
|
561
571
|
}
|
|
562
572
|
}
|
|
563
573
|
});
|
|
@@ -570,7 +580,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|
|
570
580
|
|
|
571
581
|
const copies = {};
|
|
572
582
|
|
|
573
|
-
const zipfile = new
|
|
583
|
+
const zipfile = new YazlZipFile();
|
|
574
584
|
|
|
575
585
|
const writePromise = new Promise((resolve, reject) => {
|
|
576
586
|
zipfile.outputStream.on('error', (err) => {
|
|
@@ -607,7 +617,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|
|
607
617
|
}
|
|
608
618
|
} else if (entry.fileName === 'index.bundlejs') {
|
|
609
619
|
//console.log('Found bundle');
|
|
610
|
-
return
|
|
620
|
+
return readEntry(entry, nextZipfile).then((newSource) => {
|
|
611
621
|
//console.log('Begin diff');
|
|
612
622
|
zipfile.addBuffer(
|
|
613
623
|
diff(originSource, newSource),
|
|
@@ -617,7 +627,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|
|
617
627
|
});
|
|
618
628
|
} else if (entry.fileName === 'bundle.harmony.js') {
|
|
619
629
|
//console.log('Found bundle');
|
|
620
|
-
return
|
|
630
|
+
return readEntry(entry, nextZipfile).then((newSource) => {
|
|
621
631
|
//console.log('Begin diff');
|
|
622
632
|
zipfile.addBuffer(
|
|
623
633
|
diff(originSource, newSource),
|
|
@@ -691,9 +701,9 @@ async function diffFromPackage(
|
|
|
691
701
|
const originEntries = {};
|
|
692
702
|
const originMap = {};
|
|
693
703
|
|
|
694
|
-
let originSource;
|
|
704
|
+
let originSource: Buffer | undefined;
|
|
695
705
|
|
|
696
|
-
await enumZipEntries(origin, (entry
|
|
706
|
+
await enumZipEntries(origin, (entry, zipFile) => {
|
|
697
707
|
if (!/\/$/.test(entry.fileName)) {
|
|
698
708
|
const fn = transformPackagePath(entry.fileName);
|
|
699
709
|
if (!fn) {
|
|
@@ -707,7 +717,7 @@ async function diffFromPackage(
|
|
|
707
717
|
|
|
708
718
|
if (fn === originBundleName) {
|
|
709
719
|
// This is source.
|
|
710
|
-
return
|
|
720
|
+
return readEntry(entry, zipFile).then((v) => (originSource = v));
|
|
711
721
|
}
|
|
712
722
|
}
|
|
713
723
|
});
|
|
@@ -720,7 +730,7 @@ async function diffFromPackage(
|
|
|
720
730
|
|
|
721
731
|
const copies = {};
|
|
722
732
|
|
|
723
|
-
const zipfile = new
|
|
733
|
+
const zipfile = new YazlZipFile();
|
|
724
734
|
|
|
725
735
|
const writePromise = new Promise((resolve, reject) => {
|
|
726
736
|
zipfile.outputStream.on('error', (err) => {
|
|
@@ -737,7 +747,7 @@ async function diffFromPackage(
|
|
|
737
747
|
zipfile.addEmptyDirectory(entry.fileName);
|
|
738
748
|
} else if (entry.fileName === 'index.bundlejs') {
|
|
739
749
|
//console.log('Found bundle');
|
|
740
|
-
return
|
|
750
|
+
return readEntry(entry, nextZipfile).then((newSource) => {
|
|
741
751
|
//console.log('Begin diff');
|
|
742
752
|
zipfile.addBuffer(
|
|
743
753
|
diff(originSource, newSource),
|
|
@@ -747,7 +757,7 @@ async function diffFromPackage(
|
|
|
747
757
|
});
|
|
748
758
|
} else if (entry.fileName === 'bundle.harmony.js') {
|
|
749
759
|
//console.log('Found bundle');
|
|
750
|
-
return
|
|
760
|
+
return readEntry(entry, nextZipfile).then((newSource) => {
|
|
751
761
|
//console.log('Begin diff');
|
|
752
762
|
zipfile.addBuffer(
|
|
753
763
|
diff(originSource, newSource),
|
|
@@ -789,14 +799,18 @@ async function diffFromPackage(
|
|
|
789
799
|
|
|
790
800
|
export async function enumZipEntries(
|
|
791
801
|
zipFn: string,
|
|
792
|
-
callback: (
|
|
802
|
+
callback: (
|
|
803
|
+
entry: Entry,
|
|
804
|
+
zipFile: YauzlZipFile,
|
|
805
|
+
nestedPath?: string,
|
|
806
|
+
) => Promise<any>,
|
|
793
807
|
nestedPath = '',
|
|
794
808
|
) {
|
|
795
809
|
return new Promise((resolve, reject) => {
|
|
796
810
|
openZipFile(
|
|
797
811
|
zipFn,
|
|
798
812
|
{ lazyEntries: true },
|
|
799
|
-
async (err: any, zipfile:
|
|
813
|
+
async (err: any, zipfile: YauzlZipFile) => {
|
|
800
814
|
if (err) {
|
|
801
815
|
return reject(err);
|
|
802
816
|
}
|
|
@@ -850,7 +864,7 @@ export async function enumZipEntries(
|
|
|
850
864
|
});
|
|
851
865
|
}
|
|
852
866
|
|
|
853
|
-
function diffArgsCheck(args, options, diffFn) {
|
|
867
|
+
function diffArgsCheck(args: string[], options: any, diffFn: string) {
|
|
854
868
|
const [origin, next] = args;
|
|
855
869
|
|
|
856
870
|
if (!origin || !next) {
|
|
@@ -889,7 +903,7 @@ function diffArgsCheck(args, options, diffFn) {
|
|
|
889
903
|
export const commands = {
|
|
890
904
|
bundle: async function ({ options }) {
|
|
891
905
|
const platform = checkPlatform(
|
|
892
|
-
options.platform || (await question(
|
|
906
|
+
options.platform || (await question(t('platformPrompt'))),
|
|
893
907
|
);
|
|
894
908
|
|
|
895
909
|
const {
|
|
@@ -903,6 +917,9 @@ export const commands = {
|
|
|
903
917
|
expo,
|
|
904
918
|
rncli,
|
|
905
919
|
disableHermes,
|
|
920
|
+
name,
|
|
921
|
+
description,
|
|
922
|
+
metaInfo,
|
|
906
923
|
} = translateOptions({
|
|
907
924
|
...options,
|
|
908
925
|
tempDir,
|
|
@@ -943,14 +960,17 @@ export const commands = {
|
|
|
943
960
|
|
|
944
961
|
await pack(path.resolve(intermediaDir), realOutput);
|
|
945
962
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
const versionName = await this.publish({
|
|
963
|
+
if (name) {
|
|
964
|
+
const versionName = await versionCommands.publish({
|
|
949
965
|
args: [realOutput],
|
|
950
966
|
options: {
|
|
951
967
|
platform,
|
|
968
|
+
name,
|
|
969
|
+
description,
|
|
970
|
+
metaInfo,
|
|
952
971
|
},
|
|
953
972
|
});
|
|
973
|
+
|
|
954
974
|
if (isSentry) {
|
|
955
975
|
await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput);
|
|
956
976
|
await uploadSourcemapForSentry(
|
|
@@ -960,6 +980,25 @@ export const commands = {
|
|
|
960
980
|
versionName,
|
|
961
981
|
);
|
|
962
982
|
}
|
|
983
|
+
} else if (!options['no-interactive']) {
|
|
984
|
+
const v = await question(t('uploadBundlePrompt'));
|
|
985
|
+
if (v.toLowerCase() === 'y') {
|
|
986
|
+
const versionName = await versionCommands.publish({
|
|
987
|
+
args: [realOutput],
|
|
988
|
+
options: {
|
|
989
|
+
platform,
|
|
990
|
+
},
|
|
991
|
+
});
|
|
992
|
+
if (isSentry) {
|
|
993
|
+
await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput);
|
|
994
|
+
await uploadSourcemapForSentry(
|
|
995
|
+
bundleName,
|
|
996
|
+
intermediaDir,
|
|
997
|
+
sourcemapOutput,
|
|
998
|
+
versionName,
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
963
1002
|
}
|
|
964
1003
|
},
|
|
965
1004
|
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ function printUsage() {
|
|
|
8
8
|
// const commandName = args[0];
|
|
9
9
|
// TODO: print usage of commandName, or print global usage.
|
|
10
10
|
|
|
11
|
-
console.log('Usage is under development now.');
|
|
12
11
|
console.log(
|
|
13
12
|
'Visit `https://github.com/reactnativecn/react-native-update` for document.',
|
|
14
13
|
);
|