@zeppos/zeus-cli 1.1.8 → 1.2.0

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 (229) hide show
  1. package/bin/{cli.js → main.js} +11 -7
  2. package/bin/post-command.js +3 -5
  3. package/index.js +0 -3
  4. package/modules/bridge.js +18 -21
  5. package/modules/build.js +86 -215
  6. package/modules/create.js +244 -0
  7. package/modules/help.js +16 -16
  8. package/modules/run.js +23 -83
  9. package/package.json +41 -51
  10. package/{api → private-modules/zeppos-app-utils/dist/api}/index.js +64 -98
  11. package/private-modules/zeppos-app-utils/dist/config/device.js +247 -0
  12. package/private-modules/zeppos-app-utils/dist/config/index.js +18 -0
  13. package/private-modules/zeppos-app-utils/dist/config/project.js +104 -0
  14. package/{utils → private-modules/zeppos-app-utils/dist}/hm-analytics.js +6 -6
  15. package/private-modules/zeppos-app-utils/dist/index.js +38 -0
  16. package/private-modules/zeppos-app-utils/dist/logger/index.js +54 -0
  17. package/private-modules/zeppos-app-utils/dist/logger/my-logger.js +69 -0
  18. package/private-modules/zeppos-app-utils/dist/modules/build.js +334 -0
  19. package/{modules → private-modules/zeppos-app-utils/dist/modules}/config.js +31 -57
  20. package/private-modules/zeppos-app-utils/dist/modules/create/index.js +254 -0
  21. package/{modules → private-modules/zeppos-app-utils/dist/modules}/create/local-app.js +10 -10
  22. package/{modules → private-modules/zeppos-app-utils/dist/modules}/create/yeoman-app.js +2 -2
  23. package/private-modules/zeppos-app-utils/dist/modules/index.js +21 -0
  24. package/{modules → private-modules/zeppos-app-utils/dist/modules}/login.js +17 -45
  25. package/{modules → private-modules/zeppos-app-utils/dist/modules}/status.js +32 -42
  26. package/{public → private-modules/zeppos-app-utils/dist/public}/scripts/png2vglite.py +0 -0
  27. package/{public → private-modules/zeppos-app-utils/dist/public}/scripts/requirements.txt +0 -0
  28. package/{public/template/package.json → private-modules/zeppos-app-utils/dist/public/template/v1/_package.json} +0 -0
  29. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/app-side/i18n/en-US.po +0 -0
  30. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/app-side/index.js +0 -0
  31. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/app.js +0 -0
  32. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/app.json +1 -1
  33. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/assets/default/icon.png +0 -0
  34. package/{public/template/empty/pages → private-modules/zeppos-app-utils/dist/public/template/v1/empty/page}/i18n/en-US.po +0 -0
  35. package/{public/template/empty/pages → private-modules/zeppos-app-utils/dist/public/template/v1/empty/page}/index.js +0 -0
  36. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/setting/i18n/en-US.po +0 -0
  37. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/setting/index.js +0 -0
  38. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/watchface/index.js +0 -0
  39. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/app-side/index.js +0 -0
  40. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/app.js +0 -0
  41. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/app.json +0 -0
  42. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gtr3/icon.png +0 -0
  43. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gtr3/image/logo.png +0 -0
  44. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gtr3-pro/icon.png +0 -0
  45. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gtr3-pro/image/logo.png +0 -0
  46. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gts3/icon.png +0 -0
  47. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gts3/image/logo.png +0 -0
  48. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3/home/index.page.js +0 -0
  49. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3/home/index.page.json +0 -0
  50. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3/home/index.style.js +0 -0
  51. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3-pro/home/index.page.js +0 -0
  52. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3-pro/home/index.page.json +0 -0
  53. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3-pro/home/index.style.js +0 -0
  54. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gts3/home/index.page.js +0 -0
  55. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gts3/home/index.page.json +0 -0
  56. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gts3/home/index.style.js +0 -0
  57. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/i18n/en-US.po +0 -0
  58. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/setting/i18n/en-US.po +0 -0
  59. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/setting/index.js +0 -0
  60. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/utils/index.js +0 -0
  61. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/jsconfig.json +0 -0
  62. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/app.js +0 -0
  63. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/app.json +0 -0
  64. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bg/bg.png +0 -0
  65. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/0.png +0 -0
  66. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/1.png +0 -0
  67. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/2.png +0 -0
  68. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/3.png +0 -0
  69. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/4.png +0 -0
  70. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/5.png +0 -0
  71. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/6.png +0 -0
  72. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/7.png +0 -0
  73. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/8.png +0 -0
  74. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/9.png +0 -0
  75. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/sp.png +0 -0
  76. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/btn/back.png +0 -0
  77. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/btn/lv.png +0 -0
  78. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/btn/red.png +0 -0
  79. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/bg.png +0 -0
  80. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/bottom.png +0 -0
  81. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/center.png +0 -0
  82. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/h.png +0 -0
  83. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/left.png +0 -0
  84. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/m.png +0 -0
  85. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/right.png +0 -0
  86. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/s.png +0 -0
  87. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/preview.png +0 -0
  88. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/second/second.png +0 -0
  89. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/0.png +0 -0
  90. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/1.png +0 -0
  91. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/2.png +0 -0
  92. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/3.png +0 -0
  93. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/4.png +0 -0
  94. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/5.png +0 -0
  95. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/6.png +0 -0
  96. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/7.png +0 -0
  97. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/8.png +0 -0
  98. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/9.png +0 -0
  99. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/d.png +0 -0
  100. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/n.png +0 -0
  101. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/1.png +0 -0
  102. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/2.png +0 -0
  103. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/3.png +0 -0
  104. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/4.png +0 -0
  105. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/5.png +0 -0
  106. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/6.png +0 -0
  107. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/7.png +0 -0
  108. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/1.png +0 -0
  109. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/2.png +0 -0
  110. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/3.png +0 -0
  111. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/4.png +0 -0
  112. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/5.png +0 -0
  113. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/6.png +0 -0
  114. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/7.png +0 -0
  115. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/buffer.js +0 -0
  116. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/device-polyfill.js +0 -0
  117. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/global.js +0 -0
  118. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/js-module.js +0 -0
  119. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/logger.js +0 -0
  120. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/setTimeout.js +0 -0
  121. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/watchface/gtr-3-pro/index.js +0 -0
  122. package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/watchface/round/index.js +0 -0
  123. package/private-modules/zeppos-app-utils/dist/public/template/v2/_package.json +14 -0
  124. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/app.js +28 -0
  125. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/app.json +56 -0
  126. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/consume.png +0 -0
  127. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/beer.png +0 -0
  128. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/cake.png +0 -0
  129. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/chocolate.png +0 -0
  130. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/coffee.png +0 -0
  131. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/cookies.png +0 -0
  132. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/ham.png +0 -0
  133. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/hamburger.png +0 -0
  134. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/ice cream.png +0 -0
  135. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/pizza.png +0 -0
  136. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/sausage.png +0 -0
  137. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/icon.png +0 -0
  138. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/multiply.png +0 -0
  139. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/selected.png +0 -0
  140. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/unselected.png +0 -0
  141. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/page/gts/food-list.js +113 -0
  142. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/page/gts/index.js +126 -0
  143. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/page/i18n/en-US.po +42 -0
  144. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/page/i18n/zh-CN.po +42 -0
  145. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/utils/constants.js +54 -0
  146. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/utils/storage.js +42 -0
  147. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/utils/styles-gts-3.js +141 -0
  148. package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/utils/styles.js +142 -0
  149. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/app-side/i18n/en-US.po +2 -0
  150. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/app-side/index.js +13 -0
  151. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/app.js +10 -0
  152. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/app.json +60 -0
  153. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/assets/default/icon.png +0 -0
  154. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/page/i18n/en-US.po +2 -0
  155. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/page/index.js +7 -0
  156. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/setting/i18n/en-US.po +2 -0
  157. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/setting/index.js +7 -0
  158. package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/watchface/index.js +13 -0
  159. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/app-side/i18n/en-US.po +2 -0
  160. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/app-side/index.js +57 -0
  161. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/app.js +23 -0
  162. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/app.json +65 -0
  163. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/assets/common/icon.png +0 -0
  164. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/pages/i18n/en-US.po +2 -0
  165. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/pages/index.js +55 -0
  166. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/data.js +67 -0
  167. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/defer.js +35 -0
  168. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/device-polyfill.js +6 -0
  169. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/es6-promise.js +1149 -0
  170. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/event.js +42 -0
  171. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/message-side.js +1145 -0
  172. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/message.js +1151 -0
  173. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/utils/config/constants.js +2 -0
  174. package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/utils/config/device.js +2 -0
  175. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/app-side/index.js +11 -0
  176. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/app.js +10 -0
  177. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/app.json +101 -0
  178. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/assets/gtr/icon.png +0 -0
  179. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/assets/gtr/image/logo.png +0 -0
  180. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/assets/gts/icon.png +0 -0
  181. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/assets/gts/image/logo.png +0 -0
  182. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gtr/home/index.page.js +20 -0
  183. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gtr/home/index.page.json +1 -0
  184. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gtr/home/index.style.js +18 -0
  185. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gts/home/index.page.js +21 -0
  186. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gts/home/index.page.json +1 -0
  187. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gts/home/index.style.js +17 -0
  188. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/i18n/en-US.po +3 -0
  189. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/setting/i18n/en-US.po +2 -0
  190. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/setting/index.js +5 -0
  191. package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/utils/index.js +3 -0
  192. package/private-modules/zeppos-app-utils/dist/public/template/v2/jsconfig.json +14 -0
  193. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/.prettierrc.js +6 -0
  194. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/app-side/index.js +48 -0
  195. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/app.js +25 -0
  196. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/app.json +75 -0
  197. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/assets/gts/icon.png +0 -0
  198. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/page/home/index.page.js +155 -0
  199. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/page/home/index.page.json +1 -0
  200. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/page/home/index.style.js +93 -0
  201. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/page/i18n/en-US.po +8 -0
  202. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/setting/i18n/en-US.po +5 -0
  203. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/setting/index.js +145 -0
  204. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/data.js +67 -0
  205. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/defer.js +35 -0
  206. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/device-polyfill.js +6 -0
  207. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/es6-promise.js +1149 -0
  208. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/event.js +42 -0
  209. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/message-side.js +1145 -0
  210. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/message.js +1151 -0
  211. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/utils/constants.js +3 -0
  212. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/utils/fs.js +38 -0
  213. package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/utils/index.js +38 -0
  214. package/private-modules/zeppos-app-utils/dist/simulator.js +58 -0
  215. package/{modules/storage.js → private-modules/zeppos-app-utils/dist/storage/index.js} +2 -1
  216. package/private-modules/zeppos-app-utils/dist/tools/index.js +133 -0
  217. package/private-modules/zeppos-app-utils/dist/websocket.js +165 -0
  218. package/private-modules/zeppos-app-utils/package.json +51 -0
  219. package/utils/pre-check.js +9 -35
  220. package/config/device.js +0 -122
  221. package/config/project.js +0 -48
  222. package/font-icon.js +0 -27
  223. package/modules/create/index.js +0 -358
  224. package/modules/simulator.js +0 -82
  225. package/modules/websocket.js +0 -112
  226. package/utils/common.js +0 -138
  227. package/utils/logger.js +0 -31
  228. package/utils/md5.js +0 -11
  229. package/utils/sleep.js +0 -8
@@ -0,0 +1,54 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ exports.__esModule = true;
20
+ exports.logger = exports.LoggerInstance = void 0;
21
+ var chalk_1 = __importDefault(require("chalk"));
22
+ var LoggerInstance = (function () {
23
+ function LoggerInstance() {
24
+ }
25
+ LoggerInstance.init = function () {
26
+ if (!LoggerInstance.instance) {
27
+ LoggerInstance.instance = new LoggerInstance();
28
+ }
29
+ return LoggerInstance.instance;
30
+ };
31
+ LoggerInstance.prototype.log = function () {
32
+ var args = [];
33
+ for (var _i = 0; _i < arguments.length; _i++) {
34
+ args[_i] = arguments[_i];
35
+ }
36
+ console.log.apply(console, args);
37
+ };
38
+ LoggerInstance.prototype.info = function (msg) {
39
+ console.log(chalk_1["default"].blue('info '), msg);
40
+ };
41
+ LoggerInstance.prototype.warn = function (msg) {
42
+ console.log(chalk_1["default"].keyword('orange')('warning '), msg);
43
+ };
44
+ LoggerInstance.prototype.success = function (msg) {
45
+ console.log(chalk_1["default"].green('success '), msg);
46
+ };
47
+ LoggerInstance.prototype.error = function (msg) {
48
+ console.log(chalk_1["default"].red('error '), msg);
49
+ };
50
+ return LoggerInstance;
51
+ }());
52
+ exports.LoggerInstance = LoggerInstance;
53
+ exports.logger = LoggerInstance.init();
54
+ __exportStar(require("./my-logger"), exports);
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.MyLogger = void 0;
4
+ var Methods = ['log', 'info', 'warn', 'error'];
5
+ var MyLogger = (function () {
6
+ function MyLogger() {
7
+ this.beforeFuncs = [];
8
+ this.afterFuncs = [];
9
+ }
10
+ MyLogger.prototype._log = function (level, args) {
11
+ this.beforeFuncs.forEach(function (func) { return func(args); });
12
+ console[Methods[level]].apply(console, args);
13
+ this.afterFuncs.forEach(function (func) { return func(args); });
14
+ };
15
+ MyLogger.prototype.log = function () {
16
+ var args = [];
17
+ for (var _i = 0; _i < arguments.length; _i++) {
18
+ args[_i] = arguments[_i];
19
+ }
20
+ this._log(0, args);
21
+ return this;
22
+ };
23
+ MyLogger.prototype.info = function () {
24
+ var args = [];
25
+ for (var _i = 0; _i < arguments.length; _i++) {
26
+ args[_i] = arguments[_i];
27
+ }
28
+ this._log(1, args);
29
+ return this;
30
+ };
31
+ MyLogger.prototype.warn = function () {
32
+ var args = [];
33
+ for (var _i = 0; _i < arguments.length; _i++) {
34
+ args[_i] = arguments[_i];
35
+ }
36
+ this._log(2, args);
37
+ return this;
38
+ };
39
+ MyLogger.prototype.error = function () {
40
+ var args = [];
41
+ for (var _i = 0; _i < arguments.length; _i++) {
42
+ args[_i] = arguments[_i];
43
+ }
44
+ this._log(3, args);
45
+ return this;
46
+ };
47
+ MyLogger.prototype.addInterceptor = function (func, isBefore) {
48
+ if (isBefore === void 0) { isBefore = true; }
49
+ if (typeof func !== 'function') {
50
+ return this.error('拦截器不符合规范');
51
+ }
52
+ if (isBefore) {
53
+ this.beforeFuncs.push(func);
54
+ return this;
55
+ }
56
+ this.afterFuncs.push(func);
57
+ return this;
58
+ };
59
+ MyLogger.prototype.addBeforeFunc = function (func) {
60
+ this.addInterceptor(func);
61
+ return this;
62
+ };
63
+ MyLogger.prototype.addAfterFunc = function (func) {
64
+ this.addInterceptor(func, false);
65
+ return this;
66
+ };
67
+ return MyLogger;
68
+ }());
69
+ exports.MyLogger = MyLogger;
@@ -0,0 +1,334 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (_) try {
41
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
61
+ var __importDefault = (this && this.__importDefault) || function (mod) {
62
+ return (mod && mod.__esModule) ? mod : { "default": mod };
63
+ };
64
+ exports.__esModule = true;
65
+ exports.runX = exports.previewBuild = exports.build = exports.BuildMode = void 0;
66
+ var zpm_1 = require("@zeppos/zpm");
67
+ var rd = __importStar(require("rd"));
68
+ var fs_1 = __importDefault(require("fs"));
69
+ var path = __importStar(require("path"));
70
+ var fs_extra_1 = __importDefault(require("fs-extra"));
71
+ var form_data_1 = __importDefault(require("form-data"));
72
+ var index_1 = require("../index");
73
+ var lodash_1 = require("lodash");
74
+ var lodash_2 = require("lodash");
75
+ var chalk_1 = __importDefault(require("chalk"));
76
+ var chokidar_1 = __importDefault(require("chokidar"));
77
+ var parse_gitignore_1 = __importDefault(require("parse-gitignore"));
78
+ var BuildMode;
79
+ (function (BuildMode) {
80
+ BuildMode["DEV"] = "development";
81
+ BuildMode["PREVIEW"] = "preview";
82
+ BuildMode["PROD"] = "production";
83
+ })(BuildMode = exports.BuildMode || (exports.BuildMode = {}));
84
+ var TransformType;
85
+ (function (TransformType) {
86
+ TransformType["Default"] = "";
87
+ TransformType["Js"] = "js";
88
+ TransformType["C"] = "c";
89
+ TransformType["Bin"] = "bin";
90
+ })(TransformType || (TransformType = {}));
91
+ var gitignoreDefaultItem = [
92
+ '.DS_Store',
93
+ 'node_modules/**',
94
+ 'dist/*',
95
+ 'npm-debug.log',
96
+ 'yarn-debug.log*',
97
+ 'yarn-error.log*',
98
+ 'yarn.lock',
99
+ 'package-lock.json',
100
+ 'selenium-debug.log',
101
+ '.idea',
102
+ '.vscode',
103
+ '*.suo',
104
+ '*.ntvs*',
105
+ '*.njsproj',
106
+ '*.sln',
107
+ ];
108
+ var build = function (workspace, mode, buildConfigOption, packages, appId) {
109
+ if (mode === void 0) { mode = BuildMode.PROD; }
110
+ if (appId === void 0) { appId = '10000'; }
111
+ return __awaiter(void 0, void 0, void 0, function () {
112
+ var buildOptions, _a, js2c, _b, js2bin, _c, png2vg, _d, prune, curOpt, productName_1, DistDir_1, name_1, newName_1, error_1;
113
+ return __generator(this, function (_e) {
114
+ switch (_e.label) {
115
+ case 0:
116
+ buildOptions = {
117
+ path: workspace,
118
+ targets: packages,
119
+ buildMode: mode,
120
+ jsc: TransformType.Default
121
+ };
122
+ if (mode === BuildMode.PROD || mode === BuildMode.PREVIEW) {
123
+ _a = buildConfigOption || {}, js2c = _a.js2c, _b = _a.js2bin, js2bin = _b === void 0 ? true : _b, _c = _a.png2vg, png2vg = _c === void 0 ? true : _c, _d = _a.prune, prune = _d === void 0 ? true : _d;
124
+ js2c = !!(js2c === 'true' || js2c === true);
125
+ js2bin = !!(js2bin === 'true' || js2bin === true);
126
+ png2vg = !!(png2vg === 'true' || png2vg === true);
127
+ prune = !!(prune === 'true' || prune === true);
128
+ js2c && Object.assign(buildOptions, { jsc: TransformType.C });
129
+ js2bin && Object.assign(buildOptions, { jsc: TransformType.Bin });
130
+ Object.assign(buildOptions, {
131
+ png2vg: png2vg,
132
+ prune: prune
133
+ });
134
+ }
135
+ _e.label = 1;
136
+ case 1:
137
+ _e.trys.push([1, 6, , 7]);
138
+ index_1.logger.info("Start building package, targets: ".concat(packages.join(', '), "."));
139
+ curOpt = (buildConfigOption ? buildConfigOption._ : [''])[0];
140
+ if (!(mode !== BuildMode.DEV ||
141
+ (mode === BuildMode.DEV && curOpt === 'install'))) return [3, 3];
142
+ return [4, (0, zpm_1.start)(buildOptions)];
143
+ case 2:
144
+ productName_1 = _e.sent();
145
+ if (productName_1) {
146
+ DistDir_1 = path.join(workspace, 'dist');
147
+ name_1 = productName_1.replace(/[\s]/g, '_').split('.zab');
148
+ newName_1 = "".concat(appId, "-").concat(name_1[0], ".zab");
149
+ rd.eachFileSync(DistDir_1, function (file) {
150
+ var oldName = path.join(DistDir_1, productName_1);
151
+ if (file !== oldName) {
152
+ fs_extra_1["default"].removeSync(file);
153
+ }
154
+ else {
155
+ fs_1["default"].renameSync(oldName, path.join(DistDir_1, newName_1));
156
+ }
157
+ });
158
+ productName_1 = newName_1;
159
+ }
160
+ return [2, productName_1];
161
+ case 3:
162
+ if (!(mode === BuildMode.DEV)) return [3, 5];
163
+ return [4, (0, zpm_1.startWithoutDist)(buildOptions)];
164
+ case 4:
165
+ _e.sent();
166
+ return [2, (0, zpm_1.getZpkBuf)(packages[0])];
167
+ case 5: return [3, 7];
168
+ case 6:
169
+ error_1 = _e.sent();
170
+ index_1.logger.error(error_1);
171
+ return [3, 7];
172
+ case 7: return [2];
173
+ }
174
+ });
175
+ });
176
+ };
177
+ exports.build = build;
178
+ var previewBuild = function (root, args, workspace, appType, curCommand) { return __awaiter(void 0, void 0, void 0, function () {
179
+ return __generator(this, function (_a) {
180
+ return [2, new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
181
+ var form;
182
+ return __generator(this, function (_a) {
183
+ form = new form_data_1["default"]();
184
+ form.append('file', fs_1["default"].createReadStream(workspace));
185
+ form.append('app_type', appType === index_1.config.AppType.WATCHFACE ? '1' : '2');
186
+ form.getLength(function (err, length) { return __awaiter(void 0, void 0, void 0, function () {
187
+ var protocol, code, res, error_2, _subRegionalHost, url, _a, deviceSource, appId, appName, appType_1, deviceSourceArr, targetDeviceInternalName, packageInfo, url, preview, downloadPackageReturn;
188
+ return __generator(this, function (_b) {
189
+ switch (_b.label) {
190
+ case 0:
191
+ if (err) {
192
+ index_1.logger.error('getting package failed.');
193
+ return [2];
194
+ }
195
+ protocol = '';
196
+ code = '';
197
+ _b.label = 1;
198
+ case 1:
199
+ _b.trys.push([1, 3, , 7]);
200
+ return [4, index_1.api.uploadPackage(form, length)];
201
+ case 2:
202
+ res = _b.sent();
203
+ protocol = res.protocol;
204
+ code = res.code;
205
+ return [3, 7];
206
+ case 3:
207
+ error_2 = _b.sent();
208
+ if (!((error_2 === null || error_2 === void 0 ? void 0 : error_2.message) === '401')) return [3, 5];
209
+ index_1.logger.warn("Login information is invalid. Please login again, or end this service and login again with the command 'zeus login'.");
210
+ return [4, index_1.modules.login().then(function (res) { return __awaiter(void 0, void 0, void 0, function () {
211
+ return __generator(this, function (_a) {
212
+ args._loginAppToken = res.appToken;
213
+ process.env._loginAppToken = res.appToken;
214
+ reject('reTry');
215
+ return [2];
216
+ });
217
+ }); })];
218
+ case 4:
219
+ _b.sent();
220
+ return [3, 6];
221
+ case 5:
222
+ index_1.logger.error(error_2 === null || error_2 === void 0 ? void 0 : error_2.message);
223
+ reject('reTry');
224
+ return [2];
225
+ case 6: return [3, 7];
226
+ case 7:
227
+ if (!(curCommand === 'preview')) return [3, 8];
228
+ _subRegionalHost = process.env._subRegionalHost;
229
+ url = "".concat(protocol, "://").concat(_subRegionalHost, "/custom/tools/app-dial/download/").concat(code);
230
+ protocol && code ? resolve({ type: 'preview', url: url }) : reject();
231
+ return [3, 10];
232
+ case 8:
233
+ if (!(curCommand === 'install')) return [3, 10];
234
+ _a = (0, index_1.getDeviceInfoFromAppJson)(root), deviceSource = _a.deviceSource, appId = _a.appId, appName = _a.appName, appType_1 = _a.appType, deviceSourceArr = _a.deviceSourceArr, targetDeviceInternalName = _a.targetDeviceInternalName;
235
+ return [4, index_1.api.downloadPackage(code, deviceSource, appType_1)];
236
+ case 9:
237
+ packageInfo = _b.sent();
238
+ url = packageInfo;
239
+ preview = '';
240
+ if (appType_1 === index_1.config.AppType.WATCHFACE) {
241
+ downloadPackageReturn = (0, lodash_1.get)(packageInfo, 'data', {});
242
+ url = downloadPackageReturn.url;
243
+ preview = downloadPackageReturn.preview;
244
+ }
245
+ resolve({
246
+ appType: appType_1,
247
+ url: url,
248
+ preview: preview,
249
+ appid: appId,
250
+ name: appName,
251
+ "debugger": true,
252
+ updatedTime: Math.round(new Date().getTime() / 1000),
253
+ devices: deviceSourceArr,
254
+ target: targetDeviceInternalName
255
+ });
256
+ _b.label = 10;
257
+ case 10: return [2];
258
+ }
259
+ });
260
+ }); });
261
+ return [2];
262
+ });
263
+ }); })];
264
+ });
265
+ }); };
266
+ exports.previewBuild = previewBuild;
267
+ var runX = function (root, args, url, packages, logAfterFunc) { return __awaiter(void 0, void 0, void 0, function () {
268
+ var logger, simulator, refreshSimulator, gitignorePath, gitignore, ignored;
269
+ return __generator(this, function (_a) {
270
+ logger = new index_1.MyLogger();
271
+ if (logAfterFunc) {
272
+ logger.addAfterFunc(logAfterFunc);
273
+ }
274
+ simulator = new index_1.Simulator(url);
275
+ refreshSimulator = (0, lodash_2.debounce)(function () { return __awaiter(void 0, void 0, void 0, function () {
276
+ var zpkBuffer, _a, targetDeviceInternalName, appId, devices, projectName;
277
+ return __generator(this, function (_b) {
278
+ switch (_b.label) {
279
+ case 0:
280
+ logger.info('rebuilding...');
281
+ if (process.env._targetDeviceToBuild && !args.target) {
282
+ args.target = process.env._targetDeviceToBuild;
283
+ }
284
+ return [4, index_1.modules.build(root, BuildMode.DEV, args, packages)];
285
+ case 1:
286
+ zpkBuffer = _b.sent();
287
+ if (zpkBuffer) {
288
+ logger.info('rebuild done');
289
+ logger.info('refreshing simulator...');
290
+ _a = (0, index_1.getDeviceInfoFromAppJson)(root), targetDeviceInternalName = _a.targetDeviceInternalName, appId = _a.appId, devices = _a.deviceSourceArr;
291
+ projectName = path.parse(process.cwd()).base;
292
+ simulator.upload(zpkBuffer, projectName, targetDeviceInternalName, appId, devices);
293
+ }
294
+ else {
295
+ logger.error('build error');
296
+ }
297
+ logger.info(chalk_1["default"].green("watching the changes in this project..."));
298
+ return [2];
299
+ }
300
+ });
301
+ }); }, 150, { maxWait: 1000 });
302
+ refreshSimulator();
303
+ gitignorePath = path.resolve(root, '.gitignore');
304
+ fs_extra_1["default"].ensureFileSync(gitignorePath);
305
+ gitignore = (0, parse_gitignore_1["default"])(fs_extra_1["default"].readFileSync(gitignorePath));
306
+ if (!gitignore.length) {
307
+ fs_extra_1["default"].writeFileSync(gitignorePath, gitignoreDefaultItem.join('\n'));
308
+ gitignore = gitignoreDefaultItem;
309
+ }
310
+ ignored = (0, lodash_2.union)([
311
+ '.gitignore',
312
+ 'jsconfig.json',
313
+ 'dist/**/*',
314
+ 'dist',
315
+ 'node_modules/**',
316
+ 'node_modules',
317
+ '.git/**',
318
+ 'yarn.lock',
319
+ 'package-lock.json',
320
+ ], gitignore);
321
+ return [2, chokidar_1["default"]
322
+ .watch('.', {
323
+ ignored: ignored,
324
+ ignoreInitial: true,
325
+ interval: 1000,
326
+ cwd: root
327
+ })
328
+ .on('all', function (_type, path) {
329
+ logger.info("".concat(path, " ").concat(chalk_1["default"].green(_type)));
330
+ refreshSimulator();
331
+ })];
332
+ });
333
+ }); };
334
+ exports.runX = runX;
@@ -1,27 +1,4 @@
1
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
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -65,31 +42,32 @@ exports.__esModule = true;
65
42
  exports.config = void 0;
66
43
  var lodash_1 = __importDefault(require("lodash"));
67
44
  var chalk_1 = __importDefault(require("chalk"));
68
- var storage_1 = require("./storage");
69
- var logger = __importStar(require("../utils/logger"));
70
- var hm_analytics_1 = require("../utils/hm-analytics");
71
- var config = function (args) { return __awaiter(void 0, void 0, void 0, function () {
72
- var cliName, _a, cmd, _b, method, values, allowedMethods, commonHandleNotKeyTips, config_1;
45
+ var index_1 = require("../index");
46
+ var config = function (args, logAfterFunc) { return __awaiter(void 0, void 0, void 0, function () {
47
+ var cliName, _a, cmd, _b, method, values, allowedMethods, myLogger, commonHandleNotKeyTips, config_1;
73
48
  return __generator(this, function (_c) {
74
- cliName = process.env.CMD_NAME;
49
+ cliName = process.env.CMD_NAME || '';
75
50
  _a = lodash_1["default"].get(args, '_', []), cmd = _a[0], _b = _a[1], method = _b === void 0 ? '' : _b, values = _a.slice(2);
76
51
  allowedMethods = ['get', 'set', 'delete', 'list'];
52
+ myLogger = new index_1.MyLogger();
53
+ if (logAfterFunc) {
54
+ myLogger.addAfterFunc(logAfterFunc);
55
+ }
77
56
  if (!lodash_1["default"].includes(allowedMethods, method)) {
78
- logger.error("invalid method: '".concat(method, "'"));
79
- logger.log(chalk_1["default"].yellow('try to use one of the following:'));
80
- logger.log("- ".concat(cliName, " ").concat(cmd, " set <key>=<value> [<key>=<value> ...]"));
81
- logger.log("- ".concat(cliName, " ").concat(cmd, " get <key> [<key> ...]"));
82
- logger.log("- ".concat(cliName, " ").concat(cmd, " delete <key> [<key> ...]"));
83
- logger.log("- ".concat(cliName, " ").concat(cmd, " list [--json]"));
84
- process.exit(0);
57
+ index_1.logger.error("invalid method: '".concat(method, "'"));
58
+ index_1.logger.log(chalk_1["default"].yellow('try to use one of the following:'));
59
+ index_1.logger.log("- ".concat(cliName, " ").concat(cmd, " set <key>=<value> [<key>=<value> ...]"));
60
+ index_1.logger.log("- ".concat(cliName, " ").concat(cmd, " get <key> [<key> ...]"));
61
+ index_1.logger.log("- ".concat(cliName, " ").concat(cmd, " delete <key> [<key> ...]"));
62
+ index_1.logger.log("- ".concat(cliName, " ").concat(cmd, " list [--json]"));
85
63
  }
86
64
  commonHandleNotKeyTips = function (method) {
87
- logger.error("Please enter the data in the format: ".concat(chalk_1["default"].yellow("zeus config ".concat(method, " <key>"))));
65
+ index_1.logger.error("Please enter the data in the format: ".concat(chalk_1["default"].yellow("zeus config ".concat(method, " <key>"))));
88
66
  };
89
67
  switch (method) {
90
68
  case 'set':
91
69
  if (!values.length) {
92
- logger.error("Please enter the data in the format: ".concat(chalk_1["default"].yellow('zeus config set <key>=<value>')));
70
+ myLogger.error("Please enter the data in the format: ".concat(chalk_1["default"].yellow('zeus config set <key>=<value>')));
93
71
  break;
94
72
  }
95
73
  values.forEach(function (info) {
@@ -98,17 +76,17 @@ var config = function (args) { return __awaiter(void 0, void 0, void 0, function
98
76
  key = key.trim();
99
77
  value = value.trim();
100
78
  if (!info.includes('=')) {
101
- logger.error('Please enter the data in the format <key>=<value>');
79
+ myLogger.error('Please enter the data in the format <key>=<value>');
102
80
  }
103
81
  else if (value === '') {
104
- logger.error('please input <value>');
82
+ myLogger.error('please input <value>');
105
83
  }
106
84
  else if (key === '') {
107
- logger.error('please input <key>');
85
+ myLogger.error('please input <key>');
108
86
  }
109
87
  else {
110
- storage_1.globalStorage.set((_a = {}, _a[key] = value, _a));
111
- logger.success("config: ".concat(key, "=").concat(value));
88
+ index_1.globalStorage.set((_a = {}, _a[key] = value, _a));
89
+ myLogger.info("config: ".concat(key, "=").concat(value));
112
90
  }
113
91
  });
114
92
  break;
@@ -119,11 +97,11 @@ var config = function (args) { return __awaiter(void 0, void 0, void 0, function
119
97
  }
120
98
  values.forEach(function (key) {
121
99
  var curKey = key.trim();
122
- if (!storage_1.globalStorage.has(key) || !key) {
123
- logger.error('The <key> does not exist');
100
+ if (!index_1.globalStorage.has(key) || !key) {
101
+ myLogger.error('The <key> does not exist');
124
102
  }
125
103
  else {
126
- logger.log("".concat(curKey, "=").concat(storage_1.globalStorage.get(curKey)));
104
+ myLogger.log("".concat(curKey, "=").concat(index_1.globalStorage.get(curKey)));
127
105
  }
128
106
  });
129
107
  break;
@@ -134,36 +112,32 @@ var config = function (args) { return __awaiter(void 0, void 0, void 0, function
134
112
  }
135
113
  values.forEach(function (key) {
136
114
  var curKey = key.trim();
137
- if (!storage_1.globalStorage.has(key) || !key) {
138
- logger.error('The <key> does not exist');
115
+ if (!index_1.globalStorage.has(key) || !key) {
116
+ myLogger.error('The <key> does not exist');
139
117
  }
140
118
  else {
141
- storage_1.globalStorage.deleteStorage(curKey);
142
- logger.success("config: ".concat(curKey, " deleted"));
119
+ index_1.globalStorage.deleteStorage(curKey);
120
+ myLogger.info("config: ".concat(curKey, " deleted"));
143
121
  }
144
122
  });
145
123
  break;
146
124
  case 'list':
147
- config_1 = storage_1.instanceStorage.getStorage();
125
+ config_1 = index_1.instanceStorage.getStorage();
148
126
  Object.keys(config_1).forEach(function (key) {
149
127
  if (lodash_1["default"].startsWith(key, '____')) {
150
128
  lodash_1["default"].unset(config_1, key);
151
129
  }
152
130
  });
153
131
  if (lodash_1["default"].get(args, 'json', false)) {
154
- logger.log(JSON.stringify(config_1, null, 2));
132
+ myLogger.log(JSON.stringify(config_1, null, 2));
155
133
  }
156
134
  else {
157
- Object.keys(config_1).forEach(function (key) {
158
- logger.log("".concat(key, "=").concat(config_1[key]));
159
- });
135
+ myLogger.log(Object.keys(config_1).map(function (key) { return "".concat(key, "=").concat(config_1[key]); }).join('\n'));
160
136
  }
161
137
  break;
162
138
  default:
163
139
  break;
164
140
  }
165
- (0, hm_analytics_1.HM_Analytics)('ZEPP_CLI_CONFIG_C');
166
- process.exit(0);
167
141
  return [2];
168
142
  });
169
143
  }); };