@beecode/msh-cli 1.2.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/README.md +2 -2
  2. package/bin/msh.js +1 -1
  3. package/dist/app/cli-app.d.ts +5 -0
  4. package/dist/app/cli-app.d.ts.map +1 -0
  5. package/dist/app/cli-app.js +5 -9
  6. package/dist/app/http-server-app.d.ts +5 -0
  7. package/dist/app/http-server-app.d.ts.map +1 -0
  8. package/dist/app/http-server-app.js +3 -7
  9. package/dist/app/init/parse-and-route-args.d.ts +8 -0
  10. package/dist/app/init/parse-and-route-args.d.ts.map +1 -0
  11. package/dist/app/init/parse-and-route-args.js +5 -9
  12. package/dist/app/tui-app.d.ts +5 -0
  13. package/dist/app/tui-app.d.ts.map +1 -0
  14. package/dist/app/tui-app.js +3 -7
  15. package/dist/controller/cli-menu/main-menu.d.ts +6 -0
  16. package/dist/controller/cli-menu/main-menu.d.ts.map +1 -0
  17. package/dist/controller/cli-menu/main-menu.js +11 -11
  18. package/dist/controller/yargs-router/cli-router.d.ts +14 -0
  19. package/dist/controller/yargs-router/cli-router.d.ts.map +1 -0
  20. package/dist/controller/yargs-router/cli-router.js +34 -29
  21. package/dist/controller/yargs-router/git-router.d.ts +10 -0
  22. package/dist/controller/yargs-router/git-router.d.ts.map +1 -0
  23. package/dist/controller/yargs-router/git-router.js +51 -49
  24. package/dist/controller/yargs-router/npm-router.d.ts +7 -0
  25. package/dist/controller/yargs-router/npm-router.d.ts.map +1 -0
  26. package/dist/controller/yargs-router/npm-router.js +25 -26
  27. package/dist/dal/shell-dal.d.ts +12 -0
  28. package/dist/dal/shell-dal.d.ts.map +1 -0
  29. package/dist/dal/shell-dal.js +12 -18
  30. package/dist/index-cli.d.ts +2 -0
  31. package/dist/index-cli.d.ts.map +1 -0
  32. package/dist/index-cli.js +8 -11
  33. package/dist/index-init.d.ts +2 -0
  34. package/dist/index-init.d.ts.map +1 -0
  35. package/dist/index-init.js +7 -12
  36. package/dist/index-jest-setup.d.ts +6 -0
  37. package/dist/index-jest-setup.d.ts.map +1 -0
  38. package/dist/index-jest-setup.js +4 -0
  39. package/dist/index-server.d.ts +2 -0
  40. package/dist/index-server.d.ts.map +1 -0
  41. package/dist/index-server.js +6 -9
  42. package/dist/index-terminal-ui.d.ts +2 -0
  43. package/dist/index-terminal-ui.d.ts.map +1 -0
  44. package/dist/index-terminal-ui.js +6 -9
  45. package/dist/model/command/init-config.d.ts +5 -0
  46. package/dist/model/command/init-config.d.ts.map +1 -0
  47. package/dist/model/command/init-config.js +4 -8
  48. package/dist/model/command/interfaces.d.ts +12 -0
  49. package/dist/model/command/interfaces.d.ts.map +1 -0
  50. package/dist/model/command/interfaces.js +2 -3
  51. package/dist/model/command/project-command/git-clone-project-command.d.ts +15 -0
  52. package/dist/model/command/project-command/git-clone-project-command.d.ts.map +1 -0
  53. package/dist/model/command/project-command/git-clone-project-command.js +9 -12
  54. package/dist/model/command/project-command/git-simple-project-command.d.ts +16 -0
  55. package/dist/model/command/project-command/git-simple-project-command.d.ts.map +1 -0
  56. package/dist/model/command/project-command/git-simple-project-command.js +9 -13
  57. package/dist/model/command/project-command/git-tag-project-command.d.ts +12 -0
  58. package/dist/model/command/project-command/git-tag-project-command.d.ts.map +1 -0
  59. package/dist/model/command/project-command/git-tag-project-command.js +14 -12
  60. package/dist/model/command/project-command/npm-global-project-command.d.ts +21 -0
  61. package/dist/model/command/project-command/npm-global-project-command.d.ts.map +1 -0
  62. package/dist/model/command/project-command/npm-global-project-command.js +35 -37
  63. package/dist/model/command/project-command/npm-install-project-command.d.ts +9 -0
  64. package/dist/model/command/project-command/npm-install-project-command.d.ts.map +1 -0
  65. package/dist/model/command/project-command/npm-install-project-command.js +9 -16
  66. package/dist/model/command/project-command/project-command.d.ts +15 -0
  67. package/dist/model/command/project-command/project-command.d.ts.map +1 -0
  68. package/dist/model/command/project-command/project-command.js +7 -12
  69. package/dist/service/clear-service.d.ts +2 -0
  70. package/dist/service/clear-service.d.ts.map +1 -0
  71. package/dist/service/clear-service.js +4 -7
  72. package/dist/service/file-service.d.ts +7 -0
  73. package/dist/service/file-service.d.ts.map +1 -0
  74. package/dist/service/file-service.js +4 -7
  75. package/dist/service/init-config-service.d.ts +7 -0
  76. package/dist/service/init-config-service.d.ts.map +1 -0
  77. package/dist/service/init-config-service.js +13 -18
  78. package/dist/service/shell-service.d.ts +12 -0
  79. package/dist/service/shell-service.d.ts.map +1 -0
  80. package/dist/service/shell-service.js +29 -31
  81. package/dist/service/terminal-wrapper.d.ts +12 -0
  82. package/dist/service/terminal-wrapper.d.ts.map +1 -0
  83. package/dist/service/terminal-wrapper.js +6 -11
  84. package/dist/util/base-menu.d.ts +12 -0
  85. package/dist/util/base-menu.d.ts.map +1 -0
  86. package/dist/util/base-menu.js +20 -19
  87. package/dist/util/config.d.ts +21 -0
  88. package/dist/util/config.d.ts.map +1 -0
  89. package/dist/util/config.js +37 -41
  90. package/dist/util/constant.d.ts +5 -0
  91. package/dist/util/constant.d.ts.map +1 -0
  92. package/dist/util/constant.js +3 -6
  93. package/dist/util/logger.d.ts +3 -0
  94. package/dist/util/logger.d.ts.map +1 -0
  95. package/dist/util/logger.js +14 -13
  96. package/dist/util/object-util.d.ts +4 -0
  97. package/dist/util/object-util.d.ts.map +1 -0
  98. package/dist/util/object-util.js +3 -5
  99. package/dist/util/sub-menu.d.ts +8 -0
  100. package/dist/util/sub-menu.d.ts.map +1 -0
  101. package/dist/util/sub-menu.js +10 -11
  102. package/dist/util/update-notifier-util.d.ts +4 -0
  103. package/dist/util/update-notifier-util.d.ts.map +1 -0
  104. package/dist/util/update-notifier-util.js +5 -11
  105. package/lib/app/cli-app.d.ts +5 -0
  106. package/lib/app/cli-app.d.ts.map +1 -0
  107. package/lib/app/cli-app.js +29 -0
  108. package/lib/app/http-server-app.d.ts +5 -0
  109. package/lib/app/http-server-app.d.ts.map +1 -0
  110. package/lib/app/http-server-app.js +31 -0
  111. package/lib/app/init/parse-and-route-args.d.ts +8 -0
  112. package/lib/app/init/parse-and-route-args.d.ts.map +1 -0
  113. package/lib/app/init/parse-and-route-args.js +74 -0
  114. package/lib/app/tui-app.d.ts +5 -0
  115. package/lib/app/tui-app.d.ts.map +1 -0
  116. package/lib/app/tui-app.js +31 -0
  117. package/lib/controller/cli-menu/main-menu.d.ts +6 -0
  118. package/lib/controller/cli-menu/main-menu.d.ts.map +1 -0
  119. package/lib/controller/cli-menu/main-menu.js +74 -0
  120. package/lib/controller/yargs-router/cli-router.d.ts +14 -0
  121. package/lib/controller/yargs-router/cli-router.d.ts.map +1 -0
  122. package/lib/controller/yargs-router/cli-router.js +171 -0
  123. package/lib/controller/yargs-router/git-router.d.ts +10 -0
  124. package/lib/controller/yargs-router/git-router.d.ts.map +1 -0
  125. package/lib/controller/yargs-router/git-router.js +207 -0
  126. package/lib/controller/yargs-router/npm-router.d.ts +7 -0
  127. package/lib/controller/yargs-router/npm-router.d.ts.map +1 -0
  128. package/lib/controller/yargs-router/npm-router.js +94 -0
  129. package/lib/dal/shell-dal.d.ts +12 -0
  130. package/lib/dal/shell-dal.d.ts.map +1 -0
  131. package/lib/dal/shell-dal.js +61 -0
  132. package/lib/index-cli.d.ts +2 -0
  133. package/lib/index-cli.d.ts.map +1 -0
  134. package/lib/index-cli.js +14 -0
  135. package/lib/index-init.d.ts +2 -0
  136. package/lib/index-init.d.ts.map +1 -0
  137. package/lib/index-init.js +16 -0
  138. package/lib/index-jest-setup.d.ts +6 -0
  139. package/lib/index-jest-setup.d.ts.map +1 -0
  140. package/lib/index-jest-setup.js +10 -0
  141. package/lib/index-server.d.ts +2 -0
  142. package/lib/index-server.d.ts.map +1 -0
  143. package/lib/index-server.js +9 -0
  144. package/lib/index-terminal-ui.d.ts +2 -0
  145. package/lib/index-terminal-ui.d.ts.map +1 -0
  146. package/lib/index-terminal-ui.js +9 -0
  147. package/lib/model/command/init-config.d.ts +5 -0
  148. package/lib/model/command/init-config.d.ts.map +1 -0
  149. package/lib/model/command/init-config.js +53 -0
  150. package/lib/model/command/interfaces.d.ts +12 -0
  151. package/lib/model/command/interfaces.d.ts.map +1 -0
  152. package/lib/model/command/interfaces.js +1 -0
  153. package/lib/model/command/project-command/git-clone-project-command.d.ts +15 -0
  154. package/lib/model/command/project-command/git-clone-project-command.d.ts.map +1 -0
  155. package/lib/model/command/project-command/git-clone-project-command.js +77 -0
  156. package/lib/model/command/project-command/git-simple-project-command.d.ts +16 -0
  157. package/lib/model/command/project-command/git-simple-project-command.d.ts.map +1 -0
  158. package/lib/model/command/project-command/git-simple-project-command.js +70 -0
  159. package/lib/model/command/project-command/git-tag-project-command.d.ts +12 -0
  160. package/lib/model/command/project-command/git-tag-project-command.d.ts.map +1 -0
  161. package/lib/model/command/project-command/git-tag-project-command.js +73 -0
  162. package/lib/model/command/project-command/npm-global-project-command.d.ts +21 -0
  163. package/lib/model/command/project-command/npm-global-project-command.d.ts.map +1 -0
  164. package/lib/model/command/project-command/npm-global-project-command.js +217 -0
  165. package/lib/model/command/project-command/npm-install-project-command.d.ts +9 -0
  166. package/lib/model/command/project-command/npm-install-project-command.d.ts.map +1 -0
  167. package/lib/model/command/project-command/npm-install-project-command.js +66 -0
  168. package/lib/model/command/project-command/project-command.d.ts +15 -0
  169. package/lib/model/command/project-command/project-command.d.ts.map +1 -0
  170. package/lib/model/command/project-command/project-command.js +69 -0
  171. package/lib/package.json +1 -0
  172. package/lib/service/clear-service.d.ts +2 -0
  173. package/lib/service/clear-service.d.ts.map +1 -0
  174. package/lib/service/clear-service.js +24 -0
  175. package/lib/service/file-service.d.ts +7 -0
  176. package/lib/service/file-service.d.ts.map +1 -0
  177. package/lib/service/file-service.js +14 -0
  178. package/lib/service/init-config-service.d.ts +7 -0
  179. package/lib/service/init-config-service.d.ts.map +1 -0
  180. package/lib/service/init-config-service.js +55 -0
  181. package/lib/service/shell-service.d.ts +12 -0
  182. package/lib/service/shell-service.d.ts.map +1 -0
  183. package/lib/service/shell-service.js +64 -0
  184. package/lib/service/terminal-wrapper.d.ts +12 -0
  185. package/lib/service/terminal-wrapper.d.ts.map +1 -0
  186. package/lib/service/terminal-wrapper.js +72 -0
  187. package/lib/util/base-menu.d.ts +12 -0
  188. package/lib/util/base-menu.d.ts.map +1 -0
  189. package/lib/util/base-menu.js +134 -0
  190. package/lib/util/config.d.ts +21 -0
  191. package/lib/util/config.d.ts.map +1 -0
  192. package/lib/util/config.js +50 -0
  193. package/lib/util/constant.d.ts +5 -0
  194. package/lib/util/constant.d.ts.map +1 -0
  195. package/lib/util/constant.js +15 -0
  196. package/lib/util/logger.d.ts +3 -0
  197. package/lib/util/logger.d.ts.map +1 -0
  198. package/lib/util/logger.js +20 -0
  199. package/lib/util/object-util.d.ts +4 -0
  200. package/lib/util/object-util.d.ts.map +1 -0
  201. package/lib/util/object-util.js +15 -0
  202. package/lib/util/sub-menu.d.ts +8 -0
  203. package/lib/util/sub-menu.d.ts.map +1 -0
  204. package/lib/util/sub-menu.js +85 -0
  205. package/lib/util/update-notifier-util.d.ts +4 -0
  206. package/lib/util/update-notifier-util.d.ts.map +1 -0
  207. package/lib/util/update-notifier-util.js +35 -0
  208. package/package.json +216 -156
  209. package/CHANGELOG.md +0 -91
  210. package/package-lock.json +0 -26727
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.npmGlobalProjectCommandFactory = exports.NpmGlobalProjectCommand = void 0;
7
+ var _compareVersions = require("compare-versions");
8
+ var _fastJsonStableStringify = _interopRequireDefault(require("fast-json-stable-stringify"));
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _fileService = require("../../../service/file-service.js");
11
+ var _config = require("../../../util/config.js");
12
+ var _logger = require("../../../util/logger.js");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
+ function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
16
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
17
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
18
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
+ 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); }
21
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
22
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
23
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
28
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
29
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
30
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
32
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
33
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
34
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
35
+ var NpmGlobalProjectCommand = exports.NpmGlobalProjectCommand = /*#__PURE__*/function () {
36
+ function NpmGlobalProjectCommand() {
37
+ _classCallCheck(this, NpmGlobalProjectCommand);
38
+ }
39
+ return _createClass(NpmGlobalProjectCommand, [{
40
+ key: "execute",
41
+ value: function () {
42
+ var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
43
+ var depsByProject, uniquePackages, versionConflictWarningMessage, highestDependencies, highestDependenciesString;
44
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
45
+ while (1) switch (_context.prev = _context.next) {
46
+ case 0:
47
+ _context.prev = 0;
48
+ depsByProject = this._allDepsByProject();
49
+ (0, _logger.logger)().debug('all dependencies all projects', depsByProject);
50
+ uniquePackages = this._uniquePackages(depsByProject);
51
+ (0, _logger.logger)().debug('add dependencies by package', uniquePackages);
52
+ versionConflictWarningMessage = this._versionConflictWarningMessage(uniquePackages);
53
+ (0, _logger.logger)().debug('version conflict warning message', versionConflictWarningMessage);
54
+ highestDependencies = this._highestDependencies(uniquePackages);
55
+ highestDependenciesString = JSON.stringify(highestDependencies, Object.keys(highestDependencies).sort(), 2);
56
+ (0, _logger.logger)().debug('highest dependencies', highestDependenciesString);
57
+ this._overrideGlobalDepsWithNewHighestDependencies(highestDependencies);
58
+ return _context.abrupt("return", [{
59
+ errorMessage: versionConflictWarningMessage.join('\n\n'),
60
+ name: 'Global NPM Dependencies',
61
+ stringResult: "Gathered dependencies \n\n".concat(highestDependenciesString)
62
+ }]);
63
+ case 14:
64
+ _context.prev = 14;
65
+ _context.t0 = _context["catch"](0);
66
+ return _context.abrupt("return", [{
67
+ errorMessage: _context.t0.message
68
+ }]);
69
+ case 17:
70
+ case "end":
71
+ return _context.stop();
72
+ }
73
+ }, _callee, this, [[0, 14]]);
74
+ }));
75
+ function execute() {
76
+ return _execute.apply(this, arguments);
77
+ }
78
+ return execute;
79
+ }()
80
+ }, {
81
+ key: "_allDepsByProject",
82
+ value: function _allDepsByProject() {
83
+ var _this = this;
84
+ return (0, _config.config)().projects.map(function (project) {
85
+ var packageJs = _this._packageJsonForProject(project);
86
+ var projectDeps = _objectSpread(_objectSpread({}, packageJs.dependencies), packageJs.devDependencies);
87
+ var cleanProjectDeps = _this._removeIgnoredPackages(projectDeps);
88
+ return _defineProperty({}, project, cleanProjectDeps);
89
+ }).reduce(function (acc, cur) {
90
+ return Object.assign(acc, cur);
91
+ }, {});
92
+ }
93
+ }, {
94
+ key: "_removeIgnoredPackages",
95
+ value: function _removeIgnoredPackages(dependencies) {
96
+ var globalIgnorePackages = (0, _config.config)().npm.globalIgnorePackages;
97
+ if (globalIgnorePackages.length === 0) {
98
+ return dependencies;
99
+ }
100
+ return Object.entries(dependencies).filter(function (_ref2) {
101
+ var _ref3 = _slicedToArray(_ref2, 1),
102
+ packageName = _ref3[0];
103
+ return !globalIgnorePackages.includes(packageName);
104
+ }).reduce(function (acc, _ref4) {
105
+ var _ref5 = _slicedToArray(_ref4, 2),
106
+ packageName = _ref5[0],
107
+ version = _ref5[1];
108
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, packageName, version));
109
+ }, {});
110
+ }
111
+ }, {
112
+ key: "_uniquePackages",
113
+ value: function _uniquePackages(depsByProject) {
114
+ var result = {};
115
+ Object.entries(depsByProject).forEach(function (_ref6) {
116
+ var _ref7 = _slicedToArray(_ref6, 2),
117
+ project = _ref7[0],
118
+ deps = _ref7[1];
119
+ Object.entries(deps).forEach(function (_ref8) {
120
+ var _result$packageName, _pk$versionProject$ve;
121
+ var _ref9 = _slicedToArray(_ref8, 2),
122
+ packageName = _ref9[0],
123
+ version = _ref9[1];
124
+ var pk = result[packageName] = (_result$packageName = result[packageName]) !== null && _result$packageName !== void 0 ? _result$packageName : {
125
+ versionProject: {},
126
+ versions: []
127
+ };
128
+ if (!pk.versions.includes(version)) {
129
+ pk.versions.push(version);
130
+ }
131
+ var pv = pk.versionProject[version] = (_pk$versionProject$ve = pk.versionProject[version]) !== null && _pk$versionProject$ve !== void 0 ? _pk$versionProject$ve : [];
132
+ pv.push(project);
133
+ });
134
+ });
135
+ return result;
136
+ }
137
+ }, {
138
+ key: "_versionConflictWarningMessage",
139
+ value: function _versionConflictWarningMessage(uniquePackages) {
140
+ return Object.entries(uniquePackages).filter(function (_ref10) {
141
+ var _ref11 = _slicedToArray(_ref10, 2),
142
+ _ = _ref11[0],
143
+ versions = _ref11[1].versions;
144
+ return versions.length > 1;
145
+ }).sort(function (a, b) {
146
+ var _a = _slicedToArray(a, 1),
147
+ pnA = _a[0];
148
+ var _b = _slicedToArray(b, 1),
149
+ pnB = _b[0];
150
+ if (pnA < pnB) {
151
+ return -1;
152
+ }
153
+ if (pnA > pnB) {
154
+ return 1;
155
+ }
156
+ return 0;
157
+ }).map(function (_ref12) {
158
+ var _ref13 = _slicedToArray(_ref12, 2),
159
+ packageName = _ref13[0],
160
+ uniquePackInfo = _ref13[1];
161
+ return "".concat(packageName, ": ").concat((0, _fastJsonStableStringify["default"])(uniquePackInfo.versions), "\n").concat(Object.entries(uniquePackInfo.versionProject).map(function (_ref14) {
162
+ var _ref15 = _slicedToArray(_ref14, 2),
163
+ v = _ref15[0],
164
+ prjs = _ref15[1];
165
+ return "".concat(v, ":").concat((0, _fastJsonStableStringify["default"])(prjs));
166
+ }).join('\n'));
167
+ });
168
+ }
169
+ }, {
170
+ key: "_highestDependencies",
171
+ value: function _highestDependencies(uniquePackages) {
172
+ var _this2 = this;
173
+ return Object.entries(uniquePackages).map(function (_ref16) {
174
+ var _ref17 = _slicedToArray(_ref16, 2),
175
+ packageName = _ref17[0],
176
+ versions = _ref17[1].versions;
177
+ return _defineProperty({}, packageName, _this2._highestVersion(versions));
178
+ }).reduce(function (acc, cur) {
179
+ return Object.assign(acc, cur);
180
+ }, {});
181
+ }
182
+ }, {
183
+ key: "_highestVersion",
184
+ value: function _highestVersion(versions) {
185
+ var sortedVersions = versions.sort(_compareVersions.compareVersions);
186
+ var result = sortedVersions.pop();
187
+ if (!result) {
188
+ throw new Error("Missing version in array [".concat((0, _fastJsonStableStringify["default"])(versions), "]"));
189
+ }
190
+ return result;
191
+ }
192
+ }, {
193
+ key: "_overrideGlobalDepsWithNewHighestDependencies",
194
+ value: function _overrideGlobalDepsWithNewHighestDependencies(highestDependencies) {
195
+ var globalPackageJs = this._packageJsonForProject();
196
+ globalPackageJs.dependencies = highestDependencies;
197
+ var fileData = JSON.stringify(JSON.parse((0, _fastJsonStableStringify["default"])(globalPackageJs)), null, 2);
198
+ _fileService.fileService.writeToFileSync({
199
+ data: fileData,
200
+ filePath: 'package.json'
201
+ });
202
+ }
203
+
204
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
205
+ }, {
206
+ key: "_packageJsonForProject",
207
+ value: function _packageJsonForProject(project) {
208
+ return require(_path["default"].join(process.cwd(), [project, 'package.json'].filter(Boolean).join('/'))); // eslint-disable-line @typescript-eslint/no-var-requires
209
+ }
210
+ }]);
211
+ }();
212
+ var npmGlobalProjectCommandFactory = exports.npmGlobalProjectCommandFactory = function npmGlobalProjectCommandFactory() {
213
+ for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
214
+ params[_key] = arguments[_key];
215
+ }
216
+ return _construct(NpmGlobalProjectCommand, params);
217
+ };
@@ -0,0 +1,9 @@
1
+ import { ExecuteResult, ProjectExecutable } from '../../../model/command/interfaces.js';
2
+ export declare class NpmInstallProjectCommand implements ProjectExecutable {
3
+ protected readonly _rootDir: string;
4
+ constructor(params?: {
5
+ rootDir?: string;
6
+ });
7
+ execute(project: string): Promise<ExecuteResult[]>;
8
+ }
9
+ //# sourceMappingURL=npm-install-project-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-install-project-command.d.ts","sourceRoot":"","sources":["../../../../src/model/command/project-command/npm-install-project-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAIhF,qBAAa,wBAAyB,YAAW,iBAAiB;IACjE,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;gBAEvB,MAAM,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAKnC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAYxD"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NpmInstallProjectCommand = void 0;
7
+ var _path = _interopRequireDefault(require("path"));
8
+ var _shellService = require("../../../service/shell-service.js");
9
+ var _config = require("../../../util/config.js");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
12
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
13
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
17
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ var NpmInstallProjectCommand = exports.NpmInstallProjectCommand = /*#__PURE__*/function () {
21
+ function NpmInstallProjectCommand(params) {
22
+ _classCallCheck(this, NpmInstallProjectCommand);
23
+ var _ref = params !== null && params !== void 0 ? params : {},
24
+ _ref$rootDir = _ref.rootDir,
25
+ rootDir = _ref$rootDir === void 0 ? (0, _config.config)().rootDir : _ref$rootDir;
26
+ this._rootDir = rootDir;
27
+ }
28
+ return _createClass(NpmInstallProjectCommand, [{
29
+ key: "execute",
30
+ value: function () {
31
+ var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(project) {
32
+ var cmd, result;
33
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
34
+ while (1) switch (_context.prev = _context.next) {
35
+ case 0:
36
+ _context.prev = 0;
37
+ _shellService.shellService.cd(_path["default"].join(this._rootDir, project));
38
+ cmd = 'npm i -s';
39
+ _context.next = 5;
40
+ return _shellService.shellService.exec(cmd);
41
+ case 5:
42
+ result = _context.sent;
43
+ return _context.abrupt("return", [{
44
+ errorMessage: result.stdout,
45
+ name: project,
46
+ stringResult: 'npm install successful'
47
+ }]);
48
+ case 9:
49
+ _context.prev = 9;
50
+ _context.t0 = _context["catch"](0);
51
+ return _context.abrupt("return", [{
52
+ errorMessage: _context.t0.message
53
+ }]);
54
+ case 12:
55
+ case "end":
56
+ return _context.stop();
57
+ }
58
+ }, _callee, this, [[0, 9]]);
59
+ }));
60
+ function execute(_x) {
61
+ return _execute.apply(this, arguments);
62
+ }
63
+ return execute;
64
+ }()
65
+ }]);
66
+ }();
@@ -0,0 +1,15 @@
1
+ import { ExecuteResult, ProjectExecutable } from '../../../model/command/interfaces.js';
2
+ export declare class ProjectCommand {
3
+ protected readonly _projects: string[];
4
+ protected readonly _command: ProjectExecutable;
5
+ constructor(params: {
6
+ command: ProjectExecutable;
7
+ projects?: string[];
8
+ });
9
+ execute(): Promise<ExecuteResult[]>;
10
+ }
11
+ export declare const projectCommandFactory: (params: {
12
+ command: ProjectExecutable;
13
+ projects?: string[] | undefined;
14
+ }) => ProjectCommand;
15
+ //# sourceMappingURL=project-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-command.d.ts","sourceRoot":"","sources":["../../../../src/model/command/project-command/project-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAGhF,qBAAa,cAAc;IAC1B,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAA;IACtC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;gBAElC,MAAM,EAAE;QAAE,OAAO,EAAE,iBAAiB,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE;IAMjE,OAAO,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAQzC;AAED,eAAO,MAAM,qBAAqB;aAhBF,iBAAiB;;MAgB+C,cAClE,CAAA"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.projectCommandFactory = exports.ProjectCommand = void 0;
7
+ var _config = require("../../../util/config.js");
8
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
9
+ function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
10
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
13
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
17
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ var ProjectCommand = exports.ProjectCommand = /*#__PURE__*/function () {
21
+ function ProjectCommand(params) {
22
+ _classCallCheck(this, ProjectCommand);
23
+ var command = params.command,
24
+ _params$projects = params.projects,
25
+ projects = _params$projects === void 0 ? (0, _config.config)().projects : _params$projects;
26
+ this._projects = projects;
27
+ this._command = command;
28
+ }
29
+ return _createClass(ProjectCommand, [{
30
+ key: "execute",
31
+ value: function () {
32
+ var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
33
+ var _this = this;
34
+ var promises;
35
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
36
+ while (1) switch (_context.prev = _context.next) {
37
+ case 0:
38
+ if (!(this._projects.length === 0)) {
39
+ _context.next = 2;
40
+ break;
41
+ }
42
+ throw new Error('No Project selected, check .msh config file for [PROJECTS=]');
43
+ case 2:
44
+ promises = this._projects.map(function (project) {
45
+ return _this._command.execute(project);
46
+ });
47
+ _context.next = 5;
48
+ return Promise.all(promises);
49
+ case 5:
50
+ return _context.abrupt("return", _context.sent.flat());
51
+ case 6:
52
+ case "end":
53
+ return _context.stop();
54
+ }
55
+ }, _callee, this);
56
+ }));
57
+ function execute() {
58
+ return _execute.apply(this, arguments);
59
+ }
60
+ return execute;
61
+ }()
62
+ }]);
63
+ }();
64
+ var projectCommandFactory = exports.projectCommandFactory = function projectCommandFactory() {
65
+ for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
66
+ params[_key] = arguments[_key];
67
+ }
68
+ return _construct(ProjectCommand, params);
69
+ };
@@ -0,0 +1 @@
1
+ {"type": "commonjs"}
@@ -0,0 +1,2 @@
1
+ export declare const clearService: {};
2
+ //# sourceMappingURL=clear-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-service.d.ts","sourceRoot":"","sources":["../../src/service/clear-service.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,IAcxB,CAAA"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clearService = void 0;
7
+ // import { config } from '../util/config.js'
8
+ // import * as util from '../util'
9
+
10
+ var clearService = exports.clearService = {
11
+ // npm: async (): Promise<void> => {
12
+ // const promises: any[] = []
13
+ // for (const project of config().projects) {
14
+ // const cmd = `rm -rf ${config().rootDir}/${project}/node_modules/*`
15
+ // const promise = util.execAsync(cmd).then((execResult) => {
16
+ // // util.log(chalk.green(`DONE - ${project}`))
17
+ // return { [project]: execResult }
18
+ // })
19
+ // promises.push(promise)
20
+ // }
21
+ // const result = await Promise.all(promises)
22
+ // cliService.printStdMessage(assignIn({}, ...result))
23
+ // },
24
+ };
@@ -0,0 +1,7 @@
1
+ export declare const fileService: {
2
+ writeToFileSync: (params: {
3
+ filePath: string;
4
+ data: string;
5
+ }) => void;
6
+ };
7
+ //# sourceMappingURL=file-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-service.d.ts","sourceRoot":"","sources":["../../src/service/file-service.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;8BACG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAG,IAAI;CAInE,CAAA"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fileService = void 0;
7
+ var _mz = require("mz");
8
+ var fileService = exports.fileService = {
9
+ writeToFileSync: function writeToFileSync(params) {
10
+ var filePath = params.filePath,
11
+ data = params.data;
12
+ _mz.fs.writeFileSync(filePath, data, 'utf8');
13
+ }
14
+ };
@@ -0,0 +1,7 @@
1
+ export declare const initConfigService: {
2
+ configDefaultValue: () => string;
3
+ configFileExists: () => boolean;
4
+ configFileLocation: () => string;
5
+ tryToCreateConfig: () => Promise<void>;
6
+ };
7
+ //# sourceMappingURL=init-config-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-config-service.d.ts","sourceRoot":"","sources":["../../src/service/init-config-service.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;8BACL,MAAM;4BA4BR,OAAO;8BAEL,MAAM;6BAED,QAAQ,IAAI,CAAC;CAM1C,CAAA"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.initConfigService = void 0;
8
+ var _mz = require("mz");
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _config = require("../util/config.js");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
13
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
15
+ var initConfigService = exports.initConfigService = {
16
+ configDefaultValue: function configDefaultValue() {
17
+ return ['# ROOT_DIR - [optional] default is the folder where msh is executed', '#ROOT_DIR=', '', '# PROJECT - [required] ex: ["auth","auth-web","node-common",...]', 'PROJECTS=[]', '', '# GIT_TEAM - [required] git team name', '#GIT_TEAM=', '', '# GIT_PROJECT_PREFIX - [optional] ex: msh // if project is msh-node-env you can use node-env in PROJECT', '#GIT_PROJECT_PREFIX=',
18
+ // 'PULL_REQUEST_SKIP=[] # ["type-definitions","node-common",...]',
19
+ // 'DOCKER_BASE_IMAGES=[] # ["bc-node-nginx","bc-node","bc-nginx","bc-base"]',
20
+ '', '#CMD_GIT_ENABLED=true', '#CMD_NPM_ENABLED=true',
21
+ // 'CMD_CLEAN_ENABLED=true',
22
+ // 'CMD_PR_ENABLED=true',
23
+ '', '#LOG_LEVEL=error', '', '## move to .msh-user', '#GIT_USERNAME=', '#GIT_PASSWORD='].join('\n');
24
+ },
25
+ configFileExists: function configFileExists() {
26
+ return _mz.fs.existsSync(initConfigService.configFileLocation());
27
+ },
28
+ configFileLocation: function configFileLocation() {
29
+ return _path["default"].join((0, _config.config)().rootDir, '.msh');
30
+ },
31
+ tryToCreateConfig: function () {
32
+ var _tryToCreateConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
33
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
34
+ while (1) switch (_context.prev = _context.next) {
35
+ case 0:
36
+ if (!initConfigService.configFileExists()) {
37
+ _context.next = 2;
38
+ break;
39
+ }
40
+ throw new Error('Config already exists');
41
+ case 2:
42
+ _context.next = 4;
43
+ return _mz.fs.writeFile(initConfigService.configFileLocation(), initConfigService.configDefaultValue());
44
+ case 4:
45
+ case "end":
46
+ return _context.stop();
47
+ }
48
+ }, _callee);
49
+ }));
50
+ function tryToCreateConfig() {
51
+ return _tryToCreateConfig.apply(this, arguments);
52
+ }
53
+ return tryToCreateConfig;
54
+ }()
55
+ };
@@ -0,0 +1,12 @@
1
+ import { ExecResult } from '../dal/shell-dal.js';
2
+ export type PrintStdMessage = Record<string, ExecResult>;
3
+ export declare const shellService: {
4
+ _joinResults: (results: PrintStdMessage[]) => PrintStdMessage;
5
+ cd: (dir: string) => void;
6
+ exec: (cmd: string) => Promise<ExecResult>;
7
+ print: (message: string) => void;
8
+ printError: (message: string) => void;
9
+ printStdMessage: (...messageArgs: PrintStdMessage[]) => void;
10
+ printSuccess: (message: string) => void;
11
+ };
12
+ //# sourceMappingURL=shell-service.d.ts.map