@zeppos/zeus-cli 1.7.10 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/bin/main.js +64 -23
  2. package/bin/post-command.js +1 -1
  3. package/index.js +1 -1
  4. package/modules/bridge.js +43 -33
  5. package/modules/build.js +72 -36
  6. package/modules/create.js +213 -216
  7. package/modules/help.js +21 -11
  8. package/modules/prune.js +1 -1
  9. package/modules/run.js +29 -17
  10. package/modules/version.js +5 -6
  11. package/modules/yargsCmdBuilders.js +3 -3
  12. package/package.json +6 -4
  13. package/private-modules/zeppos-app-utils/dist/api/index.js +18 -20
  14. package/private-modules/zeppos-app-utils/dist/config/device.js +19 -17
  15. package/private-modules/zeppos-app-utils/dist/config/index.js +1 -1
  16. package/private-modules/zeppos-app-utils/dist/config/project.js +14 -14
  17. package/private-modules/zeppos-app-utils/dist/hm-analytics.js +14 -13
  18. package/private-modules/zeppos-app-utils/dist/index.js +18 -8
  19. package/private-modules/zeppos-app-utils/dist/logger/index.js +5 -5
  20. package/private-modules/zeppos-app-utils/dist/logger/my-logger.js +1 -1
  21. package/private-modules/zeppos-app-utils/dist/modules/build.js +73 -46
  22. package/private-modules/zeppos-app-utils/dist/modules/config.js +14 -12
  23. package/private-modules/zeppos-app-utils/dist/modules/create/index.js +71 -39
  24. package/private-modules/zeppos-app-utils/dist/modules/create/local-app.js +82 -66
  25. package/private-modules/zeppos-app-utils/dist/modules/create/yeoman-app.js +6 -6
  26. package/private-modules/zeppos-app-utils/dist/modules/fetchDevices.js +72 -39
  27. package/private-modules/zeppos-app-utils/dist/modules/index.js +1 -1
  28. package/private-modules/zeppos-app-utils/dist/modules/login.js +16 -15
  29. package/private-modules/zeppos-app-utils/dist/modules/open/index.js +62 -50
  30. package/private-modules/zeppos-app-utils/dist/modules/prune.js +5 -5
  31. package/private-modules/zeppos-app-utils/dist/modules/status.js +12 -12
  32. package/private-modules/zeppos-app-utils/dist/simulator.js +3 -3
  33. package/private-modules/zeppos-app-utils/dist/storage/index.js +7 -7
  34. package/private-modules/zeppos-app-utils/dist/tools/index.js +24 -14
  35. package/private-modules/zeppos-app-utils/dist/tools/tools.js +3 -3
  36. package/private-modules/zeppos-app-utils/dist/websocket.js +9 -9
  37. package/private-modules/zeppos-app-utils/package.json +2 -1
  38. package/utils/pre-check.js +52 -30
  39. package/utils/tools.js +4 -4
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  });
21
21
  };
22
22
  var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
@@ -58,14 +58,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
58
58
  var __importDefault = (this && this.__importDefault) || function (mod) {
59
59
  return (mod && mod.__esModule) ? mod : { "default": mod };
60
60
  };
61
- exports.__esModule = true;
61
+ Object.defineProperty(exports, "__esModule", { value: true });
62
62
  var path_1 = __importDefault(require("path"));
63
63
  var child_process_1 = __importDefault(require("child_process"));
64
64
  var fs_1 = require("fs");
65
65
  var is_wsl_1 = __importDefault(require("is-wsl"));
66
66
  var is_docker_1 = __importDefault(require("is-docker"));
67
67
  var define_lazy_prop_1 = __importDefault(require("define-lazy-prop"));
68
- var localXdgOpenPath = path_1["default"].join(__dirname, 'xdg-open');
68
+ var localXdgOpenPath = path_1.default.join(__dirname, 'xdg-open');
69
69
  var platform = process.platform, arch = process.arch;
70
70
  var hasContainerEnv = function () { return __awaiter(void 0, void 0, void 0, function () {
71
71
  var _a;
@@ -87,7 +87,7 @@ var hasContainerEnv = function () { return __awaiter(void 0, void 0, void 0, fun
87
87
  var cachedResult;
88
88
  function isInsideContainer() {
89
89
  if (cachedResult === undefined) {
90
- cachedResult = hasContainerEnv() || (0, is_docker_1["default"])();
90
+ cachedResult = hasContainerEnv() || (0, is_docker_1.default)();
91
91
  }
92
92
  return cachedResult;
93
93
  }
@@ -95,9 +95,9 @@ var getWslDrivesMountPoint = (function () {
95
95
  var defaultMountPoint = '/mnt/';
96
96
  var mountPoint;
97
97
  return function () {
98
- var _a;
99
98
  return __awaiter(this, void 0, void 0, function () {
100
- var configFilePath, isConfigFileExists, _b, configContent, configMountPoint;
99
+ var configFilePath, isConfigFileExists, _a, configContent, configMountPoint;
100
+ var _b;
101
101
  return __generator(this, function (_c) {
102
102
  switch (_c.label) {
103
103
  case 0:
@@ -115,7 +115,7 @@ var getWslDrivesMountPoint = (function () {
115
115
  isConfigFileExists = true;
116
116
  return [3, 4];
117
117
  case 3:
118
- _b = _c.sent();
118
+ _a = _c.sent();
119
119
  return [3, 4];
120
120
  case 4:
121
121
  if (!isConfigFileExists) {
@@ -124,11 +124,11 @@ var getWslDrivesMountPoint = (function () {
124
124
  return [4, fs_1.promises.readFile(configFilePath, { encoding: 'utf8' })];
125
125
  case 5:
126
126
  configContent = _c.sent();
127
- configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
127
+ configMountPoint = /(?<!#.*)root\s*=\s*(.*)/g.exec(configContent);
128
128
  if (!configMountPoint) {
129
129
  return [2, defaultMountPoint];
130
130
  }
131
- mountPoint = (_a = configMountPoint.groups) === null || _a === void 0 ? void 0 : _a.mountPoint.trim();
131
+ mountPoint = (_b = configMountPoint[1]) === null || _b === void 0 ? void 0 : _b.trim();
132
132
  mountPoint = (mountPoint === null || mountPoint === void 0 ? void 0 : mountPoint.endsWith('/')) ? mountPoint : "".concat(mountPoint, "/");
133
133
  return [2, mountPoint];
134
134
  }
@@ -169,15 +169,19 @@ var baseOpen = function (options) { return __awaiter(void 0, void 0, void 0, fun
169
169
  case 0:
170
170
  options = __assign({ wait: false, background: false, newInstance: false, allowNonzeroExitCode: false }, options);
171
171
  if (Array.isArray(options.app)) {
172
- return [2, pTryEach(options.app, function (singleApp) { return baseOpen(__assign(__assign({}, options), { app: singleApp })); })];
172
+ return [2, pTryEach(options.app, function (singleApp) {
173
+ return baseOpen(__assign(__assign({}, options), { app: singleApp }));
174
+ })];
173
175
  }
174
176
  _a = options.app || {}, app = _a.name, _b = _a.arguments, appArguments = _b === void 0 ? [] : _b;
175
177
  appArguments = __spreadArray([], appArguments, true);
176
178
  if (Array.isArray(app)) {
177
- return [2, pTryEach(app, function (appName) { return baseOpen(__assign(__assign({}, options), { app: {
178
- name: appName,
179
- arguments: appArguments
180
- } })); })];
179
+ return [2, pTryEach(app, function (appName) {
180
+ return baseOpen(__assign(__assign({}, options), { app: {
181
+ name: appName,
182
+ arguments: appArguments,
183
+ } }));
184
+ })];
181
185
  }
182
186
  cliArguments = [];
183
187
  childProcessOptions = {};
@@ -197,15 +201,15 @@ var baseOpen = function (options) { return __awaiter(void 0, void 0, void 0, fun
197
201
  }
198
202
  return [3, 10];
199
203
  case 1:
200
- if (!(platform === 'win32' || (is_wsl_1["default"] && !isInsideContainer() && !app))) return [3, 3];
204
+ if (!(platform === 'win32' || (is_wsl_1.default && !isInsideContainer() && !app))) return [3, 3];
201
205
  return [4, getWslDrivesMountPoint()];
202
206
  case 2:
203
207
  mountPoint = _d.sent();
204
- command = is_wsl_1["default"] ?
205
- "".concat(mountPoint, "c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe") :
206
- "".concat(process.env.SYSTEMROOT, "\\System32\\WindowsPowerShell\\v1.0\\powershell");
208
+ command = is_wsl_1.default
209
+ ? "".concat(mountPoint, "c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe")
210
+ : "".concat(process.env.SYSTEMROOT, "\\System32\\WindowsPowerShell\\v1.0\\powershell");
207
211
  cliArguments.push('-NoProfile', '-NonInteractive', '–ExecutionPolicy', 'Bypass', '-EncodedCommand');
208
- if (!is_wsl_1["default"]) {
212
+ if (!is_wsl_1.default) {
209
213
  childProcessOptions.windowsVerbatimArguments = true;
210
214
  }
211
215
  encodedArguments = ['Start'];
@@ -246,8 +250,7 @@ var baseOpen = function (options) { return __awaiter(void 0, void 0, void 0, fun
246
250
  _c = _d.sent();
247
251
  return [3, 8];
248
252
  case 8:
249
- useSystemXdgOpen = process.versions.electron ||
250
- platform === 'android' || isBundled || !exeLocalXdgOpen;
253
+ useSystemXdgOpen = process.versions.electron || platform === 'android' || isBundled || !exeLocalXdgOpen;
251
254
  command = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;
252
255
  _d.label = 9;
253
256
  case 9:
@@ -266,7 +269,7 @@ var baseOpen = function (options) { return __awaiter(void 0, void 0, void 0, fun
266
269
  if (platform === 'darwin' && appArguments.length > 0) {
267
270
  cliArguments.push.apply(cliArguments, __spreadArray(['--args'], appArguments, false));
268
271
  }
269
- subprocess = child_process_1["default"].spawn(command, cliArguments, childProcessOptions);
272
+ subprocess = child_process_1.default.spawn(command, cliArguments, childProcessOptions);
270
273
  if (options.wait) {
271
274
  return [2, new Promise(function (resolve, reject) {
272
275
  subprocess.once('error', reject);
@@ -301,7 +304,7 @@ var openApp = function (name, options) {
301
304
  }
302
305
  return baseOpen(__assign(__assign({}, options), { app: {
303
306
  name: name,
304
- arguments: appArguments
307
+ arguments: appArguments,
305
308
  } }));
306
309
  };
307
310
  function detectArchBinary(binary) {
@@ -317,7 +320,7 @@ function detectArchBinary(binary) {
317
320
  function detectPlatformBinary(_a, _b) {
318
321
  var _c = platform, platformBinary = _a[_c];
319
322
  var wsl = _b.wsl;
320
- if (wsl && is_wsl_1["default"]) {
323
+ if (wsl && is_wsl_1.default) {
321
324
  return detectArchBinary(wsl);
322
325
  }
323
326
  if (!platformBinary) {
@@ -326,30 +329,39 @@ function detectPlatformBinary(_a, _b) {
326
329
  return detectArchBinary(platformBinary);
327
330
  }
328
331
  var apps = {};
329
- (0, define_lazy_prop_1["default"])(apps, 'chrome', function () { return detectPlatformBinary({
330
- darwin: 'google chrome',
331
- win32: 'chrome',
332
- linux: ['google-chrome', 'google-chrome-stable', 'chromium']
333
- }, {
334
- wsl: {
335
- ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
336
- x64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe']
337
- }
338
- }); });
339
- (0, define_lazy_prop_1["default"])(apps, 'firefox', function () { return detectPlatformBinary({
340
- darwin: 'firefox',
341
- win32: 'C:\\Program Files\\Mozilla Firefox\\firefox.exe',
342
- linux: 'firefox'
343
- }, {
344
- wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
345
- }); });
346
- (0, define_lazy_prop_1["default"])(apps, 'edge', function () { return detectPlatformBinary({
347
- darwin: 'microsoft edge',
348
- win32: 'msedge',
349
- linux: ['microsoft-edge', 'microsoft-edge-dev']
350
- }, {
351
- wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
352
- }); });
332
+ (0, define_lazy_prop_1.default)(apps, 'chrome', function () {
333
+ return detectPlatformBinary({
334
+ darwin: 'google chrome',
335
+ win32: 'chrome',
336
+ linux: ['google-chrome', 'google-chrome-stable', 'chromium'],
337
+ }, {
338
+ wsl: {
339
+ ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
340
+ x64: [
341
+ '/mnt/c/Program Files/Google/Chrome/Application/chrome.exe',
342
+ '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
343
+ ],
344
+ },
345
+ });
346
+ });
347
+ (0, define_lazy_prop_1.default)(apps, 'firefox', function () {
348
+ return detectPlatformBinary({
349
+ darwin: 'firefox',
350
+ win32: 'C:\\Program Files\\Mozilla Firefox\\firefox.exe',
351
+ linux: 'firefox',
352
+ }, {
353
+ wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',
354
+ });
355
+ });
356
+ (0, define_lazy_prop_1.default)(apps, 'edge', function () {
357
+ return detectPlatformBinary({
358
+ darwin: 'microsoft edge',
359
+ win32: 'msedge',
360
+ linux: ['microsoft-edge', 'microsoft-edge-dev'],
361
+ }, {
362
+ wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
363
+ });
364
+ });
353
365
  open.apps = apps;
354
366
  open.openApp = openApp;
355
- exports["default"] = open;
367
+ exports.default = open;
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  });
21
21
  };
22
22
  var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
@@ -60,10 +60,10 @@ var __rest = (this && this.__rest) || function (s, e) {
60
60
  var __importDefault = (this && this.__importDefault) || function (mod) {
61
61
  return (mod && mod.__esModule) ? mod : { "default": mod };
62
62
  };
63
- exports.__esModule = true;
63
+ Object.defineProperty(exports, "__esModule", { value: true });
64
64
  exports.prune = void 0;
65
- var fs_1 = __importDefault(require("fs"));
66
65
  var zpm_1 = require("@zeppos/zpm");
66
+ var fs_1 = __importDefault(require("fs"));
67
67
  var index_1 = require("../index");
68
68
  var tools_1 = require("../tools/tools");
69
69
  var prune = function (pruneParams) { return __awaiter(void 0, void 0, void 0, function () {
@@ -72,7 +72,7 @@ var prune = function (pruneParams) { return __awaiter(void 0, void 0, void 0, fu
72
72
  switch (_a.label) {
73
73
  case 0:
74
74
  path = pruneParams.path, ip = pruneParams.ip, restParams = __rest(pruneParams, ["path", "ip"]);
75
- isExistZab = fs_1["default"].readdirSync("".concat(path, "/dist")).find(function (fileName) { return fileName.endsWith('.zab'); });
75
+ isExistZab = fs_1.default.readdirSync("".concat(path, "/dist")).find(function (fileName) { return fileName.endsWith('.zab'); });
76
76
  if (!isExistZab) {
77
77
  index_1.logger.error('No zab file to prune');
78
78
  process.exit(1);
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
- exports.__esModule = true;
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.status = void 0;
43
43
  var lodash_1 = __importDefault(require("lodash"));
44
44
  var chalk_1 = __importDefault(require("chalk"));
@@ -54,7 +54,7 @@ var status = function (args) { return __awaiter(void 0, void 0, void 0, function
54
54
  loginStatus = !!(apptoken && userid && cname);
55
55
  loggerMessage = [];
56
56
  if (!loginStatus) return [3, 5];
57
- userInfoHost = lodash_1["default"].split(lodash_1["default"].toString(cname), ',').filter(function (h) { return h.indexOf('auth-') > -1; })[0];
57
+ userInfoHost = lodash_1.default.split(lodash_1.default.toString(cname), ',').filter(function (h) { return h.indexOf('auth-') > -1; })[0];
58
58
  userInfoURL = "https://".concat(userInfoHost, "/v2/developer/account/center");
59
59
  nickName = '';
60
60
  _o.label = 1;
@@ -64,39 +64,39 @@ var status = function (args) { return __awaiter(void 0, void 0, void 0, function
64
64
  case 2:
65
65
  res = _o.sent();
66
66
  nickName = res.userName;
67
- message = "login status: ".concat(chalk_1["default"].yellow('logged'));
67
+ message = "login status: ".concat(chalk_1.default.yellow('logged'));
68
68
  index_1.logger.log(message);
69
69
  loggerMessage.push(message);
70
70
  return [3, 4];
71
71
  case 3:
72
72
  error_1 = _o.sent();
73
- message = "login status: ".concat(chalk_1["default"].keyword('orange')('no login - invalid token, you can login again with the command `zeus login`'));
73
+ message = "login status: ".concat(chalk_1.default.keyword('orange')('no login - invalid token, you can login again with the command `zeus login`'));
74
74
  index_1.logger.log(message);
75
75
  loggerMessage.push(message);
76
76
  args._loginAppToken = '';
77
77
  process.env._loginAppToken = '';
78
78
  return [3, 4];
79
79
  case 4:
80
- message1_1 = "nickName: ".concat(chalk_1["default"].yellow(nickName || '-'));
80
+ message1_1 = "nickName: ".concat(chalk_1.default.yellow(nickName || '-'));
81
81
  index_1.logger.log(message1_1);
82
82
  loggerMessage.push(message1_1);
83
- message2_1 = "userID: ".concat(chalk_1["default"].yellow(userid));
83
+ message2_1 = "userID: ".concat(chalk_1.default.yellow(userid));
84
84
  index_1.logger.log(message2_1);
85
85
  loggerMessage.push(message2_1);
86
86
  return [3, 6];
87
87
  case 5:
88
- message = "login status: ".concat(chalk_1["default"].yellow('no login'));
88
+ message = "login status: ".concat(chalk_1.default.yellow('no login'));
89
89
  index_1.logger.log(message);
90
90
  loggerMessage.push(message);
91
91
  _o.label = 6;
92
92
  case 6:
93
- message1 = "simulator connect status: ".concat(chalk_1["default"].yellow(simulatorConnectStatus ? simulatorConnectStatus : 'disconnected'));
93
+ message1 = "simulator connect status: ".concat(chalk_1.default.yellow(simulatorConnectStatus ? simulatorConnectStatus : 'disconnected'));
94
94
  index_1.logger.log(message1);
95
95
  loggerMessage.push(message1);
96
- message2 = "simulator host: ".concat(chalk_1["default"].yellow(simulatorHost));
96
+ message2 = "simulator host: ".concat(chalk_1.default.yellow(simulatorHost));
97
97
  index_1.logger.log(message2);
98
98
  loggerMessage.push(message2);
99
- message3 = "simulator port: ".concat(chalk_1["default"].yellow(simulatorPort));
99
+ message3 = "simulator port: ".concat(chalk_1.default.yellow(simulatorPort));
100
100
  index_1.logger.log(message3);
101
101
  loggerMessage.push(message3);
102
102
  return [2, loggerMessage];
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Simulator = void 0;
4
4
  var socket_io_client_1 = require("socket.io-client");
5
5
  var index_1 = require("./index");
@@ -35,7 +35,7 @@ var Simulator = (function () {
35
35
  appid: appid,
36
36
  size: data.byteLength,
37
37
  data: dataArr,
38
- devices: devices
38
+ devices: devices,
39
39
  });
40
40
  this.sendMessage(message);
41
41
  };
@@ -44,7 +44,7 @@ var Simulator = (function () {
44
44
  jsonrpc: '2.0',
45
45
  method: this.previewMethod,
46
46
  params: params,
47
- id: this.previewId
47
+ id: this.previewId,
48
48
  });
49
49
  };
50
50
  Simulator.prototype.decodeMessage = function (data) {
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.globalStorage = exports.instanceStorage = void 0;
18
18
  var dotenv_1 = __importDefault(require("dotenv"));
19
19
  var fs_1 = __importDefault(require("fs"));
@@ -22,19 +22,19 @@ var path_1 = __importDefault(require("path"));
22
22
  var fs_extra_1 = __importDefault(require("fs-extra"));
23
23
  var instanceStorage = (function () {
24
24
  function instanceStorage(path) {
25
- fs_extra_1["default"].ensureFileSync(path);
25
+ fs_extra_1.default.ensureFileSync(path);
26
26
  this._storageFilePath = path;
27
27
  instanceStorage._storageFilePathStatic = path;
28
- this._storageJsonData = dotenv_1["default"].parse(fs_1["default"].readFileSync(path));
28
+ this._storageJsonData = dotenv_1.default.parse(fs_1.default.readFileSync(path));
29
29
  }
30
30
  instanceStorage.initInstance = function () {
31
31
  if (!instanceStorage.instance) {
32
- instanceStorage.instance = new instanceStorage(path_1["default"].resolve(os_1["default"].homedir(), ".zepp/.zeus"));
32
+ instanceStorage.instance = new instanceStorage(path_1.default.resolve(os_1.default.homedir(), ".zepp/.zeus"));
33
33
  }
34
34
  return instanceStorage.instance;
35
35
  };
36
36
  instanceStorage.prototype._syncStorageEnvToJson = function () {
37
- this._storageJsonData = dotenv_1["default"].parse(fs_1["default"].readFileSync(this._storageFilePath));
37
+ this._storageJsonData = dotenv_1.default.parse(fs_1.default.readFileSync(this._storageFilePath));
38
38
  };
39
39
  instanceStorage.prototype._syncJsonDataToStorageEnv = function () {
40
40
  var _this = this;
@@ -42,10 +42,10 @@ var instanceStorage = (function () {
42
42
  Object.keys(this._storageJsonData).forEach(function (key) {
43
43
  dotenvArray.push("".concat(key, "=").concat(_this._storageJsonData[key]));
44
44
  });
45
- fs_1["default"].writeFileSync(this._storageFilePath, dotenvArray.join('\n'));
45
+ fs_1.default.writeFileSync(this._storageFilePath, dotenvArray.join('\n'));
46
46
  };
47
47
  instanceStorage.getStorage = function (key) {
48
- var result = dotenv_1["default"].parse(fs_1["default"].readFileSync(instanceStorage._storageFilePathStatic));
48
+ var result = dotenv_1.default.parse(fs_1.default.readFileSync(instanceStorage._storageFilePathStatic));
49
49
  if (!key)
50
50
  return result;
51
51
  Object.keys(result).forEach(function (itemK) {
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -32,8 +42,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
42
  });
33
43
  };
34
44
  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;
45
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
46
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
47
  function verb(n) { return function (v) { return step([n, v]); }; }
38
48
  function step(op) {
39
49
  if (f) throw new TypeError("Generator is already executing.");
@@ -61,7 +71,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
61
71
  var __importDefault = (this && this.__importDefault) || function (mod) {
62
72
  return (mod && mod.__esModule) ? mod : { "default": mod };
63
73
  };
64
- exports.__esModule = true;
74
+ Object.defineProperty(exports, "__esModule", { value: true });
65
75
  exports.checkCreateName = exports.sleep = exports.getDeviceInfoFromAppJson = exports.getInfoFromAppJson = exports.parserZeusCommand = void 0;
66
76
  var yargs_parser_1 = __importDefault(require("yargs-parser"));
67
77
  var path = __importStar(require("path"));
@@ -71,11 +81,11 @@ var fs_1 = require("fs");
71
81
  var rd = __importStar(require("rd"));
72
82
  var getDeviceConf = index_1.config.getDeviceConf;
73
83
  var parserZeusCommand = function (command) {
74
- return (0, yargs_parser_1["default"])(command.replace(/^(zeus )/, ''));
84
+ return (0, yargs_parser_1.default)(command.replace(/^(zeus )/, ''));
75
85
  };
76
86
  exports.parserZeusCommand = parserZeusCommand;
77
87
  var getInfoFromAppJson = function (root) {
78
- return fs_extra_1["default"].readJSONSync(root, { throws: false });
88
+ return fs_extra_1.default.readJSONSync(root, { throws: false });
79
89
  };
80
90
  exports.getInfoFromAppJson = getInfoFromAppJson;
81
91
  var getDeviceInfoFromAppJson = function (root) {
@@ -95,7 +105,7 @@ var getDeviceInfoFromAppJson = function (root) {
95
105
  appName: appName,
96
106
  appType: appType,
97
107
  deviceSourceArr: deviceSourceArr,
98
- targetDeviceInternalName: deviceInternalCodeName[deviceSource]
108
+ targetDeviceInternalName: deviceInternalCodeName[deviceSource],
99
109
  };
100
110
  };
101
111
  exports.getDeviceInfoFromAppJson = getDeviceInfoFromAppJson;
@@ -127,7 +137,7 @@ var checkCreateName = function (command, root, projectName, from) { return __awa
127
137
  }
128
138
  return [2, {
129
139
  beforeFiles: beforeFiles,
130
- workDir: workDir
140
+ workDir: workDir,
131
141
  }];
132
142
  });
133
143
  }); };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.booleanString = exports.compareVersion = exports.versionToCode = void 0;
4
4
  var versionToCode = function (version) {
5
5
  if (!version)
@@ -14,8 +14,8 @@ var compareVersion = function (version1, version2) {
14
14
  exports.compareVersion = compareVersion;
15
15
  var booleanString = function (val) {
16
16
  var booleanValMap = {
17
- 'false': false,
18
- 'true': true
17
+ false: false,
18
+ true: true,
19
19
  };
20
20
  if (typeof val === 'string') {
21
21
  var boolVal = booleanValMap[val.trim()];
@@ -2,8 +2,10 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- exports.__esModule = true;
6
- exports.WebSocketClass = exports.handleListenMsgEvent = exports.getOptionalConnectDevice = void 0;
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WebSocketClass = void 0;
7
+ exports.getOptionalConnectDevice = getOptionalConnectDevice;
8
+ exports.handleListenMsgEvent = handleListenMsgEvent;
7
9
  var index_1 = require("./index");
8
10
  var ws_1 = __importDefault(require("ws"));
9
11
  var os_1 = __importDefault(require("os"));
@@ -18,7 +20,6 @@ function getOptionalConnectDevice(connectDeviceArr) {
18
20
  });
19
21
  return result;
20
22
  }
21
- exports.getOptionalConnectDevice = getOptionalConnectDevice;
22
23
  function handleListenMsgEvent(msgEventName, data) {
23
24
  var _a, _b, _c;
24
25
  switch (msgEventName) {
@@ -71,8 +72,8 @@ function handleListenMsgEvent(msgEventName, data) {
71
72
  }
72
73
  break;
73
74
  case 'screenShot':
74
- var path_1 = "".concat(os_1["default"].homedir(), "/desktop/screenShot.png");
75
- fs_1["default"].writeFile(path_1, Buffer.from(data.result, 'hex'), function (err) {
75
+ var path_1 = "".concat(os_1.default.homedir(), "/desktop/screenShot.png");
76
+ fs_1.default.writeFile(path_1, Buffer.from(data.result, 'hex'), function (err) {
76
77
  if (err) {
77
78
  index_1.logger.log('screenShot error', err);
78
79
  }
@@ -85,7 +86,6 @@ function handleListenMsgEvent(msgEventName, data) {
85
86
  break;
86
87
  }
87
88
  }
88
- exports.handleListenMsgEvent = handleListenMsgEvent;
89
89
  var WebSocketClass = (function () {
90
90
  function WebSocketClass(_a) {
91
91
  var url = _a.url, connectWSCB = _a.connectWSCB, disConnectWSCB = _a.disConnectWSCB;
@@ -114,7 +114,7 @@ var WebSocketClass = (function () {
114
114
  index_1.logger.error("handleListenMsgEvent, ".concat(JSON.stringify(error)));
115
115
  }
116
116
  };
117
- this.socket = new ws_1["default"](url);
117
+ this.socket = new ws_1.default(url);
118
118
  this.socket.on('open', function () {
119
119
  connectWSCB();
120
120
  _this.listenEvent();
@@ -136,7 +136,7 @@ var WebSocketClass = (function () {
136
136
  method: method,
137
137
  params: params,
138
138
  jsonrpc: '2.0',
139
- id: this.createMsgEventID(method, params === null || params === void 0 ? void 0 : params.type)
139
+ id: this.createMsgEventID(method, params === null || params === void 0 ? void 0 : params.type),
140
140
  };
141
141
  msg = JSON.stringify(msgParams);
142
142
  }
@@ -146,7 +146,7 @@ var WebSocketClass = (function () {
146
146
  var id = parseInt('' + Math.random() * 10000);
147
147
  var prop = method;
148
148
  var typeMap = {
149
- 'screenshot': 'screenShot'
149
+ screenshot: 'screenShot',
150
150
  };
151
151
  if (type && typeMap[type]) {
152
152
  prop = typeMap[type];
@@ -13,7 +13,7 @@
13
13
  "dev": "nodemon -e ts,tsx --exec \"rimraf dist && tsc && ts-node build.ts\" --ignore types/ --ignore dist/"
14
14
  },
15
15
  "dependencies": {
16
- "@zeppos/zpm": "^3.2.8",
16
+ "@zeppos/zpm": "^3.3.0",
17
17
  "axios": "1.8.2",
18
18
  "chalk": "^4.1.2",
19
19
  "chokidar": "^3.6.0",
@@ -27,6 +27,7 @@
27
27
  "is-docker": "^2.2.1",
28
28
  "is-wsl": "^2.2.0",
29
29
  "lodash": "^4.17.21",
30
+ "ora": "^9.0.0",
30
31
  "parse-gitignore": "^2.0.0",
31
32
  "qs": "^6.13.1",
32
33
  "rd": "^2.0.1",