@zeppos/zeus-cli 1.3.0-beta.5 → 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
@@ -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
- 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, tools_1.compareVersion)(min, apiLevel) >= 0 && (0, tools_1.compareVersion)(max, apiLevel) <= 0) {
126
- Object.assign(targetDevices, (_a = {},
127
- _a[device.deviceName] = device,
128
- _a));
129
+ var _b = device.apiLevelLimit || {}, min = _b.min, max = _b.max;
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 || '1.0.0', apiLevel) >= 0 && (0, tools_1.compareVersion)(max || '99.99.99', 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 && zeppos_app_utils_1.logger.warn("Unsupported targets(".concat(unsupportedTargets_1.join(', '), ") have been removed."));
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' ? (0, lodash_1.intersection)(targets, promptTarget_1.split(',')) : [];
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 = typeof answers.target === 'string' ? [answers.target] : answers.target;
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 = (curBridgeTarget && curBridgeTarget === 'simulator') ? BuildMode.DEV : BuildMode.PREVIEW;
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.previewBuild(path.resolve('./'), args, "./dist/".concat(buildInfo), appType, curCommand).then(function (res) { return __awaiter(void 0, void 0, void 0, function () {
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"])().add(2, 'hour').format('YYYY-MM-DD HH:mm:ss'), "."));
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.5",
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.13-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";
@@ -12,10 +29,12 @@ var DeviceTarget;
12
29
  DeviceTarget["BARI"] = "bari";
13
30
  DeviceTarget["BERLIN"] = "berlin";
14
31
  DeviceTarget["LILLE"] = "lille";
32
+ DeviceTarget["VIENNA"] = "vienna";
33
+ DeviceTarget["ANDES"] = "andes";
15
34
  DeviceTarget["MONACO"] = "monaco";
16
35
  DeviceTarget["SWIFT"] = "swift";
17
- DeviceTarget["SWORDFISH"] = "swordfish";
18
- DeviceTarget["CHEETAH"] = "cheetah";
36
+ DeviceTarget["SWORDFISH"] = "swordfishw";
37
+ DeviceTarget["CHEETAH"] = "cheetahw";
19
38
  DeviceTarget["HANNOVER"] = "hannover";
20
39
  DeviceTarget["ETNA"] = "etna";
21
40
  DeviceTarget["ALTAI"] = "altai";
@@ -40,6 +59,10 @@ var DevicePlatformName;
40
59
  DevicePlatformName["BERLIN_W"] = "gtr4-w";
41
60
  DevicePlatformName["LILLE"] = "gts4";
42
61
  DevicePlatformName["LILLE_W"] = "gts4-w";
62
+ DevicePlatformName["VIENNA"] = "falcon";
63
+ DevicePlatformName["VIENNA_W"] = "falcon-w";
64
+ DevicePlatformName["ANDES"] = "t-rex-ultra";
65
+ DevicePlatformName["ANDES_W"] = "t-rex-ultra-w";
43
66
  DevicePlatformName["MONACO"] = "monaco";
44
67
  DevicePlatformName["MONACO_WN"] = "monaco-wn";
45
68
  DevicePlatformName["MONACO_W"] = "monaco-w";
@@ -72,6 +95,10 @@ var DeviceSource;
72
95
  DeviceSource[DeviceSource["BERLIN_W"] = 7930113] = "BERLIN_W";
73
96
  DeviceSource[DeviceSource["LILLE"] = 7995648] = "LILLE";
74
97
  DeviceSource[DeviceSource["LILLE_W"] = 7995649] = "LILLE_W";
98
+ DeviceSource[DeviceSource["VIENNA"] = 414] = "VIENNA";
99
+ DeviceSource[DeviceSource["VIENNA_W"] = 415] = "VIENNA_W";
100
+ DeviceSource[DeviceSource["ANDES"] = 6553856] = "ANDES";
101
+ DeviceSource[DeviceSource["ANDES_W"] = 6553857] = "ANDES_W";
75
102
  DeviceSource[DeviceSource["MONACO"] = 8519936] = "MONACO";
76
103
  DeviceSource[DeviceSource["MONACO_WN"] = 8519937] = "MONACO_WN";
77
104
  DeviceSource[DeviceSource["MONACO_W"] = 8519939] = "MONACO_W";
@@ -88,343 +115,362 @@ var DeviceScreenType;
88
115
  (function (DeviceScreenType) {
89
116
  DeviceScreenType["R"] = "r";
90
117
  DeviceScreenType["S"] = "s";
118
+ DeviceScreenType["B"] = "b";
91
119
  })(DeviceScreenType = exports.DeviceScreenType || (exports.DeviceScreenType = {}));
92
- exports.deviceTargets = (_a = {},
93
- _a[DeviceTarget.MADRID] = {
94
- deviceName: 'GTR3 Pro',
95
- platforms: [
96
- {
97
- name: DevicePlatformName.MADRID,
98
- deviceSource: DeviceSource.MADRID
99
- },
100
- {
101
- name: DevicePlatformName.MADRIDW,
102
- deviceSource: DeviceSource.MADRIDW
103
- },
104
- {
105
- name: DevicePlatformName.Madrid2,
106
- deviceSource: DeviceSource.Madrid2
107
- }
108
- ],
109
- screen: {
110
- type: DeviceScreenType.R,
111
- width: 480,
112
- height: 480
113
- },
114
- apiLevelLimit: {
115
- min: '1.0.0',
116
- max: '1.99.99'
117
- }
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
118
140
  },
119
- _a[DeviceTarget.VERONA] = {
120
- deviceName: 'GTR3',
121
- platforms: [
122
- {
123
- name: DevicePlatformName.VERONA,
124
- deviceSource: DeviceSource.VERONA
125
- },
126
- {
127
- name: DevicePlatformName.VERONAW,
128
- deviceSource: DeviceSource.VERONAW
129
- }
130
- ],
131
- screen: {
132
- type: DeviceScreenType.R,
133
- width: 454,
134
- height: 454
135
- },
136
- apiLevelLimit: {
137
- min: '1.0.0',
138
- max: '1.99.99'
139
- }
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
140
161
  },
141
- _a[DeviceTarget.ZURICH] = {
142
- deviceName: 'GTS3',
143
- platforms: [
144
- {
145
- name: DevicePlatformName.ZURICH,
146
- deviceSource: DeviceSource.ZURICH
147
- },
148
- {
149
- name: DevicePlatformName.ZURICHW,
150
- deviceSource: DeviceSource.ZURICHW
151
- }
152
- ],
153
- screen: {
154
- type: DeviceScreenType.S,
155
- width: 390,
156
- height: 450
157
- },
158
- apiLevelLimit: {
159
- min: '1.0.0',
160
- max: '1.99.99'
161
- }
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
162
182
  },
163
- _a[DeviceTarget.TEIDE] = {
164
- deviceName: 'T-Rex2',
165
- platforms: [
166
- {
167
- name: DevicePlatformName.TEIDE,
168
- deviceSource: DeviceSource.TEIDE
169
- },
170
- {
171
- name: DevicePlatformName.TEIDEW,
172
- deviceSource: DeviceSource.TEIDEW
173
- }
174
- ],
175
- screen: {
176
- type: DeviceScreenType.R,
177
- width: 454,
178
- height: 454
179
- },
180
- apiLevelLimit: {
181
- min: '1.0.0',
182
- max: '1.99.99'
183
- }
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
184
203
  },
185
- _a[DeviceTarget.PROVENCE] = {
186
- deviceName: 'GTS4 mini',
187
- platforms: [
188
- {
189
- name: DevicePlatformName.PROVENCE,
190
- deviceSource: DeviceSource.PROVENCE
191
- },
192
- {
193
- name: DevicePlatformName.PROVENCEW,
194
- deviceSource: DeviceSource.PROVENCEW
195
- }
196
- ],
197
- screen: {
198
- type: DeviceScreenType.S,
199
- width: 336,
200
- height: 384
201
- },
202
- apiLevelLimit: {
203
- min: '1.0.0',
204
- max: '1.99.99'
205
- }
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
206
224
  },
207
- _a[DeviceTarget.BARI] = {
208
- deviceName: 'Amazfit Band 7',
209
- platforms: [
210
- {
211
- name: DevicePlatformName.BARI_NFC,
212
- deviceSource: DeviceSource.BARI_NFC
213
- },
214
- {
215
- name: DevicePlatformName.BARI,
216
- deviceSource: DeviceSource.BARI
217
- },
218
- {
219
- name: DevicePlatformName.BARI_W,
220
- deviceSource: DeviceSource.BARI_W
221
- }
222
- ],
223
- screen: {
224
- type: DeviceScreenType.S,
225
- width: 194,
226
- height: 368
227
- },
228
- apiLevelLimit: {
229
- min: '1.0.0',
230
- max: '1.99.99'
231
- }
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
232
249
  },
233
- _a[DeviceTarget.BERLIN] = {
234
- deviceName: 'GTR 4',
235
- platforms: [
236
- {
237
- name: DevicePlatformName.BERLIN,
238
- deviceSource: DeviceSource.BERLIN
239
- },
240
- {
241
- name: DevicePlatformName.BERLIN_W,
242
- deviceSource: DeviceSource.BERLIN_W
243
- }
244
- ],
245
- screen: {
246
- type: DeviceScreenType.R,
247
- width: 466,
248
- height: 466
249
- },
250
- apiLevelLimit: {
251
- min: '1.0.0'
252
- }
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
253
270
  },
254
- _a[DeviceTarget.LILLE] = {
255
- deviceName: 'GTS 4',
256
- platforms: [
257
- {
258
- name: DevicePlatformName.LILLE,
259
- deviceSource: DeviceSource.LILLE
260
- },
261
- {
262
- name: DevicePlatformName.LILLE_W,
263
- deviceSource: DeviceSource.LILLE_W
264
- }
265
- ],
266
- screen: {
267
- type: DeviceScreenType.S,
268
- width: 390,
269
- height: 450
270
- },
271
- apiLevelLimit: {
272
- min: '1.0.0'
273
- }
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
274
290
  },
275
- _a[DeviceTarget.MONACO] = {
276
- deviceName: 'GTR 5',
277
- platforms: [
278
- {
279
- name: DevicePlatformName.MONACO,
280
- deviceSource: DeviceSource.MONACO
281
- },
282
- {
283
- name: DevicePlatformName.MONACO_WN,
284
- deviceSource: DeviceSource.MONACO_WN
285
- },
286
- {
287
- name: DevicePlatformName.MONACO_W,
288
- deviceSource: DeviceSource.MONACO_W
289
- }
290
- ],
291
- screen: {
292
- type: DeviceScreenType.R,
293
- width: 480,
294
- height: 480
295
- },
296
- apiLevelLimit: {
297
- min: '1.0.0'
298
- }
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
299
310
  },
300
- _a[DeviceTarget.SWIFT] = {
301
- deviceName: 'Runner (Round)',
302
- platforms: [
303
- {
304
- name: DevicePlatformName.SWIFT,
305
- deviceSource: DeviceSource.SWIFT
306
- },
307
- {
308
- name: DevicePlatformName.SWIFT_W,
309
- deviceSource: DeviceSource.SWIFT_W
310
- }
311
- ],
312
- screen: {
313
- type: DeviceScreenType.R,
314
- width: 454,
315
- height: 454
316
- },
317
- apiLevelLimit: {
318
- min: '1.0.0'
319
- }
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
320
331
  },
321
- _a[DeviceTarget.SWORDFISH] = {
322
- deviceName: 'Runner (Square)',
323
- platforms: [
324
- {
325
- name: DevicePlatformName.SWORDFISH_W,
326
- deviceSource: DeviceSource.SWORDFISH_W
327
- }
328
- ],
329
- screen: {
330
- type: DeviceScreenType.S,
331
- width: 390,
332
- height: 450
333
- },
334
- apiLevelLimit: {
335
- min: '1.0.0'
336
- }
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
337
355
  },
338
- _a[DeviceTarget.CHEETAH] = {
339
- deviceName: 'Runner Pro',
340
- platforms: [
341
- {
342
- name: DevicePlatformName.CHEETAH_W,
343
- deviceSource: DeviceSource.CHEETAH_W
344
- }
345
- ],
346
- screen: {
347
- type: DeviceScreenType.R,
348
- width: 480,
349
- height: 480
350
- },
351
- apiLevelLimit: {
352
- min: '1.0.0'
353
- }
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
354
375
  },
355
- _a[DeviceTarget.HANNOVER] = {
356
- deviceName: 'GTS 5 Active',
357
- platforms: [
358
- {
359
- name: DevicePlatformName.HANNOVER,
360
- deviceSource: DeviceSource.HANNOVER
361
- }
362
- ],
363
- screen: {
364
- type: DeviceScreenType.S,
365
- width: 390,
366
- height: 450
367
- },
368
- apiLevelLimit: {
369
- min: '1.0.0'
370
- }
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
371
391
  },
372
- _a[DeviceTarget.ETNA] = {
373
- deviceName: 'GTR Shock',
374
- platforms: [
375
- {
376
- name: DevicePlatformName.ETNA,
377
- deviceSource: DeviceSource.ETNA
378
- },
379
- {
380
- name: DevicePlatformName.ETNA_W,
381
- deviceSource: DeviceSource.ETNA_W
382
- }
383
- ],
384
- screen: {
385
- type: DeviceScreenType.S,
386
- width: 360,
387
- height: 360
388
- },
389
- apiLevelLimit: {
390
- min: '1.0.0'
391
- }
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
392
407
  },
393
- _a[DeviceTarget.ALTAI] = {
394
- deviceName: 'Bip 5s',
395
- platforms: [
396
- {
397
- name: DevicePlatformName.ALTAI,
398
- deviceSource: DeviceSource.ALTAI
399
- }
400
- ],
401
- screen: {
402
- type: DeviceScreenType.S,
403
- width: 320,
404
- height: 380
405
- },
406
- apiLevelLimit: {
407
- min: '1.0.0'
408
- }
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
409
423
  },
410
- _a);
411
- exports.OSV2Devices = [
412
- DeviceSource.BERLIN,
413
- DeviceSource.BERLIN_W,
414
- DeviceSource.LILLE,
415
- DeviceSource.LILLE_W,
416
- DeviceSource.MONACO,
417
- DeviceSource.MONACO_WN,
418
- DeviceSource.MONACO_W,
419
- DeviceSource.SWIFT,
420
- DeviceSource.SWIFT_W,
421
- DeviceSource.SWORDFISH_W,
422
- DeviceSource.CHEETAH_W,
423
- DeviceSource.HANNOVER,
424
- DeviceSource.ETNA,
425
- DeviceSource.ETNA_W,
426
- DeviceSource.ALTAI
427
- ];
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
443
+ },
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
459
+ },
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
+ }, []);
428
474
  exports.OSV2DeviceTargetNames = Object.keys(exports.deviceTargets).reduce(function (targetNames, target) {
429
475
  var flag = true;
430
476
  var _a = exports.deviceTargets[target].platforms, platforms = _a === void 0 ? [] : _a;
@@ -1,7 +1,7 @@
1
- import { gettext } from 'i18n'
1
+ import { getText } from '@zos/i18n'
2
2
 
3
3
  Page({
4
4
  build() {
5
- console.log(gettext('example'))
5
+ console.log(getText('example'))
6
6
  }
7
7
  })
@@ -1,7 +1,7 @@
1
- import { gettext } from 'i18n'
1
+ import { getText } from '@zos/i18n'
2
2
 
3
3
  Page({
4
4
  build() {
5
- console.log(gettext('example'))
5
+ console.log(getText('example'))
6
6
  }
7
7
  })
@@ -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.13-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",