@zeppos/zeus-cli 1.3.0-beta.6 → 1.3.0-beta.7

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 CHANGED
@@ -126,9 +126,9 @@ var chooseBuildTargetsV3Config = function (mode, args) {
126
126
  targetDevices = {};
127
127
  Object.values(deviceTargets).forEach(function (device) {
128
128
  var _a;
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;
129
+ var _b = device.apiLevelLimit || {}, min = _b.min, max = _b.max;
130
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) {
131
+ if ((0, tools_1.compareVersion)(min || '1.0.0', apiLevel) >= 0 && (0, tools_1.compareVersion)(max || '99.99.99', apiLevel) < 0) {
132
132
  Object.assign(targetDevices, (_a = {},
133
133
  _a[device.deviceName] = device,
134
134
  _a));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeppos/zeus-cli",
3
- "version": "1.3.0-beta.6",
3
+ "version": "1.3.0-beta.7",
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.14-beta",
24
+ "@zeppos/zpm": "^2.9.18-beta",
25
25
  "axios": "^0.27.2",
26
26
  "chalk": "^4.1.2",
27
27
  "chokidar": "^3.5.3",
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ exports.__esModule = true;
29
+ exports.DeviceScreenType = void 0;
30
+ var axios_1 = __importDefault(require("axios"));
31
+ var os = __importStar(require("os"));
32
+ var path = __importStar(require("path"));
33
+ var fs = __importStar(require("fs"));
34
+ var fs_extra_1 = __importDefault(require("fs-extra"));
35
+ var lodash_1 = require("lodash");
36
+ var LOCAL_CACHE_DEVICE_PATH = path.resolve(os.homedir(), ".zepp/.zeus_device");
37
+ var serverPath = 'https://upload-cdn.zepp.com/zeppos/devkit/zeus/devices.json';
38
+ var DeviceScreenType;
39
+ (function (DeviceScreenType) {
40
+ DeviceScreenType["R"] = "r";
41
+ DeviceScreenType["S"] = "s";
42
+ DeviceScreenType["B"] = "b";
43
+ })(DeviceScreenType = exports.DeviceScreenType || (exports.DeviceScreenType = {}));
44
+ var shapeMap = {
45
+ square: DeviceScreenType.S,
46
+ round: DeviceScreenType.R,
47
+ bar: DeviceScreenType.B
48
+ };
49
+ var localContent = {};
50
+ if (fs.existsSync(LOCAL_CACHE_DEVICE_PATH)) {
51
+ try {
52
+ localContent = fs_extra_1["default"].readJsonSync(LOCAL_CACHE_DEVICE_PATH);
53
+ }
54
+ catch (_e) { }
55
+ }
56
+ var now = Date.now().valueOf();
57
+ if (!((0, lodash_1.get)(localContent, 'expiredTime') > now)) {
58
+ axios_1["default"].get(serverPath).then(function (res) {
59
+ if (res.status === 200) {
60
+ var data = res.data;
61
+ if (!(0, lodash_1.isEmpty)(data)) {
62
+ fs_extra_1["default"].writeJsonSync(LOCAL_CACHE_DEVICE_PATH, {
63
+ devices: data,
64
+ expiredTime: now + 24 * 60 * 60 * 1000
65
+ });
66
+ }
67
+ }
68
+ });
69
+ }
70
+ var deviceList = (0, lodash_1.get)(localContent, 'devices', []);
71
+ var deviceGroup = (0, lodash_1.groupBy)(deviceList, 'productName');
72
+ var deviceInfo = {};
73
+ Object.values(deviceGroup).forEach(function (devices) {
74
+ var _a;
75
+ var info = {
76
+ deviceName: '',
77
+ platforms: [],
78
+ screen: {
79
+ type: DeviceScreenType.R,
80
+ width: 0,
81
+ height: 0
82
+ },
83
+ apiLevelLimit: {
84
+ min: '1.0.0'
85
+ }
86
+ };
87
+ var deviceInnerName = devices.reduce(function (acc, cur) {
88
+ !info.deviceName && (info.deviceName = cur.productName);
89
+ var screenType = (0, lodash_1.get)(shapeMap, (0, lodash_1.get)(cur, 'value.shape'));
90
+ var _a = (0, lodash_1.get)(cur, 'value.screen.size', '').split('*'), width = _a[0], height = _a[1];
91
+ if (screenType) {
92
+ info.screen.type = screenType;
93
+ }
94
+ if (width && height) {
95
+ info.screen.width = Number(width);
96
+ info.screen.height = Number(height);
97
+ }
98
+ info.platforms.push({
99
+ name: cur.code,
100
+ deviceSource: cur.deviceSource
101
+ });
102
+ Object.assign(info.apiLevelLimit, {
103
+ min: (0, lodash_1.get)(cur, 'value.os.apiLevelLimitMin', '1.0.0'),
104
+ max: (0, lodash_1.get)(cur, 'value.os.apiLevelLimitMax', '')
105
+ });
106
+ return cur.code.length < acc.length ? cur.code : acc;
107
+ }, devices[0].code);
108
+ var lowerName = (0, lodash_1.toLower)(deviceInnerName.replace(/[^a-zA-Z]/g, ''));
109
+ lowerName && Object.assign(deviceInfo, (_a = {},
110
+ _a[lowerName] = info,
111
+ _a));
112
+ });
113
+ exports["default"] = deviceInfo;
@@ -1,7 +1,24 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
2
16
  var _a;
3
17
  exports.__esModule = true;
4
18
  exports.deviceInternalCodeName = exports.OSV2DeviceTargetNames = exports.OSV2Devices = exports.deviceTargets = exports.DeviceScreenType = exports.DeviceSource = exports.DevicePlatformName = exports.DeviceTarget = void 0;
19
+ var lodash_1 = require("lodash");
20
+ var device_server_1 = __importDefault(require("./device-server"));
21
+ var tools_1 = require("../tools/tools");
5
22
  var DeviceTarget;
6
23
  (function (DeviceTarget) {
7
24
  DeviceTarget["MADRID"] = "madrid";
@@ -16,8 +33,8 @@ var DeviceTarget;
16
33
  DeviceTarget["ANDES"] = "andes";
17
34
  DeviceTarget["MONACO"] = "monaco";
18
35
  DeviceTarget["SWIFT"] = "swift";
19
- DeviceTarget["SWORDFISH"] = "swordfish";
20
- DeviceTarget["CHEETAH"] = "cheetah";
36
+ DeviceTarget["SWORDFISH"] = "swordfishw";
37
+ DeviceTarget["CHEETAH"] = "cheetahw";
21
38
  DeviceTarget["HANNOVER"] = "hannover";
22
39
  DeviceTarget["ETNA"] = "etna";
23
40
  DeviceTarget["ALTAI"] = "altai";
@@ -100,386 +117,360 @@ var DeviceScreenType;
100
117
  DeviceScreenType["S"] = "s";
101
118
  DeviceScreenType["B"] = "b";
102
119
  })(DeviceScreenType = exports.DeviceScreenType || (exports.DeviceScreenType = {}));
103
- exports.deviceTargets = (_a = {},
104
- _a[DeviceTarget.MADRID] = {
105
- deviceName: 'GTR3 Pro',
106
- platforms: [
107
- {
108
- name: DevicePlatformName.MADRID,
109
- deviceSource: DeviceSource.MADRID
110
- },
111
- {
112
- name: DevicePlatformName.MADRIDW,
113
- deviceSource: DeviceSource.MADRIDW
114
- },
115
- {
116
- name: DevicePlatformName.Madrid2,
117
- deviceSource: DeviceSource.Madrid2
118
- }
119
- ],
120
- screen: {
121
- type: DeviceScreenType.R,
122
- width: 480,
123
- height: 480
124
- },
125
- apiLevelLimit: {
126
- min: '1.0.0',
127
- max: '1.99.99'
128
- }
120
+ exports.deviceTargets = __assign((_a = {}, _a[DeviceTarget.MADRID] = {
121
+ deviceName: 'GTR3 Pro',
122
+ platforms: [
123
+ {
124
+ name: DevicePlatformName.MADRID,
125
+ deviceSource: DeviceSource.MADRID
126
+ },
127
+ {
128
+ name: DevicePlatformName.MADRIDW,
129
+ deviceSource: DeviceSource.MADRIDW
130
+ },
131
+ {
132
+ name: DevicePlatformName.Madrid2,
133
+ deviceSource: DeviceSource.Madrid2
134
+ },
135
+ ],
136
+ screen: {
137
+ type: DeviceScreenType.R,
138
+ width: 480,
139
+ height: 480
129
140
  },
130
- _a[DeviceTarget.VERONA] = {
131
- deviceName: 'GTR3',
132
- platforms: [
133
- {
134
- name: DevicePlatformName.VERONA,
135
- deviceSource: DeviceSource.VERONA
136
- },
137
- {
138
- name: DevicePlatformName.VERONAW,
139
- deviceSource: DeviceSource.VERONAW
140
- }
141
- ],
142
- screen: {
143
- type: DeviceScreenType.R,
144
- width: 454,
145
- height: 454
146
- },
147
- apiLevelLimit: {
148
- min: '1.0.0',
149
- max: '1.99.99'
150
- }
141
+ apiLevelLimit: {
142
+ min: '1.0.0',
143
+ max: '1.99.99'
144
+ }
145
+ }, _a[DeviceTarget.VERONA] = {
146
+ deviceName: 'GTR3',
147
+ platforms: [
148
+ {
149
+ name: DevicePlatformName.VERONA,
150
+ deviceSource: DeviceSource.VERONA
151
+ },
152
+ {
153
+ name: DevicePlatformName.VERONAW,
154
+ deviceSource: DeviceSource.VERONAW
155
+ },
156
+ ],
157
+ screen: {
158
+ type: DeviceScreenType.R,
159
+ width: 454,
160
+ height: 454
151
161
  },
152
- _a[DeviceTarget.ZURICH] = {
153
- deviceName: 'GTS3',
154
- platforms: [
155
- {
156
- name: DevicePlatformName.ZURICH,
157
- deviceSource: DeviceSource.ZURICH
158
- },
159
- {
160
- name: DevicePlatformName.ZURICHW,
161
- deviceSource: DeviceSource.ZURICHW
162
- }
163
- ],
164
- screen: {
165
- type: DeviceScreenType.S,
166
- width: 390,
167
- height: 450
168
- },
169
- apiLevelLimit: {
170
- min: '1.0.0',
171
- max: '1.99.99'
172
- }
162
+ apiLevelLimit: {
163
+ min: '1.0.0',
164
+ max: '1.99.99'
165
+ }
166
+ }, _a[DeviceTarget.ZURICH] = {
167
+ deviceName: 'GTS3',
168
+ platforms: [
169
+ {
170
+ name: DevicePlatformName.ZURICH,
171
+ deviceSource: DeviceSource.ZURICH
172
+ },
173
+ {
174
+ name: DevicePlatformName.ZURICHW,
175
+ deviceSource: DeviceSource.ZURICHW
176
+ },
177
+ ],
178
+ screen: {
179
+ type: DeviceScreenType.S,
180
+ width: 390,
181
+ height: 450
173
182
  },
174
- _a[DeviceTarget.TEIDE] = {
175
- deviceName: 'T-Rex2',
176
- platforms: [
177
- {
178
- name: DevicePlatformName.TEIDE,
179
- deviceSource: DeviceSource.TEIDE
180
- },
181
- {
182
- name: DevicePlatformName.TEIDEW,
183
- deviceSource: DeviceSource.TEIDEW
184
- }
185
- ],
186
- screen: {
187
- type: DeviceScreenType.R,
188
- width: 454,
189
- height: 454
190
- },
191
- apiLevelLimit: {
192
- min: '1.0.0',
193
- max: '1.99.99'
194
- }
183
+ apiLevelLimit: {
184
+ min: '1.0.0',
185
+ max: '1.99.99'
186
+ }
187
+ }, _a[DeviceTarget.TEIDE] = {
188
+ deviceName: 'T-Rex2',
189
+ platforms: [
190
+ {
191
+ name: DevicePlatformName.TEIDE,
192
+ deviceSource: DeviceSource.TEIDE
193
+ },
194
+ {
195
+ name: DevicePlatformName.TEIDEW,
196
+ deviceSource: DeviceSource.TEIDEW
197
+ },
198
+ ],
199
+ screen: {
200
+ type: DeviceScreenType.R,
201
+ width: 454,
202
+ height: 454
195
203
  },
196
- _a[DeviceTarget.PROVENCE] = {
197
- deviceName: 'GTS4 mini',
198
- platforms: [
199
- {
200
- name: DevicePlatformName.PROVENCE,
201
- deviceSource: DeviceSource.PROVENCE
202
- },
203
- {
204
- name: DevicePlatformName.PROVENCEW,
205
- deviceSource: DeviceSource.PROVENCEW
206
- }
207
- ],
208
- screen: {
209
- type: DeviceScreenType.S,
210
- width: 336,
211
- height: 384
212
- },
213
- apiLevelLimit: {
214
- min: '1.0.0',
215
- max: '1.99.99'
216
- }
204
+ apiLevelLimit: {
205
+ min: '1.0.0',
206
+ max: '1.99.99'
207
+ }
208
+ }, _a[DeviceTarget.PROVENCE] = {
209
+ deviceName: 'GTS4 mini',
210
+ platforms: [
211
+ {
212
+ name: DevicePlatformName.PROVENCE,
213
+ deviceSource: DeviceSource.PROVENCE
214
+ },
215
+ {
216
+ name: DevicePlatformName.PROVENCEW,
217
+ deviceSource: DeviceSource.PROVENCEW
218
+ },
219
+ ],
220
+ screen: {
221
+ type: DeviceScreenType.S,
222
+ width: 336,
223
+ height: 384
217
224
  },
218
- _a[DeviceTarget.BARI] = {
219
- deviceName: 'Amazfit Band 7',
220
- platforms: [
221
- {
222
- name: DevicePlatformName.BARI_NFC,
223
- deviceSource: DeviceSource.BARI_NFC
224
- },
225
- {
226
- name: DevicePlatformName.BARI,
227
- deviceSource: DeviceSource.BARI
228
- },
229
- {
230
- name: DevicePlatformName.BARI_W,
231
- deviceSource: DeviceSource.BARI_W
232
- }
233
- ],
234
- screen: {
235
- type: DeviceScreenType.B,
236
- width: 194,
237
- height: 368
238
- },
239
- apiLevelLimit: {
240
- min: '1.0.0',
241
- max: '1.99.99'
242
- }
225
+ apiLevelLimit: {
226
+ min: '1.0.0',
227
+ max: '1.99.99'
228
+ }
229
+ }, _a[DeviceTarget.BARI] = {
230
+ deviceName: 'Amazfit Band 7',
231
+ platforms: [
232
+ {
233
+ name: DevicePlatformName.BARI_NFC,
234
+ deviceSource: DeviceSource.BARI_NFC
235
+ },
236
+ {
237
+ name: DevicePlatformName.BARI,
238
+ deviceSource: DeviceSource.BARI
239
+ },
240
+ {
241
+ name: DevicePlatformName.BARI_W,
242
+ deviceSource: DeviceSource.BARI_W
243
+ },
244
+ ],
245
+ screen: {
246
+ type: DeviceScreenType.B,
247
+ width: 194,
248
+ height: 368
243
249
  },
244
- _a[DeviceTarget.BERLIN] = {
245
- deviceName: 'GTR 4',
246
- platforms: [
247
- {
248
- name: DevicePlatformName.BERLIN,
249
- deviceSource: DeviceSource.BERLIN
250
- },
251
- {
252
- name: DevicePlatformName.BERLIN_W,
253
- deviceSource: DeviceSource.BERLIN_W
254
- }
255
- ],
256
- screen: {
257
- type: DeviceScreenType.R,
258
- width: 466,
259
- height: 466
260
- },
261
- apiLevelLimit: {
262
- min: '1.0.0'
263
- }
250
+ apiLevelLimit: {
251
+ min: '1.0.0',
252
+ max: '1.99.99'
253
+ }
254
+ }, _a[DeviceTarget.BERLIN] = {
255
+ deviceName: 'GTR 4',
256
+ platforms: [
257
+ {
258
+ name: DevicePlatformName.BERLIN,
259
+ deviceSource: DeviceSource.BERLIN
260
+ },
261
+ {
262
+ name: DevicePlatformName.BERLIN_W,
263
+ deviceSource: DeviceSource.BERLIN_W
264
+ },
265
+ ],
266
+ screen: {
267
+ type: DeviceScreenType.R,
268
+ width: 466,
269
+ height: 466
264
270
  },
265
- _a[DeviceTarget.LILLE] = {
266
- deviceName: 'GTS 4',
267
- platforms: [
268
- {
269
- name: DevicePlatformName.LILLE,
270
- deviceSource: DeviceSource.LILLE
271
- },
272
- {
273
- name: DevicePlatformName.LILLE_W,
274
- deviceSource: DeviceSource.LILLE_W
275
- }
276
- ],
277
- screen: {
278
- type: DeviceScreenType.S,
279
- width: 390,
280
- height: 450
281
- },
282
- apiLevelLimit: {
283
- min: '1.0.0'
284
- }
271
+ apiLevelLimit: {
272
+ min: '1.0.0'
273
+ }
274
+ }, _a[DeviceTarget.LILLE] = {
275
+ deviceName: 'GTS 4',
276
+ platforms: [
277
+ {
278
+ name: DevicePlatformName.LILLE,
279
+ deviceSource: DeviceSource.LILLE
280
+ },
281
+ {
282
+ name: DevicePlatformName.LILLE_W,
283
+ deviceSource: DeviceSource.LILLE_W
284
+ },
285
+ ],
286
+ screen: {
287
+ type: DeviceScreenType.S,
288
+ width: 390,
289
+ height: 450
285
290
  },
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
- }
291
+ apiLevelLimit: {
292
+ min: '1.0.0'
293
+ }
294
+ }, _a[DeviceTarget.VIENNA] = {
295
+ deviceName: 'Falcon',
296
+ platforms: [
297
+ {
298
+ name: DevicePlatformName.VIENNA,
299
+ deviceSource: DeviceSource.VIENNA
300
+ },
301
+ {
302
+ name: DevicePlatformName.VIENNA_W,
303
+ deviceSource: DeviceSource.VIENNA_W
304
+ },
305
+ ],
306
+ screen: {
307
+ type: DeviceScreenType.R,
308
+ width: 416,
309
+ height: 416
307
310
  },
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
- }
311
+ apiLevelLimit: {
312
+ min: '1.0.0',
313
+ max: '1.99.99'
314
+ }
315
+ }, _a[DeviceTarget.ANDES] = {
316
+ deviceName: 'T-Rex Ultra',
317
+ platforms: [
318
+ {
319
+ name: DevicePlatformName.ANDES,
320
+ deviceSource: DeviceSource.ANDES
321
+ },
322
+ {
323
+ name: DevicePlatformName.ANDES_W,
324
+ deviceSource: DeviceSource.ANDES_W
325
+ },
326
+ ],
327
+ screen: {
328
+ type: DeviceScreenType.R,
329
+ width: 454,
330
+ height: 454
328
331
  },
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
- }
332
+ apiLevelLimit: {
333
+ min: '1.0.0'
334
+ }
335
+ }, _a[DeviceTarget.MONACO] = {
336
+ deviceName: 'GTR 5',
337
+ platforms: [
338
+ {
339
+ name: DevicePlatformName.MONACO,
340
+ deviceSource: DeviceSource.MONACO
341
+ },
342
+ {
343
+ name: DevicePlatformName.MONACO_WN,
344
+ deviceSource: DeviceSource.MONACO_WN
345
+ },
346
+ {
347
+ name: DevicePlatformName.MONACO_W,
348
+ deviceSource: DeviceSource.MONACO_W
349
+ },
350
+ ],
351
+ screen: {
352
+ type: DeviceScreenType.R,
353
+ width: 480,
354
+ height: 480
353
355
  },
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
- }
356
+ apiLevelLimit: {
357
+ min: '1.0.0'
358
+ }
359
+ }, _a[DeviceTarget.SWIFT] = {
360
+ deviceName: 'Runner (Round)',
361
+ platforms: [
362
+ {
363
+ name: DevicePlatformName.SWIFT,
364
+ deviceSource: DeviceSource.SWIFT
365
+ },
366
+ {
367
+ name: DevicePlatformName.SWIFT_W,
368
+ deviceSource: DeviceSource.SWIFT_W
369
+ },
370
+ ],
371
+ screen: {
372
+ type: DeviceScreenType.R,
373
+ width: 454,
374
+ height: 454
374
375
  },
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
- }
376
+ apiLevelLimit: {
377
+ min: '1.0.0'
378
+ }
379
+ }, _a[DeviceTarget.SWORDFISH] = {
380
+ deviceName: 'Runner (Square)',
381
+ platforms: [
382
+ {
383
+ name: DevicePlatformName.SWORDFISH_W,
384
+ deviceSource: DeviceSource.SWORDFISH_W
385
+ },
386
+ ],
387
+ screen: {
388
+ type: DeviceScreenType.S,
389
+ width: 390,
390
+ height: 450
391
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
- }
392
+ apiLevelLimit: {
393
+ min: '1.0.0'
394
+ }
395
+ }, _a[DeviceTarget.CHEETAH] = {
396
+ deviceName: 'Runner Pro',
397
+ platforms: [
398
+ {
399
+ name: DevicePlatformName.CHEETAH_W,
400
+ deviceSource: DeviceSource.CHEETAH_W
401
+ },
402
+ ],
403
+ screen: {
404
+ type: DeviceScreenType.R,
405
+ width: 480,
406
+ height: 480
408
407
  },
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
- }
408
+ apiLevelLimit: {
409
+ min: '1.0.0'
410
+ }
411
+ }, _a[DeviceTarget.HANNOVER] = {
412
+ deviceName: 'GTS 5 Active',
413
+ platforms: [
414
+ {
415
+ name: DevicePlatformName.HANNOVER,
416
+ deviceSource: DeviceSource.HANNOVER
417
+ },
418
+ ],
419
+ screen: {
420
+ type: DeviceScreenType.S,
421
+ width: 390,
422
+ height: 450
425
423
  },
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
- }
424
+ apiLevelLimit: {
425
+ min: '1.0.0'
426
+ }
427
+ }, _a[DeviceTarget.ETNA] = {
428
+ deviceName: 'GTR Shock',
429
+ platforms: [
430
+ {
431
+ name: DevicePlatformName.ETNA,
432
+ deviceSource: DeviceSource.ETNA
433
+ },
434
+ {
435
+ name: DevicePlatformName.ETNA_W,
436
+ deviceSource: DeviceSource.ETNA_W
437
+ },
438
+ ],
439
+ screen: {
440
+ type: DeviceScreenType.S,
441
+ width: 360,
442
+ height: 360
446
443
  },
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
- }
444
+ apiLevelLimit: {
445
+ min: '1.0.0'
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
463
459
  },
464
- _a);
465
- exports.OSV2Devices = [
466
- DeviceSource.BERLIN,
467
- DeviceSource.BERLIN_W,
468
- DeviceSource.LILLE,
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
482
- ];
460
+ apiLevelLimit: {
461
+ min: '1.0.0'
462
+ }
463
+ }, _a), device_server_1["default"]);
464
+ exports.OSV2Devices = Object.values(exports.deviceTargets).reduce(function (targetDevices, target) {
465
+ var _a = target.platforms, platforms = _a === void 0 ? [] : _a, _b = target.apiLevelLimit, apiLevelLimit = _b === void 0 ? {} : _b;
466
+ var min = apiLevelLimit.min, max = apiLevelLimit.max;
467
+ if (!(0, lodash_1.isEmpty)(platforms) &&
468
+ (0, tools_1.compareVersion)(min || '1.0.0', '2.0.0') >= 0 &&
469
+ (0, tools_1.compareVersion)(max || '99.99.99', '2.0.0') < 0) {
470
+ targetDevices.push.apply(targetDevices, platforms.reduce(function (list, o) { return (0, lodash_1.compact)(list.concat([o.deviceSource])); }, []));
471
+ }
472
+ return targetDevices;
473
+ }, []);
483
474
  exports.OSV2DeviceTargetNames = Object.keys(exports.deviceTargets).reduce(function (targetNames, target) {
484
475
  var flag = true;
485
476
  var _a = exports.deviceTargets[target].platforms, platforms = _a === void 0 ? [] : _a;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.compareVersion = exports.versionToCode = void 0;
4
+ var versionToCode = function (version) {
5
+ if (!version)
6
+ return 0;
7
+ var _a = version.split('.').map(function (val) { return Number(val); }), _b = _a[0], p0 = _b === void 0 ? 0 : _b, _c = _a[1], p1 = _c === void 0 ? 0 : _c, _d = _a[2], p2 = _d === void 0 ? 0 : _d;
8
+ return p0 * 10000 + p1 * 100 + p2;
9
+ };
10
+ exports.versionToCode = versionToCode;
11
+ var compareVersion = function (version1, version2) {
12
+ return (0, exports.versionToCode)(version2) - (0, exports.versionToCode)(version1);
13
+ };
14
+ exports.compareVersion = compareVersion;
@@ -12,7 +12,7 @@
12
12
  "clean": "rm -rf node_modules && rm -rf dist"
13
13
  },
14
14
  "dependencies": {
15
- "@zeppos/zpm": "^2.9.14-beta",
15
+ "@zeppos/zpm": "^2.9.18-beta",
16
16
  "axios": "^0.27.2",
17
17
  "chalk": "^4.1.2",
18
18
  "chokidar": "^3.5.3",