react-native-update-cli 2.9.4 → 2.9.6
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 +19 -15
- package/lib/app.d.ts +5 -1
- package/lib/app.js +31 -21
- package/lib/bundle-pack.js +2 -1
- package/lib/bundle-runner.js +14 -14
- package/lib/diff.js +24 -22
- package/lib/exports.js +16 -16
- package/lib/index.js +3 -3
- package/lib/module-manager.js +3 -6
- package/lib/modules/app-module.js +1 -1
- package/lib/modules/index.js +7 -7
- package/lib/package.js +15 -11
- package/lib/utils/app-info-parser/aab.js +7 -7
- package/lib/utils/app-info-parser/resource-finder.js +7 -7
- package/lib/utils/app-info-parser/utils.js +10 -10
- package/lib/utils/app-info-parser/xml-parser/binary.js +2 -2
- package/lib/utils/command-result.js +3 -3
- package/lib/utils/constants.js +10 -10
- package/lib/utils/http-helper.js +5 -5
- package/lib/utils/index.js +10 -10
- package/lib/utils/latest-version/cli.js +1 -1
- package/lib/utils/latest-version/index.js +10 -10
- package/lib/utils/options.js +5 -5
- package/lib/utils/plugin-config.js +2 -2
- package/lib/utils/zip-entries.d.ts +1 -0
- package/lib/utils/zip-entries.js +82 -4
- package/lib/utils/zip-options.d.ts +9 -0
- package/lib/utils/zip-options.js +272 -0
- package/lib/versions.js +17 -21
- package/package.json +14 -14
- package/src/api.ts +7 -1
- package/src/app.ts +27 -12
- package/src/bundle-pack.ts +6 -1
- package/src/diff.ts +55 -15
- package/src/module-manager.ts +0 -4
- package/src/package.ts +5 -4
- package/src/utils/zip-entries.ts +89 -2
- package/src/utils/zip-options.ts +169 -0
- package/src/versions.ts +16 -18
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get ZIP_ENTRY_SNIFF_BYTES () {
|
|
13
|
+
return ZIP_ENTRY_SNIFF_BYTES;
|
|
14
|
+
},
|
|
15
|
+
get zipOptionsForManifestEntry () {
|
|
16
|
+
return zipOptionsForManifestEntry;
|
|
17
|
+
},
|
|
18
|
+
get zipOptionsForPatchEntry () {
|
|
19
|
+
return zipOptionsForPatchEntry;
|
|
20
|
+
},
|
|
21
|
+
get zipOptionsForPayloadEntry () {
|
|
22
|
+
return zipOptionsForPayloadEntry;
|
|
23
|
+
},
|
|
24
|
+
get zipOptionsForPayloadFile () {
|
|
25
|
+
return zipOptionsForPayloadFile;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
|
|
29
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
30
|
+
function _interop_require_default(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
36
|
+
if (typeof WeakMap !== "function") return null;
|
|
37
|
+
var cacheBabelInterop = new WeakMap();
|
|
38
|
+
var cacheNodeInterop = new WeakMap();
|
|
39
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
40
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
41
|
+
})(nodeInterop);
|
|
42
|
+
}
|
|
43
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
44
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
45
|
+
return obj;
|
|
46
|
+
}
|
|
47
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
48
|
+
return {
|
|
49
|
+
default: obj
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
53
|
+
if (cache && cache.has(obj)) {
|
|
54
|
+
return cache.get(obj);
|
|
55
|
+
}
|
|
56
|
+
var newObj = {
|
|
57
|
+
__proto__: null
|
|
58
|
+
};
|
|
59
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
60
|
+
for(var key in obj){
|
|
61
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
62
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
63
|
+
if (desc && (desc.get || desc.set)) {
|
|
64
|
+
Object.defineProperty(newObj, key, desc);
|
|
65
|
+
} else {
|
|
66
|
+
newObj[key] = obj[key];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
newObj.default = obj;
|
|
71
|
+
if (cache) {
|
|
72
|
+
cache.set(obj, newObj);
|
|
73
|
+
}
|
|
74
|
+
return newObj;
|
|
75
|
+
}
|
|
76
|
+
const ZIP_ENTRY_SNIFF_BYTES = 64;
|
|
77
|
+
const alreadyCompressedExtensions = new Set([
|
|
78
|
+
'.7z',
|
|
79
|
+
'.aab',
|
|
80
|
+
'.apk',
|
|
81
|
+
'.br',
|
|
82
|
+
'.bz2',
|
|
83
|
+
'.gif',
|
|
84
|
+
'.gz',
|
|
85
|
+
'.heic',
|
|
86
|
+
'.jpeg',
|
|
87
|
+
'.jpg',
|
|
88
|
+
'.lzma',
|
|
89
|
+
'.mp3',
|
|
90
|
+
'.mp4',
|
|
91
|
+
'.ogg',
|
|
92
|
+
'.png',
|
|
93
|
+
'.webm',
|
|
94
|
+
'.webp',
|
|
95
|
+
'.woff',
|
|
96
|
+
'.woff2',
|
|
97
|
+
'.xz',
|
|
98
|
+
'.zip',
|
|
99
|
+
'.zst'
|
|
100
|
+
]);
|
|
101
|
+
const HERMES_MAGIC = Buffer.from([
|
|
102
|
+
0xc6,
|
|
103
|
+
0x1f,
|
|
104
|
+
0xbc,
|
|
105
|
+
0x03,
|
|
106
|
+
0xc1,
|
|
107
|
+
0x03,
|
|
108
|
+
0x19,
|
|
109
|
+
0x1f
|
|
110
|
+
]);
|
|
111
|
+
const HERMES_DELTA_MAGIC = Buffer.from([
|
|
112
|
+
0x39,
|
|
113
|
+
0xe0,
|
|
114
|
+
0x43,
|
|
115
|
+
0xfc,
|
|
116
|
+
0x3e,
|
|
117
|
+
0xfc,
|
|
118
|
+
0xe6,
|
|
119
|
+
0xe0
|
|
120
|
+
]);
|
|
121
|
+
function startsWith(bytes, signature) {
|
|
122
|
+
return bytes.length >= signature.length && bytes.subarray(0, signature.length).equals(signature);
|
|
123
|
+
}
|
|
124
|
+
function hasHermesBytecodeMagic(bytes) {
|
|
125
|
+
return startsWith(bytes, HERMES_MAGIC) || startsWith(bytes, HERMES_DELTA_MAGIC);
|
|
126
|
+
}
|
|
127
|
+
function hasAlreadyCompressedMagic(bytes) {
|
|
128
|
+
if (bytes.length < 2) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
if (startsWith(bytes, Buffer.from([
|
|
132
|
+
0x89,
|
|
133
|
+
0x50,
|
|
134
|
+
0x4e,
|
|
135
|
+
0x47
|
|
136
|
+
]))) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
if (startsWith(bytes, Buffer.from([
|
|
140
|
+
0xff,
|
|
141
|
+
0xd8,
|
|
142
|
+
0xff
|
|
143
|
+
]))) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
if (startsWith(bytes, Buffer.from('GIF87a', 'ascii')) || startsWith(bytes, Buffer.from('GIF89a', 'ascii'))) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
if (bytes.length >= 12 && bytes.subarray(0, 4).equals(Buffer.from('RIFF', 'ascii')) && bytes.subarray(8, 12).equals(Buffer.from('WEBP', 'ascii'))) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
if (startsWith(bytes, Buffer.from([
|
|
153
|
+
0x50,
|
|
154
|
+
0x4b,
|
|
155
|
+
0x03,
|
|
156
|
+
0x04
|
|
157
|
+
])) || startsWith(bytes, Buffer.from([
|
|
158
|
+
0x50,
|
|
159
|
+
0x4b,
|
|
160
|
+
0x05,
|
|
161
|
+
0x06
|
|
162
|
+
])) || startsWith(bytes, Buffer.from([
|
|
163
|
+
0x50,
|
|
164
|
+
0x4b,
|
|
165
|
+
0x07,
|
|
166
|
+
0x08
|
|
167
|
+
]))) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
if (startsWith(bytes, Buffer.from([
|
|
171
|
+
0x1f,
|
|
172
|
+
0x8b
|
|
173
|
+
]))) {
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
if (startsWith(bytes, Buffer.from('BZh', 'ascii'))) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
if (startsWith(bytes, Buffer.from([
|
|
180
|
+
0xfd,
|
|
181
|
+
0x37,
|
|
182
|
+
0x7a,
|
|
183
|
+
0x58,
|
|
184
|
+
0x5a,
|
|
185
|
+
0x00
|
|
186
|
+
]))) {
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
if (startsWith(bytes, Buffer.from([
|
|
190
|
+
0x37,
|
|
191
|
+
0x7a,
|
|
192
|
+
0xbc,
|
|
193
|
+
0xaf,
|
|
194
|
+
0x27,
|
|
195
|
+
0x1c
|
|
196
|
+
]))) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
if (startsWith(bytes, Buffer.from([
|
|
200
|
+
0x28,
|
|
201
|
+
0xb5,
|
|
202
|
+
0x2f,
|
|
203
|
+
0xfd
|
|
204
|
+
]))) {
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
if (bytes.length >= 12 && bytes.subarray(4, 8).equals(Buffer.from('ftyp'))) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
if (startsWith(bytes, Buffer.from('OggS', 'ascii'))) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
if (startsWith(bytes, Buffer.from('ID3', 'ascii'))) {
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
if (bytes[0] === 0xff && bytes.length >= 2 && (bytes[1] & 0xe0) === 0xe0) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
if (startsWith(bytes, Buffer.from('wOFF', 'ascii')) || startsWith(bytes, Buffer.from('wOF2', 'ascii'))) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
function readFilePrefix(filePath) {
|
|
225
|
+
const buffer = Buffer.alloc(ZIP_ENTRY_SNIFF_BYTES);
|
|
226
|
+
const fd = _fs.openSync(filePath, 'r');
|
|
227
|
+
try {
|
|
228
|
+
const bytesRead = _fs.readSync(fd, buffer, 0, buffer.length, 0);
|
|
229
|
+
return buffer.subarray(0, bytesRead);
|
|
230
|
+
} finally{
|
|
231
|
+
_fs.closeSync(fd);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function zipOptionsForPatchEntry() {
|
|
235
|
+
return {
|
|
236
|
+
compress: false
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function zipOptionsForManifestEntry() {
|
|
240
|
+
return {
|
|
241
|
+
compress: false
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function zipOptionsForPayloadEntry(fileName, prefix) {
|
|
245
|
+
if (prefix && prefix.length > 0) {
|
|
246
|
+
if (hasHermesBytecodeMagic(prefix)) {
|
|
247
|
+
// Hermes bytecode is binary, but still benefits significantly from zip deflate.
|
|
248
|
+
return {
|
|
249
|
+
compress: true,
|
|
250
|
+
compressionLevel: 9
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
if (hasAlreadyCompressedMagic(prefix)) {
|
|
254
|
+
return {
|
|
255
|
+
compress: false
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const extension = _path.default.extname(fileName).toLowerCase();
|
|
260
|
+
if (alreadyCompressedExtensions.has(extension)) {
|
|
261
|
+
return {
|
|
262
|
+
compress: false
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
compress: true,
|
|
267
|
+
compressionLevel: 9
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function zipOptionsForPayloadFile(filePath, entryName = filePath) {
|
|
271
|
+
return zipOptionsForPayloadEntry(entryName, readFilePrefix(filePath));
|
|
272
|
+
}
|
package/lib/versions.js
CHANGED
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
bindVersionToPackages
|
|
12
|
+
get bindVersionToPackages () {
|
|
13
13
|
return bindVersionToPackages;
|
|
14
14
|
},
|
|
15
|
-
versionCommands
|
|
15
|
+
get versionCommands () {
|
|
16
16
|
return versionCommands;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -361,12 +361,12 @@ const versionCommands = {
|
|
|
361
361
|
versions: async ({ options })=>{
|
|
362
362
|
const platform = await (0, _app.getPlatform)(options.platform);
|
|
363
363
|
const { appId } = await (0, _app.getSelectedApp)(platform);
|
|
364
|
-
await listVersions(appId);
|
|
364
|
+
await listVersions(String(appId));
|
|
365
365
|
},
|
|
366
366
|
update: async ({ options })=>{
|
|
367
367
|
const platform = await (0, _app.getPlatform)(options.platform);
|
|
368
368
|
const appId = options.appId || (await (0, _app.getSelectedApp)(platform)).appId;
|
|
369
|
-
let versionId = options.versionId || (await chooseVersion(appId)).id;
|
|
369
|
+
let versionId = options.versionId || (await chooseVersion(String(appId))).id;
|
|
370
370
|
if (versionId === 'null') {
|
|
371
371
|
versionId = undefined;
|
|
372
372
|
}
|
|
@@ -377,16 +377,12 @@ const versionCommands = {
|
|
|
377
377
|
let packageVersionRange = options.packageVersionRange;
|
|
378
378
|
let rollout = undefined;
|
|
379
379
|
if (options.rollout !== undefined) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
} catch (e) {
|
|
383
|
-
throw new Error((0, _i18n.t)('rolloutRangeError'));
|
|
384
|
-
}
|
|
385
|
-
if (rollout < 1 || rollout > 100) {
|
|
380
|
+
rollout = Number.parseInt(options.rollout, 10);
|
|
381
|
+
if (Number.isNaN(rollout) || rollout < 1 || rollout > 100) {
|
|
386
382
|
throw new Error((0, _i18n.t)('rolloutRangeError'));
|
|
387
383
|
}
|
|
388
384
|
}
|
|
389
|
-
const allPkgs = await (0, _api.getAllPackages)(appId);
|
|
385
|
+
const allPkgs = await (0, _api.getAllPackages)(String(appId));
|
|
390
386
|
if (!allPkgs) {
|
|
391
387
|
throw new Error((0, _i18n.t)('noPackagesFound', {
|
|
392
388
|
appId
|
|
@@ -431,7 +427,7 @@ const versionCommands = {
|
|
|
431
427
|
}
|
|
432
428
|
} else {
|
|
433
429
|
if (!pkgId) {
|
|
434
|
-
pkgId = (await (0, _package.choosePackage)(appId)).id;
|
|
430
|
+
pkgId = (await (0, _package.choosePackage)(String(appId))).id;
|
|
435
431
|
}
|
|
436
432
|
if (!pkgId) {
|
|
437
433
|
throw new Error((0, _i18n.t)('packageIdRequired'));
|
|
@@ -448,14 +444,14 @@ const versionCommands = {
|
|
|
448
444
|
}
|
|
449
445
|
}
|
|
450
446
|
await printDepsChangesForPublish({
|
|
451
|
-
appId,
|
|
452
|
-
versionId,
|
|
447
|
+
appId: String(appId),
|
|
448
|
+
versionId: String(versionId),
|
|
453
449
|
pkgs: pkgsToBind,
|
|
454
450
|
providedVersionDeps: options.versionDeps
|
|
455
451
|
});
|
|
456
452
|
await bindVersionToPackages({
|
|
457
|
-
appId,
|
|
458
|
-
versionId,
|
|
453
|
+
appId: String(appId),
|
|
454
|
+
versionId: String(versionId),
|
|
459
455
|
pkgs: pkgsToBind,
|
|
460
456
|
rollout,
|
|
461
457
|
dryRun: options.dryRun
|
|
@@ -464,12 +460,12 @@ const versionCommands = {
|
|
|
464
460
|
updateVersionInfo: async ({ options })=>{
|
|
465
461
|
const platform = await (0, _app.getPlatform)(options.platform);
|
|
466
462
|
const { appId } = await (0, _app.getSelectedApp)(platform);
|
|
467
|
-
const versionId = options.versionId || (await chooseVersion(appId)).id;
|
|
463
|
+
const versionId = options.versionId || (await chooseVersion(String(appId))).id;
|
|
468
464
|
const updateParams = {};
|
|
469
465
|
if (options.name) updateParams.name = options.name;
|
|
470
466
|
if (options.description) updateParams.description = options.description;
|
|
471
467
|
if (options.metaInfo) updateParams.metaInfo = options.metaInfo;
|
|
472
|
-
await (0, _api.put)(`/app/${appId}/version/${versionId}`, updateParams);
|
|
468
|
+
await (0, _api.put)(`/app/${String(appId)}/version/${versionId}`, updateParams);
|
|
473
469
|
console.log((0, _i18n.t)('operationSuccess'));
|
|
474
470
|
},
|
|
475
471
|
deleteVersion: async ({ options })=>{
|
|
@@ -480,10 +476,10 @@ const versionCommands = {
|
|
|
480
476
|
}
|
|
481
477
|
let versionId = options.versionId;
|
|
482
478
|
if (!versionId) {
|
|
483
|
-
versionId = (await chooseVersion(appId)).id;
|
|
479
|
+
versionId = (await chooseVersion(String(appId))).id;
|
|
484
480
|
}
|
|
485
481
|
try {
|
|
486
|
-
await (0, _api.doDelete)(`/app/${appId}/version/${versionId}`);
|
|
482
|
+
await (0, _api.doDelete)(`/app/${String(appId)}/version/${versionId}`);
|
|
487
483
|
console.log((0, _i18n.t)('deleteVersionSuccess', {
|
|
488
484
|
versionId
|
|
489
485
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update-cli",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.6",
|
|
4
4
|
"description": "command line tool for react-native-update (remote updates for react native)",
|
|
5
5
|
"main": "lib/exports.js",
|
|
6
6
|
"types": "lib/exports.d.ts",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"commander": "^13",
|
|
71
71
|
"compare-versions": "^6.1.1",
|
|
72
72
|
"filesize-parser": "^1.5.1",
|
|
73
|
-
"form-data": "^4.0.
|
|
73
|
+
"form-data": "^4.0.5",
|
|
74
74
|
"fs-extra": "8",
|
|
75
75
|
"global-dirs": "^4.0.0",
|
|
76
76
|
"gradle-to-js": "^2.0.1",
|
|
77
77
|
"i18next": "^24.2.3",
|
|
78
|
-
"isomorphic-git": "^1.
|
|
78
|
+
"isomorphic-git": "^1.37.5",
|
|
79
79
|
"isomorphic-unzip": "^1.1.5",
|
|
80
80
|
"node-fetch": "^2.6.1",
|
|
81
81
|
"plist": "^3.1.0",
|
|
@@ -83,31 +83,31 @@
|
|
|
83
83
|
"properties": "^1.2.1",
|
|
84
84
|
"protobufjs": "^7.5.4",
|
|
85
85
|
"read": "^4.1.0",
|
|
86
|
-
"registry-auth-token": "^5.1.
|
|
87
|
-
"semver": "^7.7.
|
|
86
|
+
"registry-auth-token": "^5.1.1",
|
|
87
|
+
"semver": "^7.7.4",
|
|
88
88
|
"tcp-ping": "^0.1.1",
|
|
89
89
|
"tty-table": "4.2",
|
|
90
|
-
"yauzl": "^3.
|
|
90
|
+
"yauzl": "^3.3.0",
|
|
91
91
|
"yazl": "3.3.1"
|
|
92
92
|
},
|
|
93
93
|
"engines": {
|
|
94
94
|
"node": ">= 14"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@biomejs/biome": "^
|
|
98
|
-
"@swc/cli": "0.
|
|
99
|
-
"@swc/core": "^1.
|
|
100
|
-
"@types/bun": "^1.3.
|
|
97
|
+
"@biomejs/biome": "^2.4.11",
|
|
98
|
+
"@swc/cli": "0.8.1",
|
|
99
|
+
"@swc/core": "^1.15.24",
|
|
100
|
+
"@types/bun": "^1.3.12",
|
|
101
101
|
"@types/filesize-parser": "^1.5.3",
|
|
102
102
|
"@types/fs-extra": "^11.0.4",
|
|
103
|
-
"@types/node": "^
|
|
104
|
-
"@types/node-fetch": "^2.6.
|
|
103
|
+
"@types/node": "^25.6.0",
|
|
104
|
+
"@types/node-fetch": "^2.6.13",
|
|
105
105
|
"@types/progress": "^2.0.7",
|
|
106
|
-
"@types/semver": "^7.7.
|
|
106
|
+
"@types/semver": "^7.7.1",
|
|
107
107
|
"@types/tcp-ping": "^0.1.6",
|
|
108
108
|
"@types/yauzl": "^2.10.3",
|
|
109
109
|
"@types/yazl": "^2.4.6",
|
|
110
|
-
"typescript": "^
|
|
110
|
+
"typescript": "^6.0.2"
|
|
111
111
|
},
|
|
112
112
|
"trustedDependencies": [
|
|
113
113
|
"@biomejs/biome",
|
package/src/api.ts
CHANGED
|
@@ -98,7 +98,13 @@ async function query(url: string, options: fetch.RequestInit) {
|
|
|
98
98
|
let json: any;
|
|
99
99
|
try {
|
|
100
100
|
json = JSON.parse(text);
|
|
101
|
-
} catch (e) {
|
|
101
|
+
} catch (e) {
|
|
102
|
+
if (resp.status === 200 && text) {
|
|
103
|
+
console.warn(
|
|
104
|
+
`Warning: API returned 200 with non-JSON body (${text.length} bytes)`,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
102
108
|
|
|
103
109
|
if (resp.status !== 200) {
|
|
104
110
|
const message = json?.message || resp.statusText || `HTTP ${resp.status}`;
|
package/src/app.ts
CHANGED
|
@@ -27,17 +27,30 @@ export function assertPlatform(platform: string): Platform {
|
|
|
27
27
|
return platform as Platform;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export function getSelectedApp(
|
|
30
|
+
export async function getSelectedApp(
|
|
31
|
+
platform: Platform,
|
|
32
|
+
): Promise<{ appId: string; appKey: string; platform: Platform }> {
|
|
31
33
|
assertPlatform(platform);
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
let updateInfo: Partial<Record<Platform, { appId: number; appKey: string }>> =
|
|
36
|
+
{};
|
|
37
|
+
try {
|
|
38
|
+
updateInfo = JSON.parse(await fs.promises.readFile('update.json', 'utf8'));
|
|
39
|
+
} catch (e: any) {
|
|
40
|
+
if (e.code === 'ENOENT') {
|
|
41
|
+
throw new Error(t('appNotSelected', { platform }));
|
|
42
|
+
}
|
|
43
|
+
throw e;
|
|
35
44
|
}
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
45
|
+
const info = updateInfo[platform];
|
|
46
|
+
if (!info) {
|
|
38
47
|
throw new Error(t('appNotSelected', { platform }));
|
|
39
48
|
}
|
|
40
|
-
return
|
|
49
|
+
return {
|
|
50
|
+
appId: String(info.appId),
|
|
51
|
+
appKey: info.appKey,
|
|
52
|
+
platform,
|
|
53
|
+
};
|
|
41
54
|
}
|
|
42
55
|
|
|
43
56
|
export async function listApp(platform: Platform | '' = '') {
|
|
@@ -99,7 +112,7 @@ export const appCommands = {
|
|
|
99
112
|
options: { platform: Platform };
|
|
100
113
|
}) => {
|
|
101
114
|
const { platform } = options;
|
|
102
|
-
const id = args[0] || chooseApp(platform);
|
|
115
|
+
const id = args[0] || (await chooseApp(platform)).id;
|
|
103
116
|
if (!id) {
|
|
104
117
|
console.log(t('cancelled'));
|
|
105
118
|
}
|
|
@@ -125,10 +138,12 @@ export const appCommands = {
|
|
|
125
138
|
let updateInfo: Partial<
|
|
126
139
|
Record<Platform, { appId: number; appKey: string }>
|
|
127
140
|
> = {};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
try {
|
|
142
|
+
updateInfo = JSON.parse(
|
|
143
|
+
await fs.promises.readFile('update.json', 'utf8'),
|
|
144
|
+
);
|
|
145
|
+
} catch (e: any) {
|
|
146
|
+
if (e.code !== 'ENOENT') {
|
|
132
147
|
console.error(t('failedToParseUpdateJson'));
|
|
133
148
|
throw e;
|
|
134
149
|
}
|
|
@@ -138,7 +153,7 @@ export const appCommands = {
|
|
|
138
153
|
appId: id,
|
|
139
154
|
appKey,
|
|
140
155
|
};
|
|
141
|
-
fs.
|
|
156
|
+
await fs.promises.writeFile(
|
|
142
157
|
'update.json',
|
|
143
158
|
JSON.stringify(updateInfo, null, 4),
|
|
144
159
|
'utf8',
|
package/src/bundle-pack.ts
CHANGED
|
@@ -2,6 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import * as fs from 'fs-extra';
|
|
3
3
|
import { ZipFile as YazlZipFile } from 'yazl';
|
|
4
4
|
import { t } from './utils/i18n';
|
|
5
|
+
import { zipOptionsForPayloadFile } from './utils/zip-options';
|
|
5
6
|
|
|
6
7
|
const ignorePackingFileNames = [
|
|
7
8
|
'.',
|
|
@@ -32,7 +33,11 @@ export async function packBundle(dir: string, output: string): Promise<void> {
|
|
|
32
33
|
const fullPath = path.join(root, name);
|
|
33
34
|
const stat = fs.statSync(fullPath);
|
|
34
35
|
if (stat.isFile()) {
|
|
35
|
-
zipfile.addFile(
|
|
36
|
+
zipfile.addFile(
|
|
37
|
+
fullPath,
|
|
38
|
+
rel + name,
|
|
39
|
+
zipOptionsForPayloadFile(fullPath, rel + name),
|
|
40
|
+
);
|
|
36
41
|
} else if (stat.isDirectory()) {
|
|
37
42
|
addDirectory(fullPath, `${rel}${name}/`);
|
|
38
43
|
}
|