@zeppos/zeus-cli 1.3.0-beta.5 → 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 +2 -2
- package/private-modules/zeppos-app-utils/dist/config/device.js +56 -1
- 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/private-modules/zeppos-app-utils/package.json +1 -1
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeppos/zeus-cli",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.6",
|
|
4
4
|
"description": "zeus mini-program tools",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"author": "zepp",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"qrcode-terminal": "^0.12.0",
|
|
22
22
|
"vorpal": "^1.12.0",
|
|
23
23
|
"yargs": "^17.5.1",
|
|
24
|
-
"@zeppos/zpm": "^2.9.
|
|
24
|
+
"@zeppos/zpm": "^2.9.14-beta",
|
|
25
25
|
"axios": "^0.27.2",
|
|
26
26
|
"chalk": "^4.1.2",
|
|
27
27
|
"chokidar": "^3.5.3",
|
|
@@ -12,6 +12,8 @@ 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";
|
|
15
17
|
DeviceTarget["MONACO"] = "monaco";
|
|
16
18
|
DeviceTarget["SWIFT"] = "swift";
|
|
17
19
|
DeviceTarget["SWORDFISH"] = "swordfish";
|
|
@@ -40,6 +42,10 @@ var DevicePlatformName;
|
|
|
40
42
|
DevicePlatformName["BERLIN_W"] = "gtr4-w";
|
|
41
43
|
DevicePlatformName["LILLE"] = "gts4";
|
|
42
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";
|
|
43
49
|
DevicePlatformName["MONACO"] = "monaco";
|
|
44
50
|
DevicePlatformName["MONACO_WN"] = "monaco-wn";
|
|
45
51
|
DevicePlatformName["MONACO_W"] = "monaco-w";
|
|
@@ -72,6 +78,10 @@ var DeviceSource;
|
|
|
72
78
|
DeviceSource[DeviceSource["BERLIN_W"] = 7930113] = "BERLIN_W";
|
|
73
79
|
DeviceSource[DeviceSource["LILLE"] = 7995648] = "LILLE";
|
|
74
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";
|
|
75
85
|
DeviceSource[DeviceSource["MONACO"] = 8519936] = "MONACO";
|
|
76
86
|
DeviceSource[DeviceSource["MONACO_WN"] = 8519937] = "MONACO_WN";
|
|
77
87
|
DeviceSource[DeviceSource["MONACO_W"] = 8519939] = "MONACO_W";
|
|
@@ -88,6 +98,7 @@ var DeviceScreenType;
|
|
|
88
98
|
(function (DeviceScreenType) {
|
|
89
99
|
DeviceScreenType["R"] = "r";
|
|
90
100
|
DeviceScreenType["S"] = "s";
|
|
101
|
+
DeviceScreenType["B"] = "b";
|
|
91
102
|
})(DeviceScreenType = exports.DeviceScreenType || (exports.DeviceScreenType = {}));
|
|
92
103
|
exports.deviceTargets = (_a = {},
|
|
93
104
|
_a[DeviceTarget.MADRID] = {
|
|
@@ -221,7 +232,7 @@ exports.deviceTargets = (_a = {},
|
|
|
221
232
|
}
|
|
222
233
|
],
|
|
223
234
|
screen: {
|
|
224
|
-
type: DeviceScreenType.
|
|
235
|
+
type: DeviceScreenType.B,
|
|
225
236
|
width: 194,
|
|
226
237
|
height: 368
|
|
227
238
|
},
|
|
@@ -272,6 +283,49 @@ exports.deviceTargets = (_a = {},
|
|
|
272
283
|
min: '1.0.0'
|
|
273
284
|
}
|
|
274
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
|
+
},
|
|
275
329
|
_a[DeviceTarget.MONACO] = {
|
|
276
330
|
deviceName: 'GTR 5',
|
|
277
331
|
platforms: [
|
|
@@ -413,6 +467,7 @@ exports.OSV2Devices = [
|
|
|
413
467
|
DeviceSource.BERLIN_W,
|
|
414
468
|
DeviceSource.LILLE,
|
|
415
469
|
DeviceSource.LILLE_W,
|
|
470
|
+
DeviceTarget.ANDES,
|
|
416
471
|
DeviceSource.MONACO,
|
|
417
472
|
DeviceSource.MONACO_WN,
|
|
418
473
|
DeviceSource.MONACO_W,
|