@zeppos/zeus-cli 1.3.0-beta.4 → 1.3.0-beta.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/modules/build.js +30 -13
- package/package.json +1 -1
- package/private-modules/zeppos-app-utils/dist/config/device.js +232 -2
- package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/empty/page/index.js +2 -2
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/page/index.js +2 -2
package/modules/build.js
CHANGED
|
@@ -112,20 +112,27 @@ var checkAppJson = function () {
|
|
|
112
112
|
var chooseBuildTargetsV3Config = function (mode, args) {
|
|
113
113
|
if (mode === void 0) { mode = 'development'; }
|
|
114
114
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
115
|
-
var apiLevel, targetDevices, deviceNames, answers;
|
|
115
|
+
var apiLevel, platforms, usefulScreenTypes, usefulDeviceSource, targetDevices, deviceNames, answers;
|
|
116
116
|
return __generator(this, function (_a) {
|
|
117
117
|
switch (_a.label) {
|
|
118
118
|
case 0:
|
|
119
119
|
checkAppJson();
|
|
120
120
|
apiLevel = (0, lodash_1.get)(appJsonContent, 'runtime.apiVersion.minVersion', '1.0.0');
|
|
121
|
+
platforms = Object.values((0, lodash_1.get)(appJsonContent, 'targets', {})).reduce(function (list, item) {
|
|
122
|
+
return list.concat((0, lodash_1.get)(item, 'platforms', []));
|
|
123
|
+
}, []);
|
|
124
|
+
usefulScreenTypes = (0, lodash_1.compact)(Object.keys((0, lodash_1.groupBy)(platforms, 'st')));
|
|
125
|
+
usefulDeviceSource = (0, lodash_1.compact)(Object.keys((0, lodash_1.groupBy)(platforms, 'deviceSource')));
|
|
121
126
|
targetDevices = {};
|
|
122
127
|
Object.values(deviceTargets).forEach(function (device) {
|
|
123
128
|
var _a;
|
|
124
129
|
var _b = device.apiLevelLimit || {}, _c = _b.min, min = _c === void 0 ? '1.0.0' : _c, _d = _b.max, max = _d === void 0 ? '99.99.99' : _d;
|
|
125
|
-
if ((0,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
if (usefulScreenTypes.includes((0, lodash_1.get)(device, 'screen.type', '')) || (0, lodash_1.find)(device.platforms, function (o) { return usefulDeviceSource.includes("".concat(o.deviceSource)); })) {
|
|
131
|
+
if ((0, tools_1.compareVersion)(min, apiLevel) >= 0 && (0, tools_1.compareVersion)(max, apiLevel) <= 0) {
|
|
132
|
+
Object.assign(targetDevices, (_a = {},
|
|
133
|
+
_a[device.deviceName] = device,
|
|
134
|
+
_a));
|
|
135
|
+
}
|
|
129
136
|
}
|
|
130
137
|
});
|
|
131
138
|
deviceNames = Object.keys(targetDevices);
|
|
@@ -139,7 +146,7 @@ var chooseBuildTargetsV3Config = function (mode, args) {
|
|
|
139
146
|
type: 'list',
|
|
140
147
|
message: 'Which device would you like to preview?',
|
|
141
148
|
choices: deviceNames
|
|
142
|
-
}
|
|
149
|
+
},
|
|
143
150
|
])];
|
|
144
151
|
case 1:
|
|
145
152
|
answers = _a.sent();
|
|
@@ -173,7 +180,8 @@ var chooseBuildTargetsV2Config = function (mode, args) {
|
|
|
173
180
|
unsupportedTargets_1.push(target);
|
|
174
181
|
}
|
|
175
182
|
});
|
|
176
|
-
unsupportedTargets_1.length &&
|
|
183
|
+
unsupportedTargets_1.length &&
|
|
184
|
+
zeppos_app_utils_1.logger.warn("Unsupported targets(".concat(unsupportedTargets_1.join(', '), ") have been removed."));
|
|
177
185
|
}
|
|
178
186
|
targets = Object.keys((0, lodash_1.get)(appJsonContent, 'targets', {}));
|
|
179
187
|
returnRes = [];
|
|
@@ -206,7 +214,9 @@ var chooseBuildTargetsV2Config = function (mode, args) {
|
|
|
206
214
|
name: 'target',
|
|
207
215
|
type: 'checkbox',
|
|
208
216
|
when: function (args) {
|
|
209
|
-
var arr = typeof promptTarget_1 === 'string'
|
|
217
|
+
var arr = typeof promptTarget_1 === 'string'
|
|
218
|
+
? (0, lodash_1.intersection)(targets, promptTarget_1.split(','))
|
|
219
|
+
: [];
|
|
210
220
|
var bool = !!arr.length;
|
|
211
221
|
if (bool) {
|
|
212
222
|
args.target = arr;
|
|
@@ -219,11 +229,12 @@ var chooseBuildTargetsV2Config = function (mode, args) {
|
|
|
219
229
|
checked: true
|
|
220
230
|
}); }),
|
|
221
231
|
message: 'Which targets would you like to build?'
|
|
222
|
-
}
|
|
232
|
+
},
|
|
223
233
|
])];
|
|
224
234
|
case 3:
|
|
225
235
|
answers = _b.sent();
|
|
226
|
-
returnRes =
|
|
236
|
+
returnRes =
|
|
237
|
+
typeof answers.target === 'string' ? [answers.target] : answers.target;
|
|
227
238
|
_b.label = 4;
|
|
228
239
|
case 4:
|
|
229
240
|
if (!process.env._targetDeviceToBuild) {
|
|
@@ -298,7 +309,9 @@ var buildPreview = function (args, callback) { return __awaiter(void 0, void 0,
|
|
|
298
309
|
switch (_e.label) {
|
|
299
310
|
case 0:
|
|
300
311
|
_a = args._, curCommand = _a[0], curBridgeTarget = _a[1];
|
|
301
|
-
buildMode =
|
|
312
|
+
buildMode = curBridgeTarget && curBridgeTarget === 'simulator'
|
|
313
|
+
? BuildMode.DEV
|
|
314
|
+
: BuildMode.PREVIEW;
|
|
302
315
|
zeppos_app_utils_1.logger.info('building...');
|
|
303
316
|
appType = (0, lodash_1.get)(appJsonContent, 'app.appType');
|
|
304
317
|
_c = (_b = Object).assign;
|
|
@@ -310,14 +323,18 @@ var buildPreview = function (args, callback) { return __awaiter(void 0, void 0,
|
|
|
310
323
|
case 2:
|
|
311
324
|
buildInfo = _e.sent();
|
|
312
325
|
zeppos_app_utils_1.logger.info('getting package...');
|
|
313
|
-
return [4, zeppos_app_utils_1.modules
|
|
326
|
+
return [4, zeppos_app_utils_1.modules
|
|
327
|
+
.previewBuild(path.resolve('./'), args, "./dist/".concat(buildInfo), appType, curCommand)
|
|
328
|
+
.then(function (res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
314
329
|
return __generator(this, function (_a) {
|
|
315
330
|
switch (_a.label) {
|
|
316
331
|
case 0:
|
|
317
332
|
if (!(res.type === 'preview')) return [3, 1];
|
|
318
333
|
zeppos_app_utils_1.logger.info('Generating preview QR code...');
|
|
319
334
|
zeppos_app_utils_1.logger.success("Please use Zepp APP to scan the following QR code to preview your ".concat(appType === AppType.WATCHFACE ? 'WatchFace' : 'application', "."));
|
|
320
|
-
zeppos_app_utils_1.logger.success("The QR code will expire on ".concat((0, dayjs_1["default"])()
|
|
335
|
+
zeppos_app_utils_1.logger.success("The QR code will expire on ".concat((0, dayjs_1["default"])()
|
|
336
|
+
.add(2, 'hour')
|
|
337
|
+
.format('YYYY-MM-DD HH:mm:ss'), "."));
|
|
321
338
|
qrcode_terminal_1["default"].generate(res.url, { small: true });
|
|
322
339
|
callback && callback(res);
|
|
323
340
|
return [3, 4];
|
package/package.json
CHANGED
|
@@ -12,6 +12,15 @@ var DeviceTarget;
|
|
|
12
12
|
DeviceTarget["BARI"] = "bari";
|
|
13
13
|
DeviceTarget["BERLIN"] = "berlin";
|
|
14
14
|
DeviceTarget["LILLE"] = "lille";
|
|
15
|
+
DeviceTarget["VIENNA"] = "vienna";
|
|
16
|
+
DeviceTarget["ANDES"] = "andes";
|
|
17
|
+
DeviceTarget["MONACO"] = "monaco";
|
|
18
|
+
DeviceTarget["SWIFT"] = "swift";
|
|
19
|
+
DeviceTarget["SWORDFISH"] = "swordfish";
|
|
20
|
+
DeviceTarget["CHEETAH"] = "cheetah";
|
|
21
|
+
DeviceTarget["HANNOVER"] = "hannover";
|
|
22
|
+
DeviceTarget["ETNA"] = "etna";
|
|
23
|
+
DeviceTarget["ALTAI"] = "altai";
|
|
15
24
|
})(DeviceTarget = exports.DeviceTarget || (exports.DeviceTarget = {}));
|
|
16
25
|
var DevicePlatformName;
|
|
17
26
|
(function (DevicePlatformName) {
|
|
@@ -33,6 +42,21 @@ var DevicePlatformName;
|
|
|
33
42
|
DevicePlatformName["BERLIN_W"] = "gtr4-w";
|
|
34
43
|
DevicePlatformName["LILLE"] = "gts4";
|
|
35
44
|
DevicePlatformName["LILLE_W"] = "gts4-w";
|
|
45
|
+
DevicePlatformName["VIENNA"] = "falcon";
|
|
46
|
+
DevicePlatformName["VIENNA_W"] = "falcon-w";
|
|
47
|
+
DevicePlatformName["ANDES"] = "t-rex-ultra";
|
|
48
|
+
DevicePlatformName["ANDES_W"] = "t-rex-ultra-w";
|
|
49
|
+
DevicePlatformName["MONACO"] = "monaco";
|
|
50
|
+
DevicePlatformName["MONACO_WN"] = "monaco-wn";
|
|
51
|
+
DevicePlatformName["MONACO_W"] = "monaco-w";
|
|
52
|
+
DevicePlatformName["SWIFT"] = "swift";
|
|
53
|
+
DevicePlatformName["SWIFT_W"] = "swift-w";
|
|
54
|
+
DevicePlatformName["SWORDFISH_W"] = "swordfish-w";
|
|
55
|
+
DevicePlatformName["CHEETAH_W"] = "cheetah-w";
|
|
56
|
+
DevicePlatformName["HANNOVER"] = "hannover";
|
|
57
|
+
DevicePlatformName["ETNA"] = "etna";
|
|
58
|
+
DevicePlatformName["ETNA_W"] = "etna-w";
|
|
59
|
+
DevicePlatformName["ALTAI"] = "altai";
|
|
36
60
|
})(DevicePlatformName = exports.DevicePlatformName || (exports.DevicePlatformName = {}));
|
|
37
61
|
var DeviceSource;
|
|
38
62
|
(function (DeviceSource) {
|
|
@@ -54,11 +78,27 @@ var DeviceSource;
|
|
|
54
78
|
DeviceSource[DeviceSource["BERLIN_W"] = 7930113] = "BERLIN_W";
|
|
55
79
|
DeviceSource[DeviceSource["LILLE"] = 7995648] = "LILLE";
|
|
56
80
|
DeviceSource[DeviceSource["LILLE_W"] = 7995649] = "LILLE_W";
|
|
81
|
+
DeviceSource[DeviceSource["VIENNA"] = 414] = "VIENNA";
|
|
82
|
+
DeviceSource[DeviceSource["VIENNA_W"] = 415] = "VIENNA_W";
|
|
83
|
+
DeviceSource[DeviceSource["ANDES"] = 6553856] = "ANDES";
|
|
84
|
+
DeviceSource[DeviceSource["ANDES_W"] = 6553857] = "ANDES_W";
|
|
85
|
+
DeviceSource[DeviceSource["MONACO"] = 8519936] = "MONACO";
|
|
86
|
+
DeviceSource[DeviceSource["MONACO_WN"] = 8519937] = "MONACO_WN";
|
|
87
|
+
DeviceSource[DeviceSource["MONACO_W"] = 8519939] = "MONACO_W";
|
|
88
|
+
DeviceSource[DeviceSource["SWIFT"] = 8192256] = "SWIFT";
|
|
89
|
+
DeviceSource[DeviceSource["SWIFT_W"] = 8192257] = "SWIFT_W";
|
|
90
|
+
DeviceSource[DeviceSource["SWORDFISH_W"] = 8257793] = "SWORDFISH_W";
|
|
91
|
+
DeviceSource[DeviceSource["CHEETAH_W"] = 8126721] = "CHEETAH_W";
|
|
92
|
+
DeviceSource[DeviceSource["HANNOVER"] = 8323329] = "HANNOVER";
|
|
93
|
+
DeviceSource[DeviceSource["ETNA"] = 8388864] = "ETNA";
|
|
94
|
+
DeviceSource[DeviceSource["ETNA_W"] = 8388865] = "ETNA_W";
|
|
95
|
+
DeviceSource[DeviceSource["ALTAI"] = 8454401] = "ALTAI";
|
|
57
96
|
})(DeviceSource = exports.DeviceSource || (exports.DeviceSource = {}));
|
|
58
97
|
var DeviceScreenType;
|
|
59
98
|
(function (DeviceScreenType) {
|
|
60
99
|
DeviceScreenType["R"] = "r";
|
|
61
100
|
DeviceScreenType["S"] = "s";
|
|
101
|
+
DeviceScreenType["B"] = "b";
|
|
62
102
|
})(DeviceScreenType = exports.DeviceScreenType || (exports.DeviceScreenType = {}));
|
|
63
103
|
exports.deviceTargets = (_a = {},
|
|
64
104
|
_a[DeviceTarget.MADRID] = {
|
|
@@ -192,7 +232,7 @@ exports.deviceTargets = (_a = {},
|
|
|
192
232
|
}
|
|
193
233
|
],
|
|
194
234
|
screen: {
|
|
195
|
-
type: DeviceScreenType.
|
|
235
|
+
type: DeviceScreenType.B,
|
|
196
236
|
width: 194,
|
|
197
237
|
height: 368
|
|
198
238
|
},
|
|
@@ -243,12 +283,202 @@ exports.deviceTargets = (_a = {},
|
|
|
243
283
|
min: '1.0.0'
|
|
244
284
|
}
|
|
245
285
|
},
|
|
286
|
+
_a[DeviceTarget.VIENNA] = {
|
|
287
|
+
deviceName: 'Falcon',
|
|
288
|
+
platforms: [
|
|
289
|
+
{
|
|
290
|
+
name: DevicePlatformName.VIENNA,
|
|
291
|
+
deviceSource: DeviceSource.VIENNA
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: DevicePlatformName.VIENNA_W,
|
|
295
|
+
deviceSource: DeviceSource.VIENNA_W
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
screen: {
|
|
299
|
+
type: DeviceScreenType.R,
|
|
300
|
+
width: 416,
|
|
301
|
+
height: 416
|
|
302
|
+
},
|
|
303
|
+
apiLevelLimit: {
|
|
304
|
+
min: '1.0.0',
|
|
305
|
+
max: '1.99.99'
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
_a[DeviceTarget.ANDES] = {
|
|
309
|
+
deviceName: 'T-Rex Ultra',
|
|
310
|
+
platforms: [
|
|
311
|
+
{
|
|
312
|
+
name: DevicePlatformName.ANDES,
|
|
313
|
+
deviceSource: DeviceSource.ANDES
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: DevicePlatformName.ANDES_W,
|
|
317
|
+
deviceSource: DeviceSource.ANDES_W
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
screen: {
|
|
321
|
+
type: DeviceScreenType.R,
|
|
322
|
+
width: 454,
|
|
323
|
+
height: 454
|
|
324
|
+
},
|
|
325
|
+
apiLevelLimit: {
|
|
326
|
+
min: '1.0.0'
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
_a[DeviceTarget.MONACO] = {
|
|
330
|
+
deviceName: 'GTR 5',
|
|
331
|
+
platforms: [
|
|
332
|
+
{
|
|
333
|
+
name: DevicePlatformName.MONACO,
|
|
334
|
+
deviceSource: DeviceSource.MONACO
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: DevicePlatformName.MONACO_WN,
|
|
338
|
+
deviceSource: DeviceSource.MONACO_WN
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: DevicePlatformName.MONACO_W,
|
|
342
|
+
deviceSource: DeviceSource.MONACO_W
|
|
343
|
+
}
|
|
344
|
+
],
|
|
345
|
+
screen: {
|
|
346
|
+
type: DeviceScreenType.R,
|
|
347
|
+
width: 480,
|
|
348
|
+
height: 480
|
|
349
|
+
},
|
|
350
|
+
apiLevelLimit: {
|
|
351
|
+
min: '1.0.0'
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
_a[DeviceTarget.SWIFT] = {
|
|
355
|
+
deviceName: 'Runner (Round)',
|
|
356
|
+
platforms: [
|
|
357
|
+
{
|
|
358
|
+
name: DevicePlatformName.SWIFT,
|
|
359
|
+
deviceSource: DeviceSource.SWIFT
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
name: DevicePlatformName.SWIFT_W,
|
|
363
|
+
deviceSource: DeviceSource.SWIFT_W
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
screen: {
|
|
367
|
+
type: DeviceScreenType.R,
|
|
368
|
+
width: 454,
|
|
369
|
+
height: 454
|
|
370
|
+
},
|
|
371
|
+
apiLevelLimit: {
|
|
372
|
+
min: '1.0.0'
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
_a[DeviceTarget.SWORDFISH] = {
|
|
376
|
+
deviceName: 'Runner (Square)',
|
|
377
|
+
platforms: [
|
|
378
|
+
{
|
|
379
|
+
name: DevicePlatformName.SWORDFISH_W,
|
|
380
|
+
deviceSource: DeviceSource.SWORDFISH_W
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
screen: {
|
|
384
|
+
type: DeviceScreenType.S,
|
|
385
|
+
width: 390,
|
|
386
|
+
height: 450
|
|
387
|
+
},
|
|
388
|
+
apiLevelLimit: {
|
|
389
|
+
min: '1.0.0'
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
_a[DeviceTarget.CHEETAH] = {
|
|
393
|
+
deviceName: 'Runner Pro',
|
|
394
|
+
platforms: [
|
|
395
|
+
{
|
|
396
|
+
name: DevicePlatformName.CHEETAH_W,
|
|
397
|
+
deviceSource: DeviceSource.CHEETAH_W
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
screen: {
|
|
401
|
+
type: DeviceScreenType.R,
|
|
402
|
+
width: 480,
|
|
403
|
+
height: 480
|
|
404
|
+
},
|
|
405
|
+
apiLevelLimit: {
|
|
406
|
+
min: '1.0.0'
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
_a[DeviceTarget.HANNOVER] = {
|
|
410
|
+
deviceName: 'GTS 5 Active',
|
|
411
|
+
platforms: [
|
|
412
|
+
{
|
|
413
|
+
name: DevicePlatformName.HANNOVER,
|
|
414
|
+
deviceSource: DeviceSource.HANNOVER
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
screen: {
|
|
418
|
+
type: DeviceScreenType.S,
|
|
419
|
+
width: 390,
|
|
420
|
+
height: 450
|
|
421
|
+
},
|
|
422
|
+
apiLevelLimit: {
|
|
423
|
+
min: '1.0.0'
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
_a[DeviceTarget.ETNA] = {
|
|
427
|
+
deviceName: 'GTR Shock',
|
|
428
|
+
platforms: [
|
|
429
|
+
{
|
|
430
|
+
name: DevicePlatformName.ETNA,
|
|
431
|
+
deviceSource: DeviceSource.ETNA
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
name: DevicePlatformName.ETNA_W,
|
|
435
|
+
deviceSource: DeviceSource.ETNA_W
|
|
436
|
+
}
|
|
437
|
+
],
|
|
438
|
+
screen: {
|
|
439
|
+
type: DeviceScreenType.S,
|
|
440
|
+
width: 360,
|
|
441
|
+
height: 360
|
|
442
|
+
},
|
|
443
|
+
apiLevelLimit: {
|
|
444
|
+
min: '1.0.0'
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
_a[DeviceTarget.ALTAI] = {
|
|
448
|
+
deviceName: 'Bip 5s',
|
|
449
|
+
platforms: [
|
|
450
|
+
{
|
|
451
|
+
name: DevicePlatformName.ALTAI,
|
|
452
|
+
deviceSource: DeviceSource.ALTAI
|
|
453
|
+
}
|
|
454
|
+
],
|
|
455
|
+
screen: {
|
|
456
|
+
type: DeviceScreenType.S,
|
|
457
|
+
width: 320,
|
|
458
|
+
height: 380
|
|
459
|
+
},
|
|
460
|
+
apiLevelLimit: {
|
|
461
|
+
min: '1.0.0'
|
|
462
|
+
}
|
|
463
|
+
},
|
|
246
464
|
_a);
|
|
247
465
|
exports.OSV2Devices = [
|
|
248
466
|
DeviceSource.BERLIN,
|
|
249
467
|
DeviceSource.BERLIN_W,
|
|
250
468
|
DeviceSource.LILLE,
|
|
251
|
-
DeviceSource.LILLE_W
|
|
469
|
+
DeviceSource.LILLE_W,
|
|
470
|
+
DeviceTarget.ANDES,
|
|
471
|
+
DeviceSource.MONACO,
|
|
472
|
+
DeviceSource.MONACO_WN,
|
|
473
|
+
DeviceSource.MONACO_W,
|
|
474
|
+
DeviceSource.SWIFT,
|
|
475
|
+
DeviceSource.SWIFT_W,
|
|
476
|
+
DeviceSource.SWORDFISH_W,
|
|
477
|
+
DeviceSource.CHEETAH_W,
|
|
478
|
+
DeviceSource.HANNOVER,
|
|
479
|
+
DeviceSource.ETNA,
|
|
480
|
+
DeviceSource.ETNA_W,
|
|
481
|
+
DeviceSource.ALTAI
|
|
252
482
|
];
|
|
253
483
|
exports.OSV2DeviceTargetNames = Object.keys(exports.deviceTargets).reduce(function (targetNames, target) {
|
|
254
484
|
var flag = true;
|