@zeppos/zeus-cli 1.1.5 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api/index.js CHANGED
@@ -153,8 +153,8 @@ var getConnectDevServerWebSocketCode = function () { return __awaiter(void 0, vo
153
153
  throw new Error('401');
154
154
  }
155
155
  else {
156
- project_1.____inner_global_variable.bridgeOptionalDevice = '';
157
- project_1.____inner_global_variable.bridgeChoiredDevice = '';
156
+ process.env._bridgeOptionalDevice = '';
157
+ process.env._bridgeChoiredDevice = '';
158
158
  throw new Error("GetConnectDevServerWebSocketCode error");
159
159
  }
160
160
  return [3, 4];
package/config/project.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  exports.__esModule = true;
6
- exports.simulatorStorageKey = exports.buildStorageKey = exports.____inner_global_variable = exports.analyticsKey = exports.loginStorageKey = exports.loginConfig = exports.analyticsHost = exports.gitignoreDefaultItem = exports.ACCOUNT_ENV_KEY = exports.TemplateCopyType = exports.AppSourceType = exports.AppType = void 0;
6
+ exports.simulatorStorageKey = exports.analyticsKey = exports.loginStorageKey = exports.loginConfig = exports.analyticsHost = exports.gitignoreDefaultItem = exports.ACCOUNT_ENV_KEY = exports.TemplateCopyType = exports.AppSourceType = exports.AppType = void 0;
7
7
  var lodash_1 = __importDefault(require("lodash"));
8
8
  var AppType;
9
9
  (function (AppType) {
@@ -41,13 +41,6 @@ exports.loginStorageKey = {
41
41
  exports.analyticsKey = {
42
42
  id: "".concat(accountPrefix, "analyticsId")
43
43
  };
44
- exports.____inner_global_variable = {
45
- bridgeOptionalDevice: '',
46
- bridgeChoiredDevice: ''
47
- };
48
- exports.buildStorageKey = {
49
- targetDeviceToBuild: "".concat(accountPrefix, "targetDeviceToBuild")
50
- };
51
44
  exports.simulatorStorageKey = {
52
45
  simulatorHost: 'simulator_host',
53
46
  simulatorPort: 'simulator_port',
package/modules/bridge.js CHANGED
@@ -66,7 +66,6 @@ exports.bridge = void 0;
66
66
  var chalk_1 = __importDefault(require("chalk"));
67
67
  var fs_1 = require("fs");
68
68
  var logger = __importStar(require("../utils/logger"));
69
- var project_1 = require("../config/project");
70
69
  var index_1 = require("../api/index");
71
70
  var websocket_1 = __importDefault(require("./websocket"));
72
71
  var build_1 = require("./build");
@@ -80,7 +79,7 @@ var connectDevice = function (vorpal) { return __awaiter(void 0, void 0, void 0,
80
79
  return __generator(this, function (_a) {
81
80
  switch (_a.label) {
82
81
  case 0:
83
- debugConnectedDevice = JSON.parse(project_1.____inner_global_variable.bridgeOptionalDevice);
82
+ debugConnectedDevice = JSON.parse(process.env._bridgeOptionalDevice);
84
83
  optionalDeviceArr = Object.keys(debugConnectedDevice);
85
84
  len = optionalDeviceArr.length;
86
85
  if (!(len === 0)) return [3, 1];
@@ -104,7 +103,7 @@ var connectDevice = function (vorpal) { return __awaiter(void 0, void 0, void 0,
104
103
  _a.sent();
105
104
  _a.label = 3;
106
105
  case 3:
107
- project_1.____inner_global_variable.bridgeChoiredDevice = choiredDevice;
106
+ process.env._bridgeChoiredDevice = choiredDevice;
108
107
  client.sendMessage({ clientId: clientId_1 }, { method: 'connectClient' });
109
108
  hasConnectDevice = true;
110
109
  _a.label = 4;
package/modules/build.js CHANGED
@@ -97,14 +97,12 @@ function handleExecCommandInErrorDir(mode) {
97
97
  logger.warn("This command needs to be executed in the root of the project.");
98
98
  process.exit(1);
99
99
  }
100
- function chooseBuildPackages(mode, buildConfigOption) {
100
+ function chooseBuildPackages(mode) {
101
101
  if (mode === void 0) { mode = 'development'; }
102
- if (buildConfigOption === void 0) { buildConfigOption = {}; }
103
102
  return __awaiter(this, void 0, void 0, function () {
104
103
  var targets, _a, promptTarget_1, answers;
105
- var _b, _c;
106
- return __generator(this, function (_d) {
107
- switch (_d.label) {
104
+ return __generator(this, function (_b) {
105
+ switch (_b.label) {
108
106
  case 0:
109
107
  if (!appJsonContent) {
110
108
  handleExecCommandInErrorDir(mode);
@@ -116,10 +114,9 @@ function chooseBuildPackages(mode, buildConfigOption) {
116
114
  return [3, 4];
117
115
  case 1:
118
116
  if (!(targets.length === 1)) return [3, 2];
119
- storage_1.globalStorage.set((_b = {}, _b[project_1.buildStorageKey.targetDeviceToBuild] = targets[0], _b));
120
117
  return [2, [targets[0]]];
121
118
  case 2:
122
- _a = buildConfigOption.target, promptTarget_1 = _a === void 0 ? '' : _a;
119
+ _a = process.env._targetDeviceToBuild, promptTarget_1 = _a === void 0 ? '' : _a;
123
120
  return [4, inquirer_1["default"].prompt([
124
121
  {
125
122
  name: 'target',
@@ -154,8 +151,7 @@ function chooseBuildPackages(mode, buildConfigOption) {
154
151
  }
155
152
  ])];
156
153
  case 3:
157
- answers = _d.sent();
158
- storage_1.globalStorage.set((_c = {}, _c[project_1.buildStorageKey.targetDeviceToBuild] = answers.target, _c));
154
+ answers = _b.sent();
159
155
  return [2, typeof answers.target === 'string' ? [answers.target] : answers.target];
160
156
  case 4: return [2];
161
157
  }
@@ -163,26 +159,27 @@ function chooseBuildPackages(mode, buildConfigOption) {
163
159
  });
164
160
  }
165
161
  exports.chooseBuildPackages = chooseBuildPackages;
166
- var build = function (mode, packages, buildConfigOption) {
162
+ var build = function (mode, buildConfigOption) {
167
163
  if (mode === void 0) { mode = BuildMode.PROD; }
168
- if (packages === void 0) { packages = []; }
169
164
  return __awaiter(void 0, void 0, void 0, function () {
170
- var workspace, choosePackages, buildOptions, _a, js2c, js2bin, png2vg, prune, curJscMode, curTarget, buildInfo_1, DistDir_1, error_1;
171
- return __generator(this, function (_b) {
172
- switch (_b.label) {
165
+ var workspace, packages, choosePackages, buildOptions, _a, js2c, _b, js2bin, _c, png2vg, _d, prune, curOpt, productName_1, DistDir_1, appId, name_1, newName_1, error_1;
166
+ return __generator(this, function (_e) {
167
+ switch (_e.label) {
173
168
  case 0:
174
169
  workspace = path.resolve('./');
175
- if (!!packages.length) return [3, 2];
176
- return [4, chooseBuildPackages(mode, buildConfigOption)];
170
+ process.env._targetDeviceToBuild = (buildConfigOption === null || buildConfigOption === void 0 ? void 0 : buildConfigOption.target) || '';
171
+ packages = [];
172
+ return [4, chooseBuildPackages(mode)];
177
173
  case 1:
178
- choosePackages = _b.sent();
174
+ choosePackages = _e.sent();
179
175
  if (!choosePackages || !choosePackages.length) {
180
176
  logger.error('please choose at least one package.');
181
177
  return [2];
182
178
  }
183
179
  packages.push.apply(packages, choosePackages);
184
- _b.label = 2;
185
- case 2:
180
+ if (!process.env._targetDeviceToBuild) {
181
+ process.env._targetDeviceToBuild = packages[0];
182
+ }
186
183
  buildOptions = {
187
184
  path: workspace,
188
185
  targets: packages,
@@ -190,68 +187,70 @@ var build = function (mode, packages, buildConfigOption) {
190
187
  jsc: TransformType.Default
191
188
  };
192
189
  if (mode === BuildMode.PROD || mode === BuildMode.PREVIEW) {
193
- _a = buildConfigOption || {}, js2c = _a.js2c, js2bin = _a.js2bin, png2vg = _a.png2vg, prune = _a.prune;
194
- js2c = js2c === 'false' ? false : true;
195
- js2bin = ((js2bin === 'true') || (js2bin === true)) ? true : false;
196
- png2vg = ((png2vg === 'false') && (png2vg !== undefined)) ? false : true;
197
- prune = ((prune === 'false') && (prune !== undefined)) ? false : true;
198
- curJscMode = js2c && js2bin ? TransformType.Bin : TransformType.C;
199
- if (js2bin && !js2c) {
200
- curJscMode = TransformType.Bin;
201
- }
202
- else if ((!js2bin && !js2c) || !js2c) {
203
- curJscMode = TransformType.Default;
204
- }
190
+ _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;
191
+ js2c = !!((js2c === 'true') || (js2c === true));
192
+ js2bin = !!((js2bin === 'true') || (js2bin === true));
193
+ png2vg = !!((png2vg === 'true') || (png2vg === true));
194
+ prune = !!((prune === 'true') || (prune === true));
195
+ js2c && Object.assign(buildOptions, { jsc: TransformType.C });
196
+ js2bin && Object.assign(buildOptions, { jsc: TransformType.Bin });
205
197
  Object.assign(buildOptions, {
206
198
  png2vg: png2vg,
207
- prune: prune,
208
- jsc: curJscMode
199
+ prune: prune
209
200
  });
210
201
  }
211
- _b.label = 3;
212
- case 3:
213
- _b.trys.push([3, 8, , 9]);
214
- curTarget = (buildConfigOption ? buildConfigOption._ : [''])[0];
215
- if (!(mode !== BuildMode.DEV || (mode === BuildMode.DEV && curTarget === 'install'))) return [3, 5];
202
+ _e.label = 2;
203
+ case 2:
204
+ _e.trys.push([2, 7, , 8]);
205
+ curOpt = (buildConfigOption ? buildConfigOption._ : [''])[0];
206
+ if (!(mode !== BuildMode.DEV || (mode === BuildMode.DEV && curOpt === 'install'))) return [3, 4];
216
207
  return [4, (0, node_js_1.start)(buildOptions)];
217
- case 4:
218
- buildInfo_1 = _b.sent();
219
- if (buildInfo_1) {
208
+ case 3:
209
+ productName_1 = _e.sent();
210
+ if (productName_1) {
220
211
  DistDir_1 = path.join(workspace, 'dist');
212
+ appId = (0, lodash_1.get)(appJsonContent, 'app.appId');
213
+ name_1 = productName_1.replace(/[\s]/g, '_').split('.zab');
214
+ newName_1 = "".concat(appId, "-").concat(name_1[0], ".zab");
221
215
  rd.eachFileSync(DistDir_1, function (file) {
222
- if (file !== path.join(DistDir_1, buildInfo_1)) {
216
+ var oldName = path.join(DistDir_1, productName_1);
217
+ if (file !== oldName) {
223
218
  fs_extra_1["default"].removeSync(file);
224
219
  }
220
+ else {
221
+ fs_1["default"].renameSync(oldName, path.join(DistDir_1, newName_1));
222
+ }
225
223
  });
224
+ productName_1 = newName_1;
226
225
  }
227
- return [2, buildInfo_1];
228
- case 5:
229
- if (!(mode === BuildMode.DEV)) return [3, 7];
226
+ return [2, productName_1];
227
+ case 4:
228
+ if (!(mode === BuildMode.DEV)) return [3, 6];
230
229
  return [4, (0, node_js_1.startWithoutDist)(buildOptions)];
231
- case 6:
232
- _b.sent();
230
+ case 5:
231
+ _e.sent();
233
232
  return [2, (0, node_js_1.getZpkBuf)(packages[0])];
234
- case 7: return [3, 9];
235
- case 8:
236
- error_1 = _b.sent();
233
+ case 6: return [3, 8];
234
+ case 7:
235
+ error_1 = _e.sent();
237
236
  logger.error(error_1);
238
- return [3, 9];
239
- case 9: return [2];
237
+ return [3, 8];
238
+ case 8: return [2];
240
239
  }
241
240
  });
242
241
  });
243
242
  };
244
243
  exports.build = build;
245
- var buildDev = function (args, packages) {
244
+ var buildDev = function (args) {
246
245
  (0, hm_analytics_1.HM_Analytics)('ZEPP_CLI_DEV_C');
247
- return (0, exports.build)(BuildMode.DEV, packages, args);
246
+ return (0, exports.build)(BuildMode.DEV, args);
248
247
  };
249
248
  exports.buildDev = buildDev;
250
249
  var buildProd = function (args) { return __awaiter(void 0, void 0, void 0, function () {
251
250
  var buildInfo;
252
251
  return __generator(this, function (_a) {
253
252
  switch (_a.label) {
254
- case 0: return [4, (0, exports.build)(BuildMode.PROD, [], args)];
253
+ case 0: return [4, (0, exports.build)(BuildMode.PROD, args)];
255
254
  case 1:
256
255
  buildInfo = _a.sent();
257
256
  if (buildInfo) {
@@ -273,7 +272,7 @@ var buildPreview = function (args, cb) { return __awaiter(void 0, void 0, void 0
273
272
  _a = args._, curCommand = _a[0], curBridgeTarget = _a[1];
274
273
  buildMode = (curBridgeTarget && curBridgeTarget === 'simulator') ? BuildMode.DEV : BuildMode.PREVIEW;
275
274
  logger.info('building...');
276
- return [4, (0, exports.build)(buildMode, [], args)];
275
+ return [4, (0, exports.build)(buildMode, args)];
277
276
  case 1:
278
277
  buildInfo = _b.sent();
279
278
  appType = (0, lodash_1.get)(appJsonContent, 'app.appType');
@@ -283,28 +282,28 @@ var buildPreview = function (args, cb) { return __awaiter(void 0, void 0, void 0
283
282
  form.append('file', fs_1["default"].createReadStream("./dist/".concat(buildInfo)));
284
283
  form.append('app_type', isWatchFaceProject ? '1' : '2');
285
284
  form.getLength(function (err, length) { return __awaiter(void 0, void 0, void 0, function () {
286
- var _a, _subRegionalHost, _accountEnv, protocol, code, res, error_2, url, _b, deviceSource, appId, appName, appType_1, deviceSourceArr, targetDeviceInternalName, packageInfo, url, preview, downloadPackageReturn;
287
- return __generator(this, function (_c) {
288
- switch (_c.label) {
285
+ var _subRegionalHost, protocol, code, res, error_2, url, _a, deviceSource, appId, appName, appType_1, deviceSourceArr, targetDeviceInternalName, packageInfo, url, preview, downloadPackageReturn;
286
+ return __generator(this, function (_b) {
287
+ switch (_b.label) {
289
288
  case 0:
290
289
  if (err) {
291
290
  logger.error('getting package failed.');
292
291
  return [2];
293
292
  }
294
- _a = process.env, _subRegionalHost = _a._subRegionalHost, _accountEnv = _a._accountEnv;
293
+ _subRegionalHost = process.env._subRegionalHost;
295
294
  protocol = '';
296
295
  code = '';
297
- _c.label = 1;
296
+ _b.label = 1;
298
297
  case 1:
299
- _c.trys.push([1, 3, , 7]);
298
+ _b.trys.push([1, 3, , 7]);
300
299
  return [4, (0, api_1.uploadPackage)(form, length)];
301
300
  case 2:
302
- res = _c.sent();
301
+ res = _b.sent();
303
302
  protocol = res.protocol;
304
303
  code = res.code;
305
304
  return [3, 7];
306
305
  case 3:
307
- error_2 = _c.sent();
306
+ error_2 = _b.sent();
308
307
  if (!((error_2 === null || error_2 === void 0 ? void 0 : error_2.message) === '401')) return [3, 5];
309
308
  logger.warn("Login information is invalid. Please login again, or end this service and login again with the command 'zeus login'.");
310
309
  return [4, (0, login_1.login)().then(function (res) { return __awaiter(void 0, void 0, void 0, function () {
@@ -315,7 +314,7 @@ var buildPreview = function (args, cb) { return __awaiter(void 0, void 0, void 0
315
314
  });
316
315
  }); })];
317
316
  case 4:
318
- _c.sent();
317
+ _b.sent();
319
318
  return [3, 6];
320
319
  case 5:
321
320
  logger.error(error_2 === null || error_2 === void 0 ? void 0 : error_2.message);
@@ -326,7 +325,7 @@ var buildPreview = function (args, cb) { return __awaiter(void 0, void 0, void 0
326
325
  url = "".concat(protocol, "://").concat(_subRegionalHost, "/custom/tools/app-dial/download/").concat(code);
327
326
  if (protocol && code) {
328
327
  logger.info('Generating preview qrcode...');
329
- logger.success('Please use Zepp APP to scan the following qrcode to preview your application within two hours.');
328
+ logger.success("Please use Zepp APP to scan the following qrcode to preview your ".concat(isWatchFaceProject ? 'WatchFace' : 'application', " within two hours."));
330
329
  qrcode_terminal_1["default"].generate(url, { small: true });
331
330
  storage_1.globalStorage.set({ ____preview_url: url });
332
331
  }
@@ -336,10 +335,10 @@ var buildPreview = function (args, cb) { return __awaiter(void 0, void 0, void 0
336
335
  return [3, 10];
337
336
  case 8:
338
337
  if (!(curCommand === 'install')) return [3, 10];
339
- _b = (0, common_1.getDeviceInfoFromAppJson)(), deviceSource = _b.deviceSource, appId = _b.appId, appName = _b.appName, appType_1 = _b.appType, deviceSourceArr = _b.deviceSourceArr, targetDeviceInternalName = _b.targetDeviceInternalName;
338
+ _a = (0, common_1.getDeviceInfoFromAppJson)(), deviceSource = _a.deviceSource, appId = _a.appId, appName = _a.appName, appType_1 = _a.appType, deviceSourceArr = _a.deviceSourceArr, targetDeviceInternalName = _a.targetDeviceInternalName;
340
339
  return [4, (0, api_1.downloadPackage)(code, deviceSource, appType_1)];
341
340
  case 9:
342
- packageInfo = _c.sent();
341
+ packageInfo = _b.sent();
343
342
  url = packageInfo;
344
343
  preview = '';
345
344
  if (isWatchFaceProject) {
@@ -360,7 +359,7 @@ var buildPreview = function (args, cb) { return __awaiter(void 0, void 0, void 0
360
359
  target: targetDeviceInternalName
361
360
  });
362
361
  }
363
- _c.label = 10;
362
+ _b.label = 10;
364
363
  case 10: return [2];
365
364
  }
366
365
  });
package/modules/run.js CHANGED
@@ -79,12 +79,11 @@ var project_1 = require("../config/project");
79
79
  exports.DEFAULT_HOST = '127.0.0.1';
80
80
  exports.DEFAULT_PORT = '7650';
81
81
  var run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
82
- var simulatorHost, simulatorPort, _a, promptSimulatorHost, _b, promptSimulatorPort, answer, hasStarted, packages, simulatorWebSocketURL, simulator, refreshSimulator, gitignorePath, gitignore, ignored;
82
+ var simulatorHost, simulatorPort, _a, promptSimulatorHost, _b, promptSimulatorPort, answer, hasStarted, simulatorWebSocketURL, simulator, refreshSimulator, gitignorePath, gitignore, ignored;
83
83
  var _c;
84
84
  return __generator(this, function (_d) {
85
85
  switch (_d.label) {
86
86
  case 0:
87
- fs_extra_1["default"].readJSONSync(path.resolve('./app.json'), { throws: false });
88
87
  simulatorHost = '';
89
88
  simulatorPort = '';
90
89
  _a = args.simulatorHost, promptSimulatorHost = _a === void 0 ? '' : _a, _b = args.simulatorPort, promptSimulatorPort = _b === void 0 ? exports.DEFAULT_PORT : _b;
@@ -121,15 +120,14 @@ var run = function (args) { return __awaiter(void 0, void 0, void 0, function ()
121
120
  case 1:
122
121
  answer = _d.sent();
123
122
  if (!simulatorHost) {
123
+ simulatorHost = answer.host || exports.DEFAULT_HOST;
124
+ simulatorPort = answer.port || exports.DEFAULT_PORT;
124
125
  storage_1.globalStorage.set((_c = {},
125
126
  _c[project_1.simulatorStorageKey.simulatorHost] = answer.host || exports.DEFAULT_HOST,
126
127
  _c[project_1.simulatorStorageKey.simulatorPort] = answer.port || exports.DEFAULT_PORT,
127
128
  _c));
128
129
  }
129
130
  hasStarted = false;
130
- return [4, (0, build_1.chooseBuildPackages)('development', args)];
131
- case 2:
132
- packages = _d.sent();
133
131
  simulatorWebSocketURL = "http://".concat(simulatorHost, ":").concat(simulatorPort);
134
132
  simulator = new simulator_1.Simulator(simulatorWebSocketURL);
135
133
  refreshSimulator = lodash_1["default"].debounce(function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -138,13 +136,16 @@ var run = function (args) { return __awaiter(void 0, void 0, void 0, function ()
138
136
  switch (_b.label) {
139
137
  case 0:
140
138
  logger.info('rebuilding...');
141
- return [4, (0, build_1.buildDev)(args, packages)];
139
+ if (process.env._targetDeviceToBuild && !args.target) {
140
+ args.target = process.env._targetDeviceToBuild;
141
+ }
142
+ return [4, (0, build_1.buildDev)(args)];
142
143
  case 1:
143
144
  zpkBuffer = _b.sent();
144
145
  if (zpkBuffer) {
145
146
  logger.info('rebuild done');
146
147
  logger.info('refreshing simulator...');
147
- _a = (0, common_1.getDeviceInfoFromAppJson)(packages[0]), targetDeviceInternalName = _a.targetDeviceInternalName, appId = _a.appId, devices = _a.deviceSourceArr;
148
+ _a = (0, common_1.getDeviceInfoFromAppJson)(), targetDeviceInternalName = _a.targetDeviceInternalName, appId = _a.appId, devices = _a.deviceSourceArr;
148
149
  projectName = path.parse(process.cwd()).base;
149
150
  simulator.upload(zpkBuffer, projectName, targetDeviceInternalName, appId, devices);
150
151
  }
@@ -169,7 +170,7 @@ var run = function (args) { return __awaiter(void 0, void 0, void 0, function ()
169
170
  ignored = lodash_1["default"].union([
170
171
  '.gitignore',
171
172
  'jsconfig.json',
172
- 'dist/*',
173
+ 'dist/**',
173
174
  'node_modules/**',
174
175
  '.git/**',
175
176
  'yarn.lock',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeppos/zeus-cli",
3
- "version": "1.1.5",
3
+ "version": "1.1.8",
4
4
  "description": "zeus mini-program tools",
5
5
  "main": "index.js",
6
6
  "author": "zepp",
@@ -41,7 +41,7 @@
41
41
  "webpack": "^5.52.0"
42
42
  },
43
43
  "dependencies": {
44
- "@zeppos/zpm": "^2.3.10",
44
+ "@zeppos/zpm": "^2.4.0",
45
45
  "axios": "^0.23.0",
46
46
  "chalk": "^4.1.2",
47
47
  "chokidar": "^3.5.2",
package/utils/common.js CHANGED
@@ -31,8 +31,6 @@ var path = __importStar(require("path"));
31
31
  var fs_1 = __importDefault(require("fs"));
32
32
  var os_1 = __importDefault(require("os"));
33
33
  var logger = __importStar(require("./logger"));
34
- var storage_1 = require("../modules/storage");
35
- var project_1 = require("../config/project");
36
34
  var device_1 = require("../config/device");
37
35
  function uint8ToArray(source) {
38
36
  return Array.prototype.slice.call(source);
@@ -58,13 +56,13 @@ function handleListenMsgEvent(msgEventName, data) {
58
56
  }
59
57
  else if (typeof data === 'object' && ((_a = data === null || data === void 0 ? void 0 : data.params) === null || _a === void 0 ? void 0 : _a.clients)) {
60
58
  var connectedDevice = getOptionalConnectDevice(data.params.clients);
61
- project_1.____inner_global_variable.bridgeOptionalDevice = JSON.stringify(connectedDevice);
59
+ process.env._bridgeOptionalDevice = JSON.stringify(connectedDevice);
62
60
  }
63
61
  break;
64
62
  case 'connectClient':
65
63
  var _d = data.result, result = _d === void 0 ? '' : _d, _e = data.error, error = _e === void 0 ? {} : _e;
66
64
  if (result && result === 'success') {
67
- var choiredDevice = project_1.____inner_global_variable.bridgeChoiredDevice;
65
+ var choiredDevice = process.env._bridgeChoiredDevice;
68
66
  logger.info("successfully connected to ".concat(choiredDevice, "."));
69
67
  }
70
68
  if (error && JSON.stringify(error) !== '{}') {
@@ -94,7 +92,9 @@ function handleListenMsgEvent(msgEventName, data) {
94
92
  }
95
93
  else if (typeof data === 'object' && (data === null || data === void 0 ? void 0 : data.params)) {
96
94
  var _j = data.params, level = _j.level, time = _j.time, message = _j.message;
97
- var str = "[".concat(level.toUpperCase() || 'DEBUG', " - ").concat(new Date(time).toLocaleTimeString(), "] ").concat(message);
95
+ var timeString = time.toString();
96
+ var fTime = Number(timeString.length > 13 ? timeString.substr(0, 13) : timeString);
97
+ var str = "[".concat(level.toUpperCase() || 'DEBUG', "-").concat(new Date(fTime).toLocaleTimeString(), ".").concat(new Date(fTime).getMilliseconds(), "] ").concat(message);
98
98
  logger.info(str);
99
99
  }
100
100
  break;
@@ -114,8 +114,8 @@ function handleListenMsgEvent(msgEventName, data) {
114
114
  }
115
115
  }
116
116
  exports.handleListenMsgEvent = handleListenMsgEvent;
117
- var getDeviceInfoFromAppJson = function (curTarget) {
118
- var _curTarget = curTarget ? curTarget : storage_1.globalStorage.get(project_1.buildStorageKey.targetDeviceToBuild);
117
+ var getDeviceInfoFromAppJson = function () {
118
+ var _curTarget = process.env._targetDeviceToBuild;
119
119
  var appJsonFilePath = path.resolve('./app.json');
120
120
  var appJsonContent = JSON.parse(fs_1["default"].readFileSync(appJsonFilePath, 'utf-8'));
121
121
  var targets = appJsonContent.targets;
@@ -148,6 +148,7 @@ var initVariable = function (args) { return __awaiter(void 0, void 0, void 0, fu
148
148
  _a.label = 2;
149
149
  case 2:
150
150
  __env = {
151
+ _targetDeviceToBuild: '',
151
152
  _loginAppToken: apptoken,
152
153
  _loginUserId: userid,
153
154
  _loginCname: cname,