@zeppos/zeus-cli 1.2.3 → 1.2.4

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.
Files changed (52) hide show
  1. package/bin/main.js +1 -1
  2. package/modules/bridge.js +1 -1
  3. package/modules/build.js +152 -32
  4. package/modules/create.js +7 -6
  5. package/modules/help.js +1 -1
  6. package/modules/run.js +14 -12
  7. package/package.json +2 -2
  8. package/private-modules/zeppos-app-utils/dist/api/index.js +1 -1
  9. package/private-modules/zeppos-app-utils/dist/config/device.js +391 -213
  10. package/private-modules/zeppos-app-utils/dist/modules/build.js +101 -29
  11. package/private-modules/zeppos-app-utils/dist/modules/config.js +1 -1
  12. package/private-modules/zeppos-app-utils/dist/modules/create/index.js +13 -11
  13. package/private-modules/zeppos-app-utils/dist/modules/create/local-app.js +10 -10
  14. package/private-modules/zeppos-app-utils/dist/modules/create/yeoman-app.js +1 -1
  15. package/private-modules/zeppos-app-utils/dist/modules/login.js +1 -1
  16. package/private-modules/zeppos-app-utils/dist/modules/status.js +1 -1
  17. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/page/index.js +2 -2
  18. package/private-modules/zeppos-app-utils/dist/tools/index.js +1 -1
  19. package/private-modules/zeppos-app-utils/package.json +1 -1
  20. package/utils/pre-check.js +11 -22
  21. package/utils/tools.js +14 -0
  22. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/consume.png +0 -0
  23. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/beer.png +0 -0
  24. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/cake.png +0 -0
  25. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/chocolate.png +0 -0
  26. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/coffee.png +0 -0
  27. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/cookies.png +0 -0
  28. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/ham.png +0 -0
  29. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/hamburger.png +0 -0
  30. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/ice cream.png +0 -0
  31. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/pizza.png +0 -0
  32. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/food/sausage.png +0 -0
  33. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/icon.png +0 -0
  34. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/multiply.png +0 -0
  35. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/selected.png +0 -0
  36. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/assets/gts/unselected.png +0 -0
  37. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/page/gts/food-list.js +0 -113
  38. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/calories/page/gts/index.js +0 -126
  39. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/fetch-api/assets/common/icon.png +0 -0
  40. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/fetch-api/pages/i18n/en-US.po +0 -2
  41. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/fetch-api/pages/index.js +0 -55
  42. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/assets/gtr/icon.png +0 -0
  43. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/assets/gtr/image/logo.png +0 -0
  44. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/assets/gts/icon.png +0 -0
  45. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/assets/gts/image/logo.png +0 -0
  46. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/page/gtr/home/index.page.js +0 -20
  47. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/page/gtr/home/index.page.json +0 -1
  48. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/page/gtr/home/index.style.js +0 -18
  49. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/page/gts/home/index.page.js +0 -21
  50. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/page/gts/home/index.page.json +0 -1
  51. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/hello-world/page/gts/home/index.style.js +0 -17
  52. package/private-modules/zeppos-app-utils/dist/public/template/config-version-v3/v2/todo-list/assets/gts/icon.png +0 -0
@@ -1,113 +0,0 @@
1
- import * as hmUI from '@zos/ui'
2
- import { back } from '@zos/router'
3
- import { log as Logger, px } from '@zos/utils'
4
-
5
- import {
6
- FOOD_LIST_Y,
7
- FOOD_LIST_ITEM_MARGIN,
8
- FOOD_LIST_ITEM_HEIGHT,
9
- FOOD_LIST_RADIOGROUP,
10
- FOOD_LIST_RADIO_ITEM,
11
- FOOD_LIST_RADIO_ITEM_TEXT,
12
- DEVICE_WIDTH,
13
- } from '../../utils/styles-gts-3'
14
- import { FOOD_CALORIES } from '../../utils/constants'
15
- const logger = Logger.getLogger('calories')
16
- const globalData = getApp()._options.globalData
17
-
18
- Page({
19
- state: {
20
- activeIndex: -1,
21
- isFinishInit: false,
22
- radioGroup: null,
23
- radioButtonsArray: [],
24
- },
25
- onInit() {
26
- logger.log('onInit')
27
- },
28
- setPrograms(index) {
29
- this.state.activeIndex = index
30
- globalData.foodType = FOOD_CALORIES[index].type
31
- back()
32
- },
33
- buildFoodList() {
34
- let activeIndex = 0
35
- const radioGroup = hmUI.createWidget(hmUI.widget.RADIO_GROUP, {
36
- ...FOOD_LIST_RADIOGROUP,
37
- check_func: (group, index, checked) => {
38
- if (checked) {
39
- this.state.isFinishInit && this.setPrograms(index)
40
- }
41
- },
42
- })
43
-
44
- this.state.radioGroup = radioGroup
45
-
46
- for (let index = 0; index < FOOD_CALORIES.length; index++) {
47
- this.buildRadioButton(index)
48
- this.buildRadioText(index)
49
- activeIndex =
50
- FOOD_CALORIES[index].type === globalData.foodType ? index : activeIndex
51
- }
52
- this.state.activeIndex = activeIndex
53
- this.initRadioGroup()
54
- },
55
- buildElement() {
56
- hmUI.createWidget(hmUI.widget.FILL_RECT, {
57
- x: 0,
58
- y: 0,
59
- w: DEVICE_WIDTH,
60
- h: px(
61
- FOOD_LIST_Y +
62
- (FOOD_CALORIES.length + 1) *
63
- (FOOD_LIST_ITEM_HEIGHT + FOOD_LIST_ITEM_MARGIN),
64
- ),
65
- })
66
- this.buildFoodList()
67
- },
68
- buildRadioButton(index) {
69
- const radio = this.state.radioGroup.createWidget(hmUI.widget.STATE_BUTTON, {
70
- ...FOOD_LIST_RADIO_ITEM.styles,
71
- y: px(index * (FOOD_LIST_ITEM_HEIGHT + FOOD_LIST_ITEM_MARGIN)),
72
- })
73
- this.state.radioButtonsArray.push(radio)
74
- },
75
- buildRadioText(index) {
76
- const text = hmUI.createWidget(hmUI.widget.TEXT, {
77
- ...FOOD_LIST_RADIO_ITEM_TEXT,
78
- y: px(
79
- FOOD_LIST_Y + index * (FOOD_LIST_ITEM_HEIGHT + FOOD_LIST_ITEM_MARGIN),
80
- ),
81
- text: `${FOOD_CALORIES[index].name[0].toUpperCase()}${FOOD_CALORIES[
82
- index
83
- ].name.slice(1)}`,
84
- })
85
- text.addEventListener(hmUI.event.SELECT, () => {
86
- this.state.radioGroup.setProperty(
87
- hmUI.prop.CHECKED,
88
- this.state.radioButtonsArray[index],
89
- )
90
- })
91
- },
92
- initRadioGroup() {
93
- this.state.radioGroup.setProperty(
94
- hmUI.prop.INIT,
95
- this.state.radioButtonsArray[0],
96
- )
97
- this.state.radioGroup.setProperty(
98
- hmUI.prop.CHECKED,
99
- this.state.radioButtonsArray[this.state.activeIndex],
100
- )
101
- this.state.isFinishInit = true
102
- },
103
- build() {
104
- this.buildElement()
105
- },
106
- onReady() {},
107
-
108
- onShow() {},
109
-
110
- onHide() {},
111
-
112
- onDestroy() {},
113
- })
@@ -1,126 +0,0 @@
1
- import * as hmUI from '@zos/ui'
2
- import { push } from '@zos/router'
3
- import { getText } from '@zos/i18n'
4
- import { Calorie } from '@zos/sensor'
5
- import { log as Logger, px } from '@zos/utils'
6
-
7
- import {
8
- CALORIE_TEXT,
9
- CALORIE_TEXT_SIZE,
10
- UNIT_TEXT,
11
- UNIT_TEXT_SIZE,
12
- TOTAL_CONSUME_TEXT,
13
- CONSUME_ICON,
14
- CONSUME_ICON_WIDTH,
15
- ALIGN_DESC_GROUP,
16
- IMGAE_CALORIES_MARIN,
17
- CALORIES_UNIT_MARIN,
18
- EQUIVALENT_TO_BUTTON,
19
- EQUIVALENT_TO_FOOD_ICON,
20
- DEVICE_WIDTH,
21
- EQUIVALENT_MORE_X,
22
- EQUIVALENT_MARGIN,
23
- EQUIVALENT_TO_FOOD_ICON_WIDTH,
24
- EQUIVALENT_MORE_FOOD_ICON,
25
- EQUIVALENT_MORE_FOOD_NUM,
26
- } from '../../utils/styles-gts-3'
27
- import { FOOD_CALORIES } from '../../utils/constants'
28
- const logger = Logger.getLogger('calories')
29
- const globalData = getApp()._options.globalData
30
-
31
- Page({
32
- buildTopContent(calories) {
33
- const { width: w1 } = hmUI.getTextLayout('' + calories, {
34
- text_size: CALORIE_TEXT_SIZE,
35
- text_width: 0,
36
- wrapped: 0
37
- })
38
- const { width: w2 } = hmUI.getTextLayout(getText('unit'), {
39
- text_size: UNIT_TEXT_SIZE,
40
- text_width: 0,
41
- wrapped: 0
42
- })
43
-
44
- const w =
45
- w1 + w2 + CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN + CALORIES_UNIT_MARIN
46
- const x = Math.round((DEVICE_WIDTH - w) / 2)
47
-
48
- const group = hmUI.createWidget(hmUI.widget.GROUP, {
49
- ...ALIGN_DESC_GROUP,
50
- x,
51
- w,
52
- })
53
-
54
- group.createWidget(hmUI.widget.TEXT, {
55
- ...CALORIE_TEXT,
56
- text: `${calories}`,
57
- x: CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN,
58
- w: w1,
59
- })
60
- group.createWidget(hmUI.widget.TEXT, {
61
- ...UNIT_TEXT,
62
- x: w - w2,
63
- w: w2,
64
- })
65
- group.createWidget(hmUI.widget.IMG, CONSUME_ICON)
66
- },
67
- build() {
68
- let calories = new Calorie().getCurrent() // Math.floor(Math.random() * 1000)
69
- let currentFood = globalData.foodType
70
-
71
- hmUI.createWidget(hmUI.widget.TEXT, TOTAL_CONSUME_TEXT)
72
-
73
- this.buildTopContent(calories)
74
-
75
- let activeIndex = FOOD_CALORIES.findIndex(
76
- (item) => item.type === currentFood,
77
- )
78
- this.calculate(calories, FOOD_CALORIES[activeIndex])
79
- hmUI.createWidget(hmUI.widget.BUTTON, {
80
- ...EQUIVALENT_TO_BUTTON,
81
- click_func: () => {
82
- push({
83
- url: 'page/gts/food-list',
84
- })
85
- },
86
- })
87
- },
88
- calculate(currentCalories, foodData) {
89
- let { value, type } = foodData
90
- let count = Math.floor(currentCalories / value)
91
- if (count === 1 || count === 2 || count === 3) {
92
- let x =
93
- (DEVICE_WIDTH -
94
- EQUIVALENT_TO_FOOD_ICON_WIDTH * count -
95
- EQUIVALENT_MARGIN * (count - 1)) /
96
- 2
97
- for (let index = 0; index < count; index++) {
98
- this.drawFood(
99
- x + (EQUIVALENT_MARGIN + EQUIVALENT_TO_FOOD_ICON_WIDTH) * index,
100
- type,
101
- ) // icon
102
- }
103
- } else {
104
- this.drawFood(EQUIVALENT_MORE_X, type) // icon
105
- hmUI.createWidget(hmUI.widget.IMG, EQUIVALENT_MORE_FOOD_ICON)
106
- hmUI.createWidget(hmUI.widget.TEXT, {
107
- ...EQUIVALENT_MORE_FOOD_NUM,
108
- text: `${count}`,
109
- })
110
- }
111
- },
112
- drawFood(x, type) {
113
- hmUI.createWidget(hmUI.widget.IMG, {
114
- ...EQUIVALENT_TO_FOOD_ICON,
115
- x: px(x),
116
- src: `food/${type}.png`,
117
- })
118
- },
119
- onReady() {},
120
-
121
- onShow() {},
122
-
123
- onHide() {},
124
-
125
- onDestroy() {},
126
- })
@@ -1,2 +0,0 @@
1
- msgid "example"
2
- msgstr "This is an example in device"
@@ -1,55 +0,0 @@
1
- import * as hmUI from '@zos/ui'
2
- import { log as Logger, px } from '@zos/utils'
3
- import {
4
- DEFAULT_COLOR,
5
- DEFAULT_COLOR_TRANSPARENT,
6
- } from "../utils/config/constants"
7
- import { DEVICE_WIDTH } from "../utils/config/device"
8
-
9
- const logger = Logger.getLogger("fetch_api")
10
- const { messageBuilder } = getApp()._options.globalData
11
-
12
- Page({
13
- state: {},
14
- build() {
15
- hmUI.createWidget(hmUI.widget.BUTTON, {
16
- x: (DEVICE_WIDTH - px(400)) / 2,
17
- y: px(260),
18
- w: px(400),
19
- h: px(100),
20
- text_size: px(36),
21
- radius: px(12),
22
- normal_color: DEFAULT_COLOR,
23
- press_color: DEFAULT_COLOR_TRANSPARENT,
24
- text: "Fetch Data",
25
- click_func: (button_widget) => {
26
- logger.log("click button")
27
- this.fetchData()
28
- },
29
- })
30
- },
31
- fetchData() {
32
- messageBuilder.request({
33
- method: "GET_DATA",
34
- })
35
- .then(data => {
36
- logger.log('receive data')
37
- const { result = {} } = data
38
- const { text } = result
39
-
40
- hmUI.createWidget(hmUI.widget.TEXT, {
41
- x: px(96),
42
- y: px(100),
43
- w: px(288),
44
- h: px(46),
45
- color: 0xffffff,
46
- text_size: px(36),
47
- align_h: hmUI.align.CENTER_H,
48
- align_v: hmUI.align.CENTER_V,
49
- text_style: hmUI.text_style.NONE,
50
- text
51
- })
52
- }).catch(res => {
53
- })
54
- },
55
- })
@@ -1,20 +0,0 @@
1
- import * as hmUI from '@zos/ui'
2
- import { log as Logger } from '@zos/utils'
3
- import { TEXT_STYLE } from './index.style'
4
-
5
- const logger = Logger.getLogger('helloworld')
6
- Page({
7
- build() {
8
- logger.debug('page build invoked')
9
- hmUI.createWidget(hmUI.widget.TEXT, {
10
- ...TEXT_STYLE,
11
- })
12
- },
13
- onInit() {
14
- logger.debug('page onInit invoked')
15
- },
16
-
17
- onDestroy() {
18
- logger.debug('page onDestroy invoked')
19
- },
20
- })
@@ -1,18 +0,0 @@
1
- import * as hmUI from '@zos/ui'
2
- import { getText } from '@zos/i18n'
3
- import { getDeviceInfo } from '@zos/device'
4
- import { px } from '@zos/utils'
5
-
6
- export const { width: DEVICE_WIDTH, height: DEVICE_HEIGHT } = getDeviceInfo()
7
-
8
- export const TEXT_STYLE = {
9
- text: getText('appName'),
10
- x: px(42),
11
- y: px(200),
12
- w: DEVICE_WIDTH - px(42) * 2,
13
- h: px(100),
14
- color: 0xffffff,
15
- text_size: px(36),
16
- align_h: hmUI.align.CENTER_H,
17
- text_style: hmUI.text_style.WRAP,
18
- }
@@ -1,21 +0,0 @@
1
- import * as hmUI from '@zos/ui'
2
- import { log as Logger } from '@zos/utils'
3
- import { TEXT_STYLE } from './index.style'
4
-
5
- const logger = Logger.getLogger('helloworld')
6
-
7
- Page({
8
- build() {
9
- logger.debug('page build invoked')
10
- hmUI.createWidget(hmUI.widget.TEXT, {
11
- ...TEXT_STYLE,
12
- })
13
- },
14
- onInit() {
15
- logger.debug('page onInit invoked')
16
- },
17
-
18
- onDestroy() {
19
- logger.debug('page onDestroy invoked')
20
- },
21
- })
@@ -1,17 +0,0 @@
1
- import * as hmUI from '@zos/ui'
2
- import { getText } from '@zos/i18n'
3
- import { getDeviceInfo } from '@zos/device'
4
-
5
- export const { width: DEVICE_WIDTH, height: DEVICE_HEIGHT } = getDeviceInfo()
6
-
7
- export const TEXT_STYLE = {
8
- text: getText('appName'),
9
- x: 42,
10
- y: 200,
11
- w: DEVICE_WIDTH - 42 * 2,
12
- h: 100,
13
- color: 0xffffff,
14
- text_size: 36,
15
- align_h: hmUI.align.CENTER_H,
16
- text_style: hmUI.text_style.WRAP,
17
- }