@zeppos/zeus-cli 1.6.7-beta3 → 1.6.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.
Files changed (141) hide show
  1. package/bin/main.js +12 -1
  2. package/modules/build.js +9 -3
  3. package/modules/create.js +3 -0
  4. package/modules/version.js +5 -1
  5. package/package.json +3 -3
  6. package/private-modules/zeppos-app-utils/dist/logger/index.js +4 -4
  7. package/private-modules/zeppos-app-utils/dist/modules/create/index.js +4 -3
  8. package/private-modules/zeppos-app-utils/dist/modules/fetchDevices.js +46 -37
  9. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/_package.json +17 -0
  10. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/app.js +27 -0
  11. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/app.json +52 -0
  12. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/consume.png +0 -0
  13. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/beer.png +0 -0
  14. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/cake.png +0 -0
  15. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/chocolate.png +0 -0
  16. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/coffee.png +0 -0
  17. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/cookies.png +0 -0
  18. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/ham.png +0 -0
  19. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/hamburger.png +0 -0
  20. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/ice cream.png +0 -0
  21. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/pizza.png +0 -0
  22. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/sausage.png +0 -0
  23. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/icon.png +0 -0
  24. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/multiply.png +0 -0
  25. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/selected.png +0 -0
  26. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/unselected.png +0 -0
  27. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/consume.png +0 -0
  28. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/beer.png +0 -0
  29. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/cake.png +0 -0
  30. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/chocolate.png +0 -0
  31. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/coffee.png +0 -0
  32. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/cookies.png +0 -0
  33. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/ham.png +0 -0
  34. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/hamburger.png +0 -0
  35. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/ice cream.png +0 -0
  36. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/pizza.png +0 -0
  37. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/sausage.png +0 -0
  38. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/icon.png +0 -0
  39. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/multiply.png +0 -0
  40. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/selected.png +0 -0
  41. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/unselected.png +0 -0
  42. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/global.d.ts +1 -0
  43. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/jsconfig.json +9 -0
  44. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.js +107 -0
  45. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.r.layout.js +48 -0
  46. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.s.layout.js +33 -0
  47. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.js +127 -0
  48. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.r.layout.js +110 -0
  49. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.s.layout.js +98 -0
  50. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/i18n/en-US.po +42 -0
  51. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/i18n/zh-CN.po +42 -0
  52. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/utils/constants.js +62 -0
  53. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/utils/storage.js +40 -0
  54. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/_package.json +14 -0
  55. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app-side/i18n/en-US.po +2 -0
  56. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app-side/index.js +13 -0
  57. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app.js +10 -0
  58. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app.json +60 -0
  59. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.b/icon.png +0 -0
  60. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.r/icon.png +0 -0
  61. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.s/icon.png +0 -0
  62. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/global.d.ts +1 -0
  63. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/jsconfig.json +9 -0
  64. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/i18n/en-US.po +2 -0
  65. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.b.layout.js +6 -0
  66. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.js +7 -0
  67. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.r.layout.js +6 -0
  68. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.s.layout.js +6 -0
  69. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/setting/i18n/en-US.po +2 -0
  70. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/setting/index.js +7 -0
  71. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/_package.json +17 -0
  72. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app-side/i18n/en-US.po +2 -0
  73. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app-side/index.js +56 -0
  74. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app.js +14 -0
  75. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app.json +51 -0
  76. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/assets/common.r/icon.png +0 -0
  77. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/assets/common.s/icon.png +0 -0
  78. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/global.d.ts +1 -0
  79. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/jsconfig.json +9 -0
  80. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/i18n/en-US.po +2 -0
  81. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.js +45 -0
  82. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.r.layout.js +32 -0
  83. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.s.layout.js +32 -0
  84. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/utils/config/constants.js +2 -0
  85. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/utils/config/device.js +2 -0
  86. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/_package.json +17 -0
  87. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/app.js +10 -0
  88. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/app.json +51 -0
  89. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.r/icon.png +0 -0
  90. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.r/image/logo.png +0 -0
  91. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.s/icon.png +0 -0
  92. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.s/image/logo.png +0 -0
  93. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/global.d.ts +1 -0
  94. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/jsconfig.json +9 -0
  95. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.js +17 -0
  96. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.r.layout.js +19 -0
  97. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.s.layout.js +19 -0
  98. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/i18n/en-US.po +2 -0
  99. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/i18n/zh-CN.po +2 -0
  100. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/utils/index.js +3 -0
  101. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/_package.json +17 -0
  102. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/app.js +16 -0
  103. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/app.json +71 -0
  104. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.b/icon.png +0 -0
  105. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.r/icon.png +0 -0
  106. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.r/images/icons/ic_moon.png +0 -0
  107. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.s/icon.png +0 -0
  108. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/global.d.ts +1 -0
  109. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/jsconfig.json +9 -0
  110. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_01/index.js +205 -0
  111. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_01/index.r.layout.js +106 -0
  112. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_02/index.js +88 -0
  113. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_02/index.r.layout.js +74 -0
  114. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_03/index.js +98 -0
  115. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_03/index.r.layout.js +80 -0
  116. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/i18n/en-US.po +2 -0
  117. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/index.js +53 -0
  118. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/index.r.layout.js +75 -0
  119. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/.prettierrc.js +6 -0
  120. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/_package.json +17 -0
  121. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app-side/index.js +47 -0
  122. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app.js +17 -0
  123. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app.json +55 -0
  124. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/add.png +0 -0
  125. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/delete.png +0 -0
  126. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/icon.png +0 -0
  127. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/add.png +0 -0
  128. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/delete.png +0 -0
  129. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/icon.png +0 -0
  130. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/global.d.ts +1 -0
  131. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/jsconfig.json +9 -0
  132. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.js +177 -0
  133. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.r.layout.js +112 -0
  134. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.s.layout.js +112 -0
  135. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/i18n/en-US.po +21 -0
  136. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/setting/i18n/en-US.po +5 -0
  137. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/setting/index.js +143 -0
  138. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/constants.js +3 -0
  139. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/fs.js +34 -0
  140. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/index.js +38 -0
  141. package/private-modules/zeppos-app-utils/package.json +2 -2
package/bin/main.js CHANGED
@@ -50,7 +50,7 @@ var pre_check_1 = require("../utils/pre-check");
50
50
  var index_1 = require("../index");
51
51
  var zeppos_app_utils_1 = require("zeppos-app-utils");
52
52
  var tools_1 = require("../utils/tools");
53
- var login = zeppos_app_utils_1.modules.login, logout = zeppos_app_utils_1.modules.logout, status = zeppos_app_utils_1.modules.status, modulesConfig = zeppos_app_utils_1.modules.config, fetchDevices = zeppos_app_utils_1.modules.fetchDevices;
53
+ var login = zeppos_app_utils_1.modules.login, logout = zeppos_app_utils_1.modules.logout, status = zeppos_app_utils_1.modules.status, modulesConfig = zeppos_app_utils_1.modules.config, devicesData = zeppos_app_utils_1.modules.fetchDevices;
54
54
  var context = {};
55
55
  var yargsCmdBuilderFunc = function (cmdName, useProxy, yargs) {
56
56
  if (useProxy === void 0) { useProxy = false; }
@@ -59,6 +59,17 @@ var yargsCmdBuilderFunc = function (cmdName, useProxy, yargs) {
59
59
  return index_1.yargsCmdBuilders[cmdName](yargs);
60
60
  }
61
61
  };
62
+ var fetchDevices = function () { return __awaiter(void 0, void 0, void 0, function () {
63
+ var zeusVer;
64
+ return __generator(this, function (_a) {
65
+ switch (_a.label) {
66
+ case 0:
67
+ zeusVer = (0, index_1.zeusCurrentVersion)();
68
+ return [4, devicesData(zeusVer)];
69
+ case 1: return [2, _a.sent()];
70
+ }
71
+ });
72
+ }); };
62
73
  var proxy = function (args) { return __awaiter(void 0, void 0, void 0, function () {
63
74
  var res;
64
75
  return __generator(this, function (_a) {
package/modules/build.js CHANGED
@@ -83,6 +83,7 @@ var qrcode_terminal_1 = __importDefault(require("qrcode-terminal"));
83
83
  var inquirer_1 = __importDefault(require("inquirer"));
84
84
  var zeppos_app_utils_1 = require("zeppos-app-utils");
85
85
  var tools_1 = require("../utils/tools");
86
+ var chalk_1 = __importDefault(require("chalk"));
86
87
  var AppType = zeppos_app_utils_1.config.AppType, getDeviceConf = zeppos_app_utils_1.config.getDeviceConf;
87
88
  var appJsonPath = path.resolve('./app.json');
88
89
  var appJsonContent = fs_extra_1["default"].readJSONSync(appJsonPath, { throws: false });
@@ -163,6 +164,7 @@ var chooseBuildTargetsV3Config = function (mode, args) {
163
164
  case 3:
164
165
  answers = _a;
165
166
  return [2, {
167
+ device: answers.device,
166
168
  sources: (0, lodash_1.get)(targetDevices, "[".concat(answers.device, "].platforms"), []).reduce(function (list, item) {
167
169
  list.push(Number(item.deviceSource));
168
170
  return (0, lodash_1.uniq)((0, lodash_1.compact)(list));
@@ -321,7 +323,7 @@ var buildProd = function (args) { return __awaiter(void 0, void 0, void 0, funct
321
323
  }); };
322
324
  exports.buildProd = buildProd;
323
325
  var buildPreview = function (args, callback) { return __awaiter(void 0, void 0, void 0, function () {
324
- var _a, curCommand, curBridgeTarget, buildMode, appType, _b, _c, _d, buildInfo;
326
+ var _a, curCommand, curBridgeTarget, buildMode, appType, appName, appVersion, _b, _c, _d, buildDevice, buildInfo;
325
327
  return __generator(this, function (_e) {
326
328
  switch (_e.label) {
327
329
  case 0:
@@ -331,11 +333,14 @@ var buildPreview = function (args, callback) { return __awaiter(void 0, void 0,
331
333
  : BuildMode.PREVIEW;
332
334
  zeppos_app_utils_1.logger.info('building...');
333
335
  appType = (0, lodash_1.get)(appJsonContent, 'app.appType');
336
+ appName = (0, lodash_1.get)(appJsonContent, 'app.appName');
337
+ appVersion = (0, lodash_1.get)(appJsonContent, 'app.version.name');
334
338
  _c = (_b = Object).assign;
335
339
  _d = [args];
336
340
  return [4, (0, exports.chooseBuildPackages)(BuildMode.PREVIEW, args)];
337
341
  case 1:
338
342
  _c.apply(_b, _d.concat([_e.sent()]));
343
+ buildDevice = args.device;
339
344
  return [4, zeppos_app_utils_1.modules.buildSupportV3Config(path.resolve('./'), buildMode, __assign(__assign({}, args), { renameWithAppId: (0, lodash_1.get)(appJsonContent, 'app.appId') }))];
340
345
  case 2:
341
346
  buildInfo = _e.sent();
@@ -348,10 +353,11 @@ var buildPreview = function (args, callback) { return __awaiter(void 0, void 0,
348
353
  case 0:
349
354
  if (!(res.type === 'preview')) return [3, 1];
350
355
  zeppos_app_utils_1.logger.info('Generating preview QR code...');
351
- 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', "."));
352
- zeppos_app_utils_1.logger.success("The QR code will expire on ".concat((0, dayjs_1["default"])()
356
+ 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', "."));
357
+ zeppos_app_utils_1.logger.success("This QR code will expire on ".concat((0, dayjs_1["default"])()
353
358
  .add(7, 'days')
354
359
  .format('YYYY-MM-DD HH:mm:ss'), "."));
360
+ zeppos_app_utils_1.logger.log("[".concat(chalk_1["default"].cyan(buildDevice), "] ").concat(appName, "-").concat(appVersion));
355
361
  qrcode_terminal_1["default"].generate(res.url, { small: true });
356
362
  callback && callback(res);
357
363
  return [3, 4];
package/modules/create.js CHANGED
@@ -104,6 +104,9 @@ var inquirerFunc = function (args, _a) {
104
104
  {
105
105
  name: 'OS 3.0 API (Build products can run on devices with OS 3.0 and above)',
106
106
  value: 'v3'
107
+ }, {
108
+ name: 'OS 4.0 API (Build products can run on devices with OS 4.0 and above)',
109
+ value: 'v4'
107
110
  }];
108
111
  if (isWatchFace) {
109
112
  options = options.slice(0, 2);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  exports.__esModule = true;
4
- exports.version = void 0;
4
+ exports.zeusCurrentVersion = exports.version = void 0;
5
5
  var node_child_process_1 = require("node:child_process");
6
6
  var appUtilPkg = require('zeppos-app-utils/package.json');
7
7
  var zeusVersion = require('../package.json').version;
@@ -34,3 +34,7 @@ function version() {
34
34
  ].join('\n');
35
35
  }
36
36
  exports.version = version;
37
+ function zeusCurrentVersion() {
38
+ return zeusVersion;
39
+ }
40
+ exports.zeusCurrentVersion = zeusCurrentVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeppos/zeus-cli",
3
- "version": "1.6.7-beta3",
3
+ "version": "1.6.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.7.2",
24
- "@zeppos/zpm": "^3.1.13-beta2",
24
+ "@zeppos/zpm": "^3.1.5",
25
25
  "axios": "^1.7.7",
26
26
  "chalk": "^4.1.2",
27
27
  "chokidar": "^3.6.0",
@@ -32,7 +32,7 @@
32
32
  "fs-extra": "^10.1.0",
33
33
  "get-port": "5.1.1",
34
34
  "inquirer": "^8.2.6",
35
- "is-docker": "^2.1.1",
35
+ "is-docker": "^2.2.1",
36
36
  "is-wsl": "^2.2.0",
37
37
  "lodash": "^4.17.21",
38
38
  "parse-gitignore": "^2.0.0",
@@ -36,16 +36,16 @@ var LoggerInstance = (function () {
36
36
  console.log.apply(console, args);
37
37
  };
38
38
  LoggerInstance.prototype.info = function (msg) {
39
- console.log(chalk_1["default"].blue('info '), msg);
39
+ console.log(chalk_1["default"].blue('[ℹ]'), msg);
40
40
  };
41
41
  LoggerInstance.prototype.warn = function (msg) {
42
- console.log(chalk_1["default"].keyword('orange')('warning '), msg);
42
+ console.log(chalk_1["default"].keyword('orange')('[⚠]'), msg);
43
43
  };
44
44
  LoggerInstance.prototype.success = function (msg) {
45
- console.log(chalk_1["default"].green('success '), msg);
45
+ console.log(chalk_1["default"].green('[✔]'), msg);
46
46
  };
47
47
  LoggerInstance.prototype.error = function (msg) {
48
- console.log(chalk_1["default"].red('error '), msg);
48
+ console.log(chalk_1["default"].red('[✘]'), msg);
49
49
  };
50
50
  return LoggerInstance;
51
51
  }());
@@ -117,7 +117,8 @@ var createX = function (cwdPath, args, func, beforeFiles) {
117
117
  v1: (0, path_1.resolve)(templateDir, './os1.0'),
118
118
  v2: (0, path_1.resolve)(templateDir, './os2.0'),
119
119
  v3: (0, path_1.resolve)(templateDir, './os3.0'),
120
- 'v3.5': (0, path_1.resolve)(templateDir, './os3.5')
120
+ 'v3.5': (0, path_1.resolve)(templateDir, './os3.5'),
121
+ v4: (0, path_1.resolve)(templateDir, './os4.0')
121
122
  };
122
123
  localTemplates = Object.keys(localTemplatesDirMap).reduce(function (temps, osVersion) {
123
124
  var dir = localTemplatesDirMap[osVersion];
@@ -131,14 +132,14 @@ var createX = function (cwdPath, args, func, beforeFiles) {
131
132
  };
132
133
  return temps;
133
134
  }, {});
134
- allOS = ['v1', 'v2', 'v3', 'v3.5'];
135
+ allOS = ['v1', 'v2', 'v3', 'v3.5', 'v4'];
135
136
  appTypes = ['watchface', 'app', 'workout-extension'];
136
137
  genChoices = function () { return allOS.reduce(function (pre, osVersion) {
137
138
  pre[osVersion] = [];
138
139
  return pre;
139
140
  }, {}); };
140
141
  localChoices = genChoices();
141
- watchfaceTemplateChoices = { v1: [], v2: [], 'v3': [], 'v3.5': [] };
142
+ watchfaceTemplateChoices = { v1: [], v2: [] };
142
143
  appTemplateChoices = genChoices();
143
144
  workoutExtTemplateChoices = { 'v3.5': [] };
144
145
  getTemplateChoices = function (appType) {
@@ -52,8 +52,8 @@ var chalk_1 = __importDefault(require("chalk"));
52
52
  var accountEnv = (0, config_1.getLocalConfig)().account_env;
53
53
  var dayMS = 24 * 60 * 60 * 1000;
54
54
  var LOCAL_CACHE_DEVICE_PATH = path_1["default"].resolve(os_1["default"].homedir(), ".zepp/.zeus_devices");
55
- var serverPath = 'https://upload-cdn.zepp.com/zeppos/devkit/zeus/devices.json';
56
- var serverPathBeta = 'https://upload-cdn.zepp.com/zeppos/devkit/zeus/devices.beta1.json';
55
+ var serverPath = accountEnv === 'test' ? 'https://upload-testing-cdn.huami.com/zeppos/devkit/zeus/devices.json' : 'https://upload-cdn.zepp.com/zeppos/devkit/zeus/devices.json';
56
+ var serverPathBeta = 'https://upload-cdn.zepp.com/zeppos/devkit/zeus/devices.beta.json';
57
57
  var DeviceScreenType;
58
58
  (function (DeviceScreenType) {
59
59
  DeviceScreenType["R"] = "r";
@@ -82,41 +82,50 @@ var fetchDevicesData = function (cdnUrl) {
82
82
  });
83
83
  });
84
84
  };
85
- var fetchDevices = function () { return __awaiter(void 0, void 0, void 0, function () {
86
- var localContent, now, prodDevices, betaDevices;
87
- return __generator(this, function (_a) {
88
- switch (_a.label) {
89
- case 0:
90
- localContent = {};
91
- if (fs_1["default"].existsSync(LOCAL_CACHE_DEVICE_PATH)) {
92
- try {
93
- localContent = fs_extra_1["default"].readJsonSync(LOCAL_CACHE_DEVICE_PATH);
85
+ var fetchDevices = function (currentVersion) {
86
+ if (currentVersion === void 0) { currentVersion = ''; }
87
+ return __awaiter(void 0, void 0, void 0, function () {
88
+ var localContent, generatedVersion, now, prodDevices, betaDevices;
89
+ return __generator(this, function (_a) {
90
+ switch (_a.label) {
91
+ case 0:
92
+ localContent = {};
93
+ if (fs_1["default"].existsSync(LOCAL_CACHE_DEVICE_PATH)) {
94
+ try {
95
+ localContent = fs_extra_1["default"].readJsonSync(LOCAL_CACHE_DEVICE_PATH);
96
+ }
97
+ catch (_e) { }
94
98
  }
95
- catch (_e) { }
96
- }
97
- now = Date.now().valueOf();
98
- if (!!((0, lodash_1.get)(localContent, 'expiredTime') > now)) return [3, 3];
99
- logger_1.logger.log(chalk_1["default"].hex('#DB8C41')('Updating devices, waiting ...'));
100
- return [4, fetchDevicesData(serverPath)];
101
- case 1:
102
- prodDevices = _a.sent();
103
- return [4, fetchDevicesData(serverPathBeta)];
104
- case 2:
105
- betaDevices = _a.sent();
106
- if (!(0, lodash_1.isEmpty)(prodDevices) || !(0, lodash_1.isEmpty)(betaDevices)) {
107
- fs_extra_1["default"].writeJsonSync(LOCAL_CACHE_DEVICE_PATH, {
108
- devices: prodDevices,
109
- devices_beta: betaDevices,
110
- expiredTime: now + 3 * dayMS
111
- });
112
- }
113
- else {
114
- return [2, {}];
115
- }
116
- return [3, 4];
117
- case 3: return [2, {}];
118
- case 4: return [2];
119
- }
99
+ generatedVersion = (0, lodash_1.get)(localContent, 'version') || '';
100
+ if (generatedVersion === '' || generatedVersion !== currentVersion) {
101
+ fs_extra_1["default"].removeSync(LOCAL_CACHE_DEVICE_PATH);
102
+ localContent = {};
103
+ }
104
+ now = Date.now().valueOf();
105
+ if (!!((0, lodash_1.get)(localContent, 'expiredTime') > now)) return [3, 3];
106
+ logger_1.logger.log(chalk_1["default"].hex('#DB8C41')('Updating devices, waiting ...'));
107
+ return [4, fetchDevicesData(serverPath)];
108
+ case 1:
109
+ prodDevices = _a.sent();
110
+ return [4, fetchDevicesData(serverPathBeta)];
111
+ case 2:
112
+ betaDevices = _a.sent();
113
+ if (!(0, lodash_1.isEmpty)(prodDevices) || !(0, lodash_1.isEmpty)(betaDevices)) {
114
+ fs_extra_1["default"].writeJsonSync(LOCAL_CACHE_DEVICE_PATH, {
115
+ devices: prodDevices,
116
+ devices_beta: [],
117
+ expiredTime: now + 3 * dayMS,
118
+ version: currentVersion
119
+ });
120
+ }
121
+ else {
122
+ return [2, {}];
123
+ }
124
+ return [3, 4];
125
+ case 3: return [2, {}];
126
+ case 4: return [2];
127
+ }
128
+ });
120
129
  });
121
- }); };
130
+ };
122
131
  exports.fetchDevices = fetchDevices;
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "calories",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "app.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "devDependencies": {
12
+ "@zeppos/device-types": "^3.0.0"
13
+ },
14
+ "dependencies": {
15
+ "@zeppos/zml": "^0.0.38"
16
+ }
17
+ }
@@ -0,0 +1,27 @@
1
+ import { log as Logger } from "@zos/utils";
2
+ import LocalStorage from "./utils/storage";
3
+
4
+ const logger = Logger.getLogger("calories-app");
5
+ const fileName = "calorie_data.txt";
6
+
7
+ App({
8
+ globalData: {
9
+ foodType: "chocolate",
10
+ localStorage: null,
11
+ },
12
+ onCreate() {
13
+ try {
14
+ this.globalData.localStorage = new LocalStorage(fileName);
15
+ const { foodType = "chocolate" } = this.globalData.localStorage.get();
16
+ this.globalData.foodType = foodType;
17
+ } catch (e) {
18
+ logger.log("--->e:", e);
19
+ }
20
+ },
21
+
22
+ onDestroy() {
23
+ this.globalData.localStorage.set({
24
+ foodType: getApp()._options.globalData.foodType,
25
+ });
26
+ },
27
+ });
@@ -0,0 +1,52 @@
1
+ {
2
+ "configVersion": "v3",
3
+ "app": {
4
+ "appId": 20001,
5
+ "appName": "Calories",
6
+ "appType": "app",
7
+ "version": {
8
+ "code": 1,
9
+ "name": "1.0.0"
10
+ },
11
+ "icon": "icon.png",
12
+ "vender": "zepp",
13
+ "description": "calories application"
14
+ },
15
+ "permissions": [
16
+ "data:os.device.info",
17
+ "device:os.local_storage",
18
+ "data:user.hd.calorie"
19
+ ],
20
+ "runtime": {
21
+ "apiVersion": {
22
+ "compatible": "4.0",
23
+ "target": "4.0",
24
+ "minVersion": "4.0"
25
+ }
26
+ },
27
+ "targets": {
28
+ "gt": {
29
+ "module": {
30
+ "page": {
31
+ "pages": ["page/gt/index", "page/gt/food-list"]
32
+ }
33
+ },
34
+ "platforms": [
35
+ {
36
+ "st": "r",
37
+ "dw": 480
38
+ },
39
+ {
40
+ "st": "s",
41
+ "dw": 390
42
+ }
43
+ ]
44
+ }
45
+ },
46
+ "i18n": {
47
+ "en-US": {
48
+ "appName": "Calories"
49
+ }
50
+ },
51
+ "defaultLanguage": "en-US"
52
+ }
@@ -0,0 +1 @@
1
+ /// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "target": "es6",
5
+ "checkJs": true
6
+ },
7
+ "exclude": ["node_modules", "**/node_modules/*"],
8
+ "files": ["node_modules/@zeppos/device-types/dist/index.d.ts"]
9
+ }
@@ -0,0 +1,107 @@
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
+ COMMON_TITLE_TEXT,
7
+ FOOD_LIST_Y,
8
+ FOOD_LIST_ITEM_MARGIN,
9
+ FOOD_LIST_ITEM_HEIGHT,
10
+ FOOD_LIST_RADIOGROUP,
11
+ FOOD_LIST_RADIO_ITEM,
12
+ FOOD_LIST_RADIO_ITEM_TEXT,
13
+ } from "zosLoader:./food-list.[pf].layout.js";
14
+ import { FOOD_CALORIES, isSquare } 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
+ buildTitle() {
34
+ !isSquare && hmUI.createWidget(hmUI.widget.TEXT, COMMON_TITLE_TEXT);
35
+ },
36
+ buildFoodList() {
37
+ let activeIndex = 0;
38
+ const radioGroup = hmUI.createWidget(hmUI.widget.RADIO_GROUP, {
39
+ ...FOOD_LIST_RADIOGROUP,
40
+ check_func: (group, index, checked) => {
41
+ if (checked) {
42
+ this.state.isFinishInit && this.setPrograms(index);
43
+ }
44
+ },
45
+ });
46
+
47
+ this.state.radioGroup = radioGroup;
48
+
49
+ for (let index = 0; index < FOOD_CALORIES.length; index++) {
50
+ this.buildRadioButton(index);
51
+ this.buildRadioText(index);
52
+ activeIndex =
53
+ FOOD_CALORIES[index].type === globalData.foodType ? index : activeIndex;
54
+ }
55
+ this.state.activeIndex = activeIndex;
56
+ this.initRadioGroup();
57
+ },
58
+ buildElement() {
59
+ this.buildTitle();
60
+ this.buildFoodList();
61
+ },
62
+ buildRadioButton(index) {
63
+ const radio = this.state.radioGroup.createWidget(hmUI.widget.STATE_BUTTON, {
64
+ ...FOOD_LIST_RADIO_ITEM.styles,
65
+ y: px(index * (FOOD_LIST_ITEM_HEIGHT + FOOD_LIST_ITEM_MARGIN)),
66
+ });
67
+ this.state.radioButtonsArray.push(radio);
68
+ },
69
+ buildRadioText(index) {
70
+ const text = hmUI.createWidget(hmUI.widget.TEXT, {
71
+ ...FOOD_LIST_RADIO_ITEM_TEXT,
72
+ y: px(
73
+ FOOD_LIST_Y + index * (FOOD_LIST_ITEM_HEIGHT + FOOD_LIST_ITEM_MARGIN)
74
+ ),
75
+ text: `${FOOD_CALORIES[index].name[0].toUpperCase()}${FOOD_CALORIES[
76
+ index
77
+ ].name.slice(1)}`,
78
+ });
79
+ text.addEventListener(hmUI.event.SELECT, () => {
80
+ this.state.radioGroup.setProperty(
81
+ hmUI.prop.CHECKED,
82
+ this.state.radioButtonsArray[index]
83
+ );
84
+ });
85
+ },
86
+ initRadioGroup() {
87
+ this.state.radioGroup.setProperty(
88
+ hmUI.prop.INIT,
89
+ this.state.radioButtonsArray[0]
90
+ );
91
+ this.state.radioGroup.setProperty(
92
+ hmUI.prop.CHECKED,
93
+ this.state.radioButtonsArray[this.state.activeIndex]
94
+ );
95
+ this.state.isFinishInit = true;
96
+ },
97
+ build() {
98
+ this.buildElement();
99
+ },
100
+ onReady() {},
101
+
102
+ onShow() {},
103
+
104
+ onHide() {},
105
+
106
+ onDestroy() {},
107
+ });
@@ -0,0 +1,48 @@
1
+ import * as hmUI from "@zos/ui";
2
+ import { getText } from "@zos/i18n";
3
+ import { px } from "@zos/utils";
4
+
5
+ import { DEVICE_WIDTH } from "../../utils/constants";
6
+
7
+ export const COMMON_TITLE_TEXT = {
8
+ text: getText("calories"),
9
+ x: px(96),
10
+ y: px(40),
11
+ w: DEVICE_WIDTH - 2 * px(96),
12
+ h: px(46),
13
+ color: 0xffffff,
14
+ text_size: px(36),
15
+ align_h: hmUI.align.CENTER_H,
16
+ align_v: hmUI.align.CENTER_V,
17
+ text_style: hmUI.text_style.WRAP,
18
+ };
19
+
20
+ export const FOOD_LIST_Y = px(178);
21
+ export const FOOD_LIST_ITEM_MARGIN = px(64);
22
+ export const FOOD_LIST_ITEM_HEIGHT = px(64);
23
+ export const FOOD_LIST_RADIOGROUP = {
24
+ select_src: "selected.png",
25
+ unselect_src: "unselected.png",
26
+ x: px(44),
27
+ y: px(FOOD_LIST_Y),
28
+ w: -1,
29
+ h: -1,
30
+ };
31
+
32
+ export const FOOD_LIST_RADIO_ITEM = {
33
+ x: 0,
34
+ y: 0,
35
+ w: px(FOOD_LIST_ITEM_HEIGHT),
36
+ h: px(FOOD_LIST_ITEM_HEIGHT),
37
+ };
38
+
39
+ export const FOOD_LIST_RADIO_ITEM_TEXT = {
40
+ x: px(120),
41
+ y: 0,
42
+ w: px(360),
43
+ h: px(64),
44
+ color: 0xffffff,
45
+ text_size: px(32),
46
+ align_h: hmUI.align.LEFT,
47
+ align_v: hmUI.align.CENTER_V,
48
+ };