utiller 1.0.124 → 1.0.127

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.
@@ -33,6 +33,8 @@ var _exceptioner = _interopRequireDefault(require("../exceptioner"));
33
33
 
34
34
  var _moment = _interopRequireDefault(require("moment"));
35
35
 
36
+ var _uuid = require("uuid");
37
+
36
38
  function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
37
39
 
38
40
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -61,6 +63,12 @@ var Utiller = /*#__PURE__*/function () {
61
63
 
62
64
  (0, _classCallCheck2["default"])(this, Utiller);
63
65
  (0, _defineProperty2["default"])(this, "mapOfIdNTimeoutId", {});
66
+ (0, _defineProperty2["default"])(this, "getEnvironment", function () {
67
+ return _this.env;
68
+ });
69
+ (0, _defineProperty2["default"])(this, "isProductionEnvironment", function () {
70
+ return _lodash["default"].isEqual(_this.getEnvironment(), "prod");
71
+ });
64
72
  (0, _defineProperty2["default"])(this, "asyncUnitTaskFunction", function () {
65
73
  var millionSec = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
66
74
 
@@ -166,10 +174,6 @@ var Utiller = /*#__PURE__*/function () {
166
174
  this.init();
167
175
  this.env = "dev";
168
176
  }
169
- /**
170
- * 執行為了避免沒意義的任務重複執行, 像是search 輸入關鍵字後, 不應該每次onchange就呼叫一次建議列表, 應該等到打完後500ms後在去 執行搜尋任務
171
- * */
172
-
173
177
 
174
178
  (0, _createClass2["default"])(Utiller, [{
175
179
  key: "isValidVersionOfString",
@@ -218,6 +222,26 @@ var Utiller = /*#__PURE__*/function () {
218
222
  numbers[last] = numbers[last] + delta;
219
223
  return numbers.join(".");
220
224
  }
225
+ }, {
226
+ key: "getUuidOfV4",
227
+ value: function getUuidOfV4() {
228
+ return (0, _uuid.v4)();
229
+ }
230
+ }, {
231
+ key: "performActionWithoutTimingIssue",
232
+ value: function performActionWithoutTimingIssue() {
233
+ var task = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
234
+ return true;
235
+ };
236
+ var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
237
+ this.syncDelay(wait).then(function () {
238
+ return task();
239
+ });
240
+ }
241
+ /**
242
+ * 執行為了避免沒意義的任務重複執行, 像是search 輸入關鍵字後, 不應該每次onchange就呼叫一次建議列表, 應該等到打完後500ms後在去 執行搜尋任務
243
+ * */
244
+
221
245
  }, {
222
246
  key: "executeTimeoutTask",
223
247
  value: function executeTimeoutTask(functionOfAsyncTask) {
@@ -277,16 +301,6 @@ var Utiller = /*#__PURE__*/function () {
277
301
  value: function setEnvironment(env) {
278
302
  this.env = env;
279
303
  }
280
- }, {
281
- key: "getEnvironment",
282
- value: function getEnvironment() {
283
- return this.env;
284
- }
285
- }, {
286
- key: "isProductionEnvironment",
287
- value: function isProductionEnvironment() {
288
- return _lodash["default"].isEqual(this.env, "prod");
289
- }
290
304
  }, {
291
305
  key: "appendInfo",
292
306
  value: function appendInfo() {
@@ -1178,6 +1178,7 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
1178
1178
 
1179
1179
  var path,
1180
1180
  deployToNPMServer,
1181
+ forceInstallNodeModule,
1181
1182
  packagejsons,
1182
1183
  _len8,
1183
1184
  exclude,
@@ -1193,6 +1194,7 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
1193
1194
  case 0:
1194
1195
  path = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : "./";
1195
1196
  deployToNPMServer = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : false;
1197
+ forceInstallNodeModule = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : true;
1196
1198
  packagejsons = this.findFilePathByExtension(path, ["json"], "node_modules", "release");
1197
1199
  packagejsons = _lodash["default"].filter(packagejsons, function (each) {
1198
1200
  return _lodash["default"].isEqual(each.fileName, "package");
@@ -1201,12 +1203,12 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
1201
1203
  return _this7.getFolderPathOfSpecificPath(each.absolute);
1202
1204
  });
1203
1205
 
1204
- for (_len8 = _args11.length, exclude = new Array(_len8 > 2 ? _len8 - 2 : 0), _key8 = 2; _key8 < _len8; _key8++) {
1205
- exclude[_key8 - 2] = _args11[_key8];
1206
+ for (_len8 = _args11.length, exclude = new Array(_len8 > 3 ? _len8 - 3 : 0), _key8 = 3; _key8 < _len8; _key8++) {
1207
+ exclude[_key8 - 3] = _args11[_key8];
1206
1208
  }
1207
1209
 
1208
1210
  _iterator8 = _createForOfIteratorHelper(packagejsons);
1209
- _context11.prev = 7;
1211
+ _context11.prev = 8;
1210
1212
  _loop = /*#__PURE__*/_regenerator["default"].mark(function _loop() {
1211
1213
  var path, tempFolderPath, release, pathOfPackageJson, indexFileName, templatePath, _yield$_this7$upgrade, moduleName, version;
1212
1214
 
@@ -1221,7 +1223,7 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
1221
1223
  return !_this7.has(path, projectName);
1222
1224
  };
1223
1225
  })))) {
1224
- _context10.next = 40;
1226
+ _context10.next = 44;
1225
1227
  break;
1226
1228
  }
1227
1229
 
@@ -1275,88 +1277,100 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
1275
1277
  /** 安裝一個沒有devDependency 的node_module */
1276
1278
 
1277
1279
 
1278
- _context10.next = 25;
1279
- return _this7.executeCommandLine("\ncd ".concat(release, " && yarn install --production"));
1280
+ if (!(forceInstallNodeModule || !_this7.isPathExist(_path5["default"].join(release, "node_module")))) {
1281
+ _context10.next = 28;
1282
+ break;
1283
+ }
1284
+
1285
+ _context10.next = 26;
1286
+ return _this7.executeCommandLine("cd ".concat(release, " && yarn install --production"));
1287
+
1288
+ case 26:
1289
+ _context10.next = 29;
1290
+ break;
1280
1291
 
1281
- case 25:
1292
+ case 28:
1293
+ _this7.appendInfo("ignore node-module install behavior");
1294
+
1295
+ case 29:
1282
1296
  _this7.appendInfo("build ".concat(path, " succeed"));
1283
1297
  /** 部署到 local server*/
1284
1298
 
1285
1299
 
1286
1300
  if (!deployToNPMServer) {
1287
- _context10.next = 29;
1301
+ _context10.next = 33;
1288
1302
  break;
1289
1303
  }
1290
1304
 
1291
- _context10.next = 29;
1305
+ _context10.next = 33;
1292
1306
  return _this7.executeCommandLine("cd ".concat(release, " && npm publish"));
1293
1307
 
1294
- case 29:
1295
- _context10.next = 36;
1308
+ case 33:
1309
+ _context10.next = 40;
1296
1310
  break;
1297
1311
 
1298
- case 31:
1299
- _context10.prev = 31;
1312
+ case 35:
1313
+ _context10.prev = 35;
1300
1314
  _context10.t0 = _context10["catch"](9);
1301
- _context10.next = 35;
1315
+ _context10.next = 39;
1302
1316
  return _this7.deleteSelfByPath(release, true);
1303
1317
 
1304
- case 35:
1318
+ case 39:
1305
1319
  throw new _index2["default"](9999, "generatePackage \u5831\u932F, ".concat(_context10.t0.message));
1306
1320
 
1307
- case 36:
1308
- _context10.prev = 36;
1309
- _context10.next = 39;
1321
+ case 40:
1322
+ _context10.prev = 40;
1323
+ _context10.next = 43;
1310
1324
  return _this7.deleteSelfByPath(tempFolderPath, true);
1311
1325
 
1312
- case 39:
1313
- return _context10.finish(36);
1326
+ case 43:
1327
+ return _context10.finish(40);
1314
1328
 
1315
- case 40:
1329
+ case 44:
1316
1330
  case "end":
1317
1331
  return _context10.stop();
1318
1332
  }
1319
1333
  }
1320
- }, _loop, null, [[9, 31, 36, 40]]);
1334
+ }, _loop, null, [[9, 35, 40, 44]]);
1321
1335
  });
1322
1336
 
1323
1337
  _iterator8.s();
1324
1338
 
1325
- case 10:
1339
+ case 11:
1326
1340
  if ((_step8 = _iterator8.n()).done) {
1327
- _context11.next = 14;
1341
+ _context11.next = 15;
1328
1342
  break;
1329
1343
  }
1330
1344
 
1331
- return _context11.delegateYield(_loop(), "t0", 12);
1345
+ return _context11.delegateYield(_loop(), "t0", 13);
1332
1346
 
1333
- case 12:
1334
- _context11.next = 10;
1347
+ case 13:
1348
+ _context11.next = 11;
1335
1349
  break;
1336
1350
 
1337
- case 14:
1338
- _context11.next = 19;
1351
+ case 15:
1352
+ _context11.next = 20;
1339
1353
  break;
1340
1354
 
1341
- case 16:
1342
- _context11.prev = 16;
1343
- _context11.t1 = _context11["catch"](7);
1355
+ case 17:
1356
+ _context11.prev = 17;
1357
+ _context11.t1 = _context11["catch"](8);
1344
1358
 
1345
1359
  _iterator8.e(_context11.t1);
1346
1360
 
1347
- case 19:
1348
- _context11.prev = 19;
1361
+ case 20:
1362
+ _context11.prev = 20;
1349
1363
 
1350
1364
  _iterator8.f();
1351
1365
 
1352
- return _context11.finish(19);
1366
+ return _context11.finish(20);
1353
1367
 
1354
- case 22:
1368
+ case 23:
1355
1369
  case "end":
1356
1370
  return _context11.stop();
1357
1371
  }
1358
1372
  }
1359
- }, _callee10, this, [[7, 16, 19, 22]]);
1373
+ }, _callee10, this, [[8, 17, 20, 23]]);
1360
1374
  }));
1361
1375
 
1362
1376
  function generatePackage() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utiller",
3
- "version": "1.0.124",
3
+ "version": "1.0.127",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,7 +20,8 @@
20
20
  "lodash": "^4.17.20",
21
21
  "moment": "^2.29.1",
22
22
  "pdf-parse": "^1.1.1",
23
- "prompt": "^1.1.0"
23
+ "prompt": "^1.1.0",
24
+ "uuid": "^8.3.2"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@babel/cli": "^7.12.8",
@@ -11,7 +11,7 @@
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "configerer": "^1.0.11",
14
- "utiller": "^1.0.123",
14
+ "utiller": "^1.0.126",
15
15
  "linepayer": "^1.0.4",
16
16
  "databazer": "^1.0.11",
17
17
  "lodash": "^4.17.20",