@zeppos/zeus-cli 1.3.0 → 1.3.1

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/create.js CHANGED
@@ -193,7 +193,7 @@ var inquirerFunc = function (args, _a) {
193
193
  new inquirer_1["default"].Separator(),
194
194
  new inquirer_1["default"].Separator('Choose the shape of the device'),
195
195
  { name: 'Round-screen smartwatch device', value: 'r', checked: true },
196
- { name: 'Square-screen smartwatch device")', value: 's' },
196
+ { name: 'Square-screen smartwatch device', value: 's' },
197
197
  { name: 'Band device', value: 'b' },
198
198
  ],
199
199
  "default": 'r',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeppos/zeus-cli",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "zeus mini-program tools",
5
5
  "main": "index.ts",
6
6
  "author": "zepp",
@@ -269,7 +269,8 @@ exports.deviceTargets = __assign((_a = {}, _a[DeviceTarget.MADRID] = {
269
269
  height: 466
270
270
  },
271
271
  apiLevelLimit: {
272
- min: '1.0.0'
272
+ min: '1.0.0',
273
+ max: '2.99.99'
273
274
  }
274
275
  }, _a[DeviceTarget.LILLE] = {
275
276
  deviceName: 'GTS 4',
@@ -289,7 +290,8 @@ exports.deviceTargets = __assign((_a = {}, _a[DeviceTarget.MADRID] = {
289
290
  height: 450
290
291
  },
291
292
  apiLevelLimit: {
292
- min: '1.0.0'
293
+ min: '1.0.0',
294
+ max: '2.99.99'
293
295
  }
294
296
  }, _a[DeviceTarget.VIENNA] = {
295
297
  deviceName: 'Falcon',
@@ -330,7 +332,8 @@ exports.deviceTargets = __assign((_a = {}, _a[DeviceTarget.MADRID] = {
330
332
  height: 454
331
333
  },
332
334
  apiLevelLimit: {
333
- min: '1.0.0'
335
+ min: '1.0.0',
336
+ max: '2.99.99'
334
337
  }
335
338
  }, _a[DeviceTarget.MONACO] = {
336
339
  deviceName: 'Amazfit Balance',
@@ -354,7 +357,8 @@ exports.deviceTargets = __assign((_a = {}, _a[DeviceTarget.MADRID] = {
354
357
  height: 480
355
358
  },
356
359
  apiLevelLimit: {
357
- min: '1.0.0'
360
+ min: '1.0.0',
361
+ max: '3.99.99'
358
362
  }
359
363
  }, _a[DeviceTarget.SWIFT] = {
360
364
  deviceName: 'Runner (Round)',
@@ -409,7 +413,7 @@ exports.deviceTargets = __assign((_a = {}, _a[DeviceTarget.MADRID] = {
409
413
  min: '1.0.0'
410
414
  }
411
415
  }, _a[DeviceTarget.HANNOVER] = {
412
- deviceName: 'GTS 5 Active',
416
+ deviceName: 'Amazfit Active',
413
417
  platforms: [
414
418
  {
415
419
  name: DevicePlatformName.HANNOVER,
@@ -458,7 +462,8 @@ exports.deviceTargets = __assign((_a = {}, _a[DeviceTarget.MADRID] = {
458
462
  height: 380
459
463
  },
460
464
  apiLevelLimit: {
461
- min: '1.0.0'
465
+ min: '1.0.0',
466
+ max: '2.99.99'
462
467
  }
463
468
  }, _a), device_server_1["default"]);
464
469
  exports.OSV2Devices = Object.values(exports.deviceTargets).reduce(function (targetDevices, target) {
@@ -98,13 +98,10 @@ var createLocalApp = function (args) { return __awaiter(void 0, void 0, void 0,
98
98
  fs_extra_1["default"].remove((0, path_1.resolve)(workDir, "./page/index.".concat(shape, ".layout.js")));
99
99
  var platformsPathStr = 'targets.gt.platforms';
100
100
  var platforms = lodash_1["default"].get(appJson, platformsPathStr);
101
- console.log(platforms);
102
101
  if (!Array.isArray(platforms))
103
102
  return;
104
103
  var filteredPlatforms = lodash_1["default"].filter(platforms, function (platform) { return platform.st !== shape; });
105
- console.log('filteredPlatforms', filteredPlatforms);
106
104
  lodash_1["default"].set(appJson, platformsPathStr, filteredPlatforms);
107
- console.log(JSON.stringify(appJson));
108
105
  });
109
106
  }
110
107
  if (buildTargets && buildTargets.length) {
@@ -3,7 +3,7 @@ import { MessageBuilder } from "../shared/message";
3
3
  const messageBuilder = new MessageBuilder();
4
4
 
5
5
  // Simulating an asynchronous network request using Promise
6
- const mockAPI = async () => {
6
+ async function mockAPI() {
7
7
  return new Promise((resolve, reject) => {
8
8
  setTimeout(() => {
9
9
  resolve({
@@ -17,17 +17,17 @@ const mockAPI = async () => {
17
17
  });
18
18
  };
19
19
 
20
- const fetchData = async (ctx) => {
20
+ async function fetchData(ctx) {
21
21
  try {
22
22
  // Requesting network data using the fetch API
23
23
  // The sample program is for simulation only and does not request real network data, so it is commented here
24
24
  // Example of a GET method request
25
- // const { body: { data = {} } = {} } = await fetch({
25
+ // const res = await fetch({
26
26
  // url: 'https://xxx.com/api/xxx',
27
27
  // method: 'GET'
28
28
  // })
29
29
  // Example of a POST method request
30
- // const { body: { data = {} } = {} } = await fetch({
30
+ // const res = await fetch({
31
31
  // url: 'https://xxx.com/api/xxx',
32
32
  // method: 'POST',
33
33
  // headers: {
@@ -39,11 +39,13 @@ const fetchData = async (ctx) => {
39
39
  // })
40
40
 
41
41
  // A network request is simulated here
42
- const { body: { data = {} } = {} } = await mockAPI();
42
+ const res = await mockAPI()
43
+ const resBody = typeof res.body === 'string' ? JSON.parse(res.body) : res.body
43
44
 
44
45
  ctx.response({
45
- data: { result: data },
46
- });
46
+ data: { result: resBody.data },
47
+ })
48
+
47
49
  } catch (error) {
48
50
  ctx.response({
49
51
  data: { result: "ERROR" },
@@ -53,7 +55,7 @@ const fetchData = async (ctx) => {
53
55
 
54
56
  AppSideService({
55
57
  onInit() {
56
- messageBuilder.listen(() => {});
58
+ messageBuilder.listen(() => { });
57
59
 
58
60
  messageBuilder.on("request", (ctx) => {
59
61
  const jsonRpc = messageBuilder.buf2Json(ctx.request.payload);
@@ -63,7 +65,7 @@ AppSideService({
63
65
  });
64
66
  },
65
67
 
66
- onRun() {},
68
+ onRun() { },
67
69
 
68
- onDestroy() {},
70
+ onDestroy() { },
69
71
  });
@@ -207,7 +207,7 @@ export class MessageBuilder extends EventBus {
207
207
  hmBle &&
208
208
  hmBle.createConnect((index, data, size) => {
209
209
  // logger.warn('[RAW] [R] receive index=>%d size=>%d bin=>%s', index, size, this.bin2hex(data))
210
- console.log('createConnect-------', size)
210
+ // console.log('createConnect-------', size)
211
211
  this.onFragmentData(data)
212
212
  })
213
213
 
@@ -384,7 +384,7 @@ export class MessageBuilder extends EventBus {
384
384
  sendBin(buf) {
385
385
  // hmBle 发送消息
386
386
  // logger.warn('[RAW] [S] send size=%d bin=%s', buf.byteLength, this.bin2hex(buf.buffer))
387
- console.log('sendBin-------', buf.byteLength)
387
+ // console.log('sendBin-------', buf.byteLength)
388
388
  hmBle.send(buf.buffer, buf.byteLength)
389
389
  }
390
390
 
@@ -269,7 +269,7 @@ WatchFace({
269
269
  centerSecondPointer.setProperty(hmUI.prop.VISIBLE, true);
270
270
  for (let n = 0; n < 8; n++) {
271
271
  bigNumObject[n].setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
272
- smallNumObject[n].setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
272
+ smallNumObject[n].setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
273
273
  if (n == 0 || n == 1 || n == 3 || n == 4 || n == 6 || n == 7) {
274
274
  bigNumObject[n].setProperty(hmUI.prop.SRC, img('bigNum/0.png'))
275
275
  smallNumObject[n].setProperty(hmUI.prop.SRC, img('smallNum/0.png'))
@@ -282,14 +282,14 @@ WatchFace({
282
282
  constSecond = 0
283
283
  constMin = 0
284
284
  backBtn.setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
285
- green_red_btn.setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
285
+ green_red_btn.setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
286
286
  flag = true
287
287
  }));
288
288
 
289
289
  backBtn.addEventListener(hmUI.event.CLICK_UP, (function (info) {
290
290
  timer.stopTimer(hsTimer)
291
291
  timer.stopTimer(sTimer)
292
- green_red_btn.setProperty(hmUI.prop.SRC, img('btn/lv.png')); //false隐藏 true显示
292
+ green_red_btn.setProperty(hmUI.prop.SRC, img('btn/lv.png')); //false隐藏 true显示
293
293
  for (let n = 0; n < 8; n++) {
294
294
  bigNumObject[n].setProperty(hmUI.prop.VISIBLE, false); //false隐藏 true显示
295
295
  smallNumObject[n].setProperty(hmUI.prop.VISIBLE, false); //false隐藏 true显示
@@ -312,7 +312,7 @@ WatchFace({
312
312
  minPoint.setProperty(hmUI.prop.ANGLE, 0)
313
313
  hourPoint.setProperty(hmUI.prop.ANGLE, 0)
314
314
  if (flag) {
315
- green_red_btn.setProperty(hmUI.prop.SRC, img("btn/lv.png")); //false隐藏 true显示
315
+ green_red_btn.setProperty(hmUI.prop.SRC, img("btn/lv.png")); //false隐藏 true显示
316
316
  timer.stopTimer(hsTimer)
317
317
  timer.stopTimer(sTimer)
318
318
  bigNumObject[0].setProperty(hmUI.prop.SRC, img("bigNum/0.png"))
@@ -335,7 +335,7 @@ WatchFace({
335
335
  smallNumObject[7].setProperty(hmUI.prop.SRC, rootPath + "smallNum/" + hmFS
336
336
  .SysProGetInt("t7") + ".png")
337
337
  } else {
338
- green_red_btn.setProperty(hmUI.prop.SRC, img("btn/red.png")); //false隐藏 true显示
338
+ green_red_btn.setProperty(hmUI.prop.SRC, img("btn/red.png")); //false隐藏 true显示
339
339
  hmFS.SysProSetInt("t0", 0);
340
340
  hmFS.SysProSetInt("t1", 0);
341
341
  hmFS.SysProSetInt("t3", 0);
@@ -408,7 +408,6 @@ WatchFace({
408
408
  }
409
409
 
410
410
  function timerSample() {
411
- console.log('999999')
412
411
  hsTimer = timer.createTimer(
413
412
  10, 10, setHaomiao, {})
414
413
  sTimer = timer.createTimer(
@@ -3,7 +3,7 @@ import { MessageBuilder } from "../shared/message-side";
3
3
  const messageBuilder = new MessageBuilder();
4
4
 
5
5
  // Simulating an asynchronous network request using Promise
6
- const mockAPI = async () => {
6
+ async function mockAPI() {
7
7
  return new Promise((resolve, reject) => {
8
8
  setTimeout(() => {
9
9
  resolve({
@@ -17,17 +17,17 @@ const mockAPI = async () => {
17
17
  });
18
18
  };
19
19
 
20
- const fetchData = async (ctx) => {
20
+ async function fetchData(ctx) {
21
21
  try {
22
22
  // Requesting network data using the fetch API
23
23
  // The sample program is for simulation only and does not request real network data, so it is commented here
24
24
  // Example of a GET method request
25
- // const { body: { data = {} } = {} } = await fetch({
25
+ // const res = await fetch({
26
26
  // url: 'https://xxx.com/api/xxx',
27
27
  // method: 'GET'
28
28
  // })
29
29
  // Example of a POST method request
30
- // const { body: { data = {} } = {} } = await fetch({
30
+ // const res = await fetch({
31
31
  // url: 'https://xxx.com/api/xxx',
32
32
  // method: 'POST',
33
33
  // headers: {
@@ -39,11 +39,13 @@ const fetchData = async (ctx) => {
39
39
  // })
40
40
 
41
41
  // A network request is simulated here
42
- const { body: { data = {} } = {} } = await mockAPI();
42
+ const res = await mockAPI()
43
+ const resBody = typeof res.body === 'string' ? JSON.parse(res.body) : res.body
43
44
 
44
45
  ctx.response({
45
- data: { result: data },
46
- });
46
+ data: { result: resBody.data },
47
+ })
48
+
47
49
  } catch (error) {
48
50
  ctx.response({
49
51
  data: { result: "ERROR" },
@@ -53,7 +55,7 @@ const fetchData = async (ctx) => {
53
55
 
54
56
  AppSideService({
55
57
  onInit() {
56
- messageBuilder.listen(() => {});
58
+ messageBuilder.listen(() => { });
57
59
 
58
60
  messageBuilder.on("request", (ctx) => {
59
61
  const jsonRpc = messageBuilder.buf2Json(ctx.request.payload);
@@ -63,7 +65,7 @@ AppSideService({
63
65
  });
64
66
  },
65
67
 
66
- onRun() {},
68
+ onRun() { },
67
69
 
68
- onDestroy() {},
70
+ onDestroy() { },
69
71
  });
@@ -18,7 +18,7 @@ const formatDate = (date = new Date()) => {
18
18
  )}:${padStart(s, 2)}`;
19
19
  };
20
20
  // Simulating an asynchronous network request using Promise
21
- const mockAPI = async () => {
21
+ async function mockAPI() {
22
22
  return new Promise((resolve, reject) => {
23
23
  setTimeout(() => {
24
24
  resolve({
@@ -32,7 +32,7 @@ const mockAPI = async () => {
32
32
  });
33
33
  };
34
34
 
35
- const fetchData = async (res) => {
35
+ async function fetchData(res) {
36
36
  try {
37
37
  // Requesting network data using the fetch API
38
38
  // The sample program is for simulation only and does not request real network data, so it is commented here
@@ -1,144 +0,0 @@
1
- {
2
- "configVersion": "v2",
3
- "app": {
4
- "appId": 20001,
5
- "appName": "hello world",
6
- "appType": "app",
7
- "version": {
8
- "code": 1,
9
- "name": "1.0.1"
10
- },
11
- "icon": "icon.png",
12
- "vender": "zepp",
13
- "description": "hello world app"
14
- },
15
- "permissions": [],
16
- "runtime": {
17
- "apiVersion": {
18
- "compatible": "1.0.0",
19
- "target": "1.0.1",
20
- "minVersion": "1.0.0"
21
- }
22
- },
23
- "debug": false,
24
- "targets": {
25
- "gtr3-pro": {
26
- "module": {
27
- "page": {
28
- "pages": [
29
- "page/gtr3-pro/home/index.page"
30
- ]
31
- },
32
- "app-side": {
33
- "path": "app-side/index"
34
- },
35
- "setting": {
36
- "path": "setting/index"
37
- }
38
- },
39
- "platforms": [
40
- {
41
- "name": "gtr3-pro",
42
- "deviceSource": 229
43
- },
44
- {
45
- "name": "gtr3-pro-w",
46
- "deviceSource": 230
47
- }
48
- ],
49
- "designWidth": 480
50
- },
51
- "gtr3": {
52
- "module": {
53
- "page": {
54
- "pages": [
55
- "page/gtr3/home/index.page"
56
- ]
57
- },
58
- "app-side": {
59
- "path": "app-side/index"
60
- },
61
- "setting": {
62
- "path": "setting/index"
63
- }
64
- },
65
- "platforms": [
66
- {
67
- "name": "gtr3",
68
- "deviceSource": 226
69
- },
70
- {
71
- "name": "gtr3-w",
72
- "deviceSource": 227
73
- },
74
- {
75
- "name": "t-rex2",
76
- "deviceSource": 418
77
- },
78
- {
79
- "name": "t-rex2-w",
80
- "deviceSource": 419
81
- }
82
- ],
83
- "designWidth": 454
84
- },
85
- "gts3": {
86
- "module": {
87
- "page": {
88
- "pages": [
89
- "page/gts3/home/index.page"
90
- ]
91
- },
92
- "app-side": {
93
- "path": "app-side/index"
94
- },
95
- "setting": {
96
- "path": "setting/index"
97
- }
98
- },
99
- "platforms": [
100
- {
101
- "name": "gts3",
102
- "deviceSource": 224
103
- },
104
- {
105
- "name": "gts3-w",
106
- "deviceSource": 225
107
- }
108
- ],
109
- "designWidth": 390
110
- },
111
- "teide": {
112
- "module": {
113
- "page": {
114
- "pages": [
115
- "page/t-rex2/home/index.page"
116
- ]
117
- },
118
- "app-side": {
119
- "path": "app-side/index"
120
- },
121
- "setting": {
122
- "path": "setting/index"
123
- }
124
- },
125
- "platforms": [
126
- {
127
- "name": "t-rex2",
128
- "deviceSource": 418
129
- },
130
- {
131
- "name": "t-rex2-w",
132
- "deviceSource": 419
133
- }
134
- ],
135
- "designWidth": 454
136
- }
137
- },
138
- "i18n": {
139
- "en-US": {
140
- "appName": "Hello World"
141
- }
142
- },
143
- "defaultLanguage": "en-US"
144
- }