@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 @@
1
+ {"version":3,"file":"shell-service.d.ts","sourceRoot":"","sources":["../../src/service/shell-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAY,MAAM,oBAAoB,CAAA;AAEzD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAGxD,eAAO,MAAM,YAAY;4BAEA,eAAe,EAAE,KAAG,eAAe;;;;0BAUrC,MAAM,KAAG,IAAI;sCAGD,eAAe,EAAE,KAAG,IAAI;4BAqBlC,MAAM,KAAG,IAAI;CAGrC,CAAA"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.shellService = void 0;
7
+ var _chalk = _interopRequireDefault(require("chalk"));
8
+ var _shellDal = require("../dal/shell-dal.js");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ 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."); }
12
+ 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); }
13
+ 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; }
14
+ 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; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+ // TODO refactor object and use class instead
17
+ var shellService = exports.shellService = {
18
+ // eslint-disable-next-line @typescript-eslint/naming-convention
19
+ _joinResults: function _joinResults(results) {
20
+ return results.reduce(function (agg, cur) {
21
+ agg = Object.assign(agg, cur);
22
+ return agg;
23
+ }, {});
24
+ },
25
+ cd: _shellDal.shellDal.cd,
26
+ exec: _shellDal.shellDal.exec,
27
+ print: _shellDal.shellDal.print,
28
+ printError: function printError(message) {
29
+ _shellDal.shellDal.print(_chalk["default"].red(message));
30
+ },
31
+ printStdMessage: function printStdMessage() {
32
+ for (var _len = arguments.length, messageArgs = new Array(_len), _key = 0; _key < _len; _key++) {
33
+ messageArgs[_key] = arguments[_key];
34
+ }
35
+ var messages = shellService._joinResults(messageArgs);
36
+ Object.entries(messages).forEach(function (_ref) {
37
+ var _ref2 = _slicedToArray(_ref, 2),
38
+ name = _ref2[0],
39
+ _ref2$ = _ref2[1],
40
+ stdout = _ref2$.stdout,
41
+ stderr = _ref2$.stderr;
42
+ var borderChar = '#';
43
+ var borderStars = Array(name.length + 6).fill('').map(function () {
44
+ return borderChar;
45
+ }).join('');
46
+ shellService.print(borderStars);
47
+ shellService.print("".concat(borderChar, " ").concat(name, " ").concat(borderChar));
48
+ shellService.print(borderStars);
49
+ if (stdout.trim() !== '') {
50
+ stdout.split('\n').forEach(function (msg) {
51
+ return shellService.print(msg);
52
+ });
53
+ }
54
+ if (stderr.trim() !== '') {
55
+ stderr.split('\n').forEach(function (msg) {
56
+ return shellService.printError(msg);
57
+ });
58
+ }
59
+ });
60
+ },
61
+ printSuccess: function printSuccess(message) {
62
+ _shellDal.shellDal.print(_chalk["default"].green(message));
63
+ }
64
+ };
@@ -0,0 +1,12 @@
1
+ import { Executable } from '../model/command/interfaces.js';
2
+ export declare class TerminalWrapper {
3
+ protected readonly _command: Executable;
4
+ constructor(params: {
5
+ command: Executable;
6
+ });
7
+ execute(): Promise<void>;
8
+ }
9
+ export declare const terminalWrapperFactory: (params: {
10
+ command: Executable;
11
+ }) => TerminalWrapper;
12
+ //# sourceMappingURL=terminal-wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-wrapper.d.ts","sourceRoot":"","sources":["../../src/service/terminal-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAG1D,qBAAa,eAAe;IAC3B,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;gBAC3B,MAAM,EAAE;QAAE,OAAO,EAAE,UAAU,CAAA;KAAE;IAKrC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO9B;AAED,eAAO,MAAM,sBAAsB;aAdH,UAAU;MAcwD,eACnE,CAAA"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.terminalWrapperFactory = exports.TerminalWrapper = void 0;
7
+ var _shellService = require("../service/shell-service.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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
+ 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); }
16
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
17
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
18
+ 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; }
19
+ 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; }
20
+ 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); } }
21
+ 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); }); }; }
22
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
+ 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); } }
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
26
+ 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); }
27
+ var TerminalWrapper = exports.TerminalWrapper = /*#__PURE__*/function () {
28
+ function TerminalWrapper(params) {
29
+ _classCallCheck(this, TerminalWrapper);
30
+ var command = params.command;
31
+ this._command = command;
32
+ }
33
+ return _createClass(TerminalWrapper, [{
34
+ key: "execute",
35
+ value: function () {
36
+ var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
37
+ var results, printableStdMessages;
38
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ _context.next = 2;
42
+ return this._command.execute();
43
+ case 2:
44
+ results = _context.sent;
45
+ printableStdMessages = results.map(function (r) {
46
+ var _r$name, _r$errorMessage, _r$stringResult;
47
+ return _defineProperty({}, (_r$name = r.name) !== null && _r$name !== void 0 ? _r$name : '<cmd>', {
48
+ errorOccurred: !!r.errorMessage,
49
+ stderr: (_r$errorMessage = r.errorMessage) !== null && _r$errorMessage !== void 0 ? _r$errorMessage : '',
50
+ stdout: (_r$stringResult = r.stringResult) !== null && _r$stringResult !== void 0 ? _r$stringResult : ''
51
+ });
52
+ });
53
+ _shellService.shellService.printStdMessage.apply(_shellService.shellService, _toConsumableArray(printableStdMessages));
54
+ case 5:
55
+ case "end":
56
+ return _context.stop();
57
+ }
58
+ }, _callee, this);
59
+ }));
60
+ function execute() {
61
+ return _execute.apply(this, arguments);
62
+ }
63
+ return execute;
64
+ }()
65
+ }]);
66
+ }();
67
+ var terminalWrapperFactory = exports.terminalWrapperFactory = function terminalWrapperFactory() {
68
+ for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
69
+ params[_key] = arguments[_key];
70
+ }
71
+ return _construct(TerminalWrapper, params);
72
+ };
@@ -0,0 +1,12 @@
1
+ import { ChoiceCollection } from 'inquirer';
2
+ export declare abstract class BaseMenu {
3
+ private __name;
4
+ private __type;
5
+ private __message;
6
+ private __menu;
7
+ private __execute;
8
+ protected constructor(message: string, choices: ChoiceCollection, exitChoices?: ChoiceCollection);
9
+ run(preSelected?: string): Promise<void>;
10
+ protected _getSelectedValue(perSelected?: string): Promise<string>;
11
+ }
12
+ //# sourceMappingURL=base-menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-menu.d.ts","sourceRoot":"","sources":["../../src/util/base-menu.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,gBAAgB,EAAsB,MAAM,UAAU,CAAA;AAEzE,8BAAsB,QAAQ;IAC7B,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,MAAM,CAAoB;YAEpB,SAAS;IAOvB,SAAS,aAAa,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,gBAAgB;IAkB1F,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;cAW9B,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAOxE"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BaseMenu = void 0;
7
+ var _inquirer = _interopRequireDefault(require("inquirer"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
+ 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); }
10
+ 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; }
11
+ 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); } }
12
+ 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); }); }; }
13
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
+ 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); }
16
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
17
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
18
+ 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; }
19
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
+ 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); } }
21
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
22
+ 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; }
23
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
24
+ 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); }
25
+ var BaseMenu = exports.BaseMenu = /*#__PURE__*/function () {
26
+ function BaseMenu(message, choices, exitChoices) {
27
+ _classCallCheck(this, BaseMenu);
28
+ _defineProperty(this, "__name", '__menu');
29
+ _defineProperty(this, "__type", 'list');
30
+ _defineProperty(this, "__message", '');
31
+ if (message) {
32
+ this.__message = message;
33
+ }
34
+ choices.push(new _inquirer["default"].Separator());
35
+ (exitChoices !== null && exitChoices !== void 0 ? exitChoices : []).forEach(function (choice) {
36
+ choices.push(choice);
37
+ });
38
+ choices.push({
39
+ name: 'Exit',
40
+ value: 'exit'
41
+ });
42
+ this.__menu = {
43
+ choices: _toConsumableArray(choices),
44
+ message: this.__message,
45
+ name: this.__name,
46
+ type: this.__type
47
+ };
48
+ }
49
+ return _createClass(BaseMenu, [{
50
+ key: "__execute",
51
+ value: function () {
52
+ var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(command) {
53
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
54
+ while (1) switch (_context.prev = _context.next) {
55
+ case 0:
56
+ _context.next = 2;
57
+ return this[command]();
58
+ case 2:
59
+ _context.next = 4;
60
+ return this.run();
61
+ case 4:
62
+ case "end":
63
+ return _context.stop();
64
+ }
65
+ }, _callee, this);
66
+ }));
67
+ function __execute(_x) {
68
+ return _execute.apply(this, arguments);
69
+ }
70
+ return __execute;
71
+ }()
72
+ }, {
73
+ key: "run",
74
+ value: function () {
75
+ var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(preSelected) {
76
+ var selected;
77
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
78
+ while (1) switch (_context2.prev = _context2.next) {
79
+ case 0:
80
+ _context2.next = 2;
81
+ return this._getSelectedValue(preSelected);
82
+ case 2:
83
+ selected = _context2.sent;
84
+ _context2.t0 = selected;
85
+ _context2.next = _context2.t0 === 'exit' ? 6 : 8;
86
+ break;
87
+ case 6:
88
+ process.exit();
89
+ return _context2.abrupt("break", 10);
90
+ case 8:
91
+ _context2.next = 10;
92
+ return this.__execute(selected);
93
+ case 10:
94
+ case "end":
95
+ return _context2.stop();
96
+ }
97
+ }, _callee2, this);
98
+ }));
99
+ function run(_x2) {
100
+ return _run.apply(this, arguments);
101
+ }
102
+ return run;
103
+ }()
104
+ }, {
105
+ key: "_getSelectedValue",
106
+ value: function () {
107
+ var _getSelectedValue2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(perSelected) {
108
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
109
+ while (1) switch (_context3.prev = _context3.next) {
110
+ case 0:
111
+ if (!perSelected) {
112
+ _context3.next = 2;
113
+ break;
114
+ }
115
+ return _context3.abrupt("return", perSelected);
116
+ case 2:
117
+ _context3.next = 4;
118
+ return _inquirer["default"].prompt(this.__menu);
119
+ case 4:
120
+ _context3.t0 = this.__name;
121
+ return _context3.abrupt("return", _context3.sent[_context3.t0]);
122
+ case 6:
123
+ case "end":
124
+ return _context3.stop();
125
+ }
126
+ }, _callee3, this);
127
+ }));
128
+ function _getSelectedValue(_x3) {
129
+ return _getSelectedValue2.apply(this, arguments);
130
+ }
131
+ return _getSelectedValue;
132
+ }()
133
+ }]);
134
+ }();
@@ -0,0 +1,21 @@
1
+ export declare const config: import("@beecode/msh-util/singleton/pattern").AnyFunctionNoParams<{
2
+ readonly cmd: {
3
+ readonly gitEnabled: boolean;
4
+ readonly npmEnabled: boolean;
5
+ };
6
+ readonly git: {
7
+ readonly host: string;
8
+ readonly password: string | undefined;
9
+ readonly projectPrefix: string | undefined;
10
+ readonly team: string | undefined;
11
+ readonly username: string | undefined;
12
+ };
13
+ readonly logLevel: string;
14
+ readonly npm: {
15
+ readonly globalIgnorePackages: string[];
16
+ };
17
+ readonly projects: string[];
18
+ readonly pullRequestSkip: string[];
19
+ readonly rootDir: string;
20
+ }>;
21
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/util/config.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;EA4BjB,CAAA"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.config = void 0;
7
+ var _mshEnv = require("@beecode/msh-env");
8
+ var _logger = require("@beecode/msh-env/util/logger");
9
+ var _mshLogger = require("@beecode/msh-logger");
10
+ var _console = require("@beecode/msh-logger/logger-strategy/console");
11
+ var _simple = require("@beecode/msh-logger/logger-strategy/console/log-strategy/simple");
12
+ var _pattern = require("@beecode/msh-util/singleton/pattern");
13
+ var _dotenv = _interopRequireDefault(require("dotenv"));
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+ (0, _logger.setEnvLogger)(new _console.LoggerStrategyConsole({
16
+ consoleLogStrategy: new _simple.ConsoleLogStrategySimple(),
17
+ logLevel: _mshLogger.LogLevel.INFO
18
+ }));
19
+ var env = (0, _mshEnv.mshEnv)();
20
+ _dotenv["default"].config({
21
+ path: './.msh'
22
+ });
23
+ _dotenv["default"].config({
24
+ path: './.msh-user'
25
+ });
26
+ var config = exports.config = (0, _pattern.singletonPattern)(function () {
27
+ return {
28
+ // dockerBaseImages: env('DOCKER_BASE_IMAGES').json<string[]>().default([]).optional,
29
+ cmd: {
30
+ gitEnabled: env('CMD_GIT_ENABLED')["boolean"]["default"](true).required,
31
+ // cleanEnabled: env('CMD_CLEAN_ENABLED').boolean.default(false).required,
32
+ npmEnabled: env('CMD_NPM_ENABLED')["boolean"]["default"](true).required
33
+ // prEnabled: env('CMD_PR_ENABLED').boolean.default(false).required,
34
+ },
35
+ git: {
36
+ host: env('GIT_HOST').string["default"]('bitbucket.org').required,
37
+ password: env('GIT_PASSWORD').string.optional,
38
+ projectPrefix: env('GIT_PROJECT_PREFIX').string.optional,
39
+ team: env('GIT_TEAM').string.optional,
40
+ username: env('GIT_USERNAME').string.optional
41
+ },
42
+ logLevel: env('LOG_LEVEL').string["default"]('error').required,
43
+ npm: {
44
+ globalIgnorePackages: env('NPM_GLOBAL_IGNORE_PACKAGES').json()["default"]([]).required
45
+ },
46
+ projects: env('PROJECTS').json()["default"]([]).required,
47
+ pullRequestSkip: env('PULL_REQUEST_SKIP').json()["default"]([]).required,
48
+ rootDir: env('ROOT_DIR').string["default"](process.cwd()).required
49
+ };
50
+ });
@@ -0,0 +1,5 @@
1
+ export declare const constant: import("@beecode/msh-util/singleton/pattern").AnyFunctionNoParams<Readonly<{
2
+ projectName: any;
3
+ projectVersion: any;
4
+ }>>;
5
+ //# sourceMappingURL=constant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/util/constant.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ;;;GAKpB,CAAA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.constant = void 0;
7
+ var _pattern = require("@beecode/msh-util/singleton/pattern");
8
+ var packageJson = require('../../package.json'); // eslint-disable-line
9
+
10
+ var constant = exports.constant = (0, _pattern.singletonPattern)(function () {
11
+ return Object.freeze({
12
+ projectName: packageJson.name,
13
+ projectVersion: packageJson.version
14
+ });
15
+ });
@@ -0,0 +1,3 @@
1
+ import { LoggerStrategyConsole } from '@beecode/msh-logger/logger-strategy/console';
2
+ export declare const logger: import("@beecode/msh-util/singleton/pattern").AnyFunctionNoParams<LoggerStrategyConsole>;
3
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/util/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAMnF,eAAO,MAAM,MAAM,0FAOjB,CAAA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.logger = void 0;
7
+ var _mshLogger = require("@beecode/msh-logger");
8
+ var _console = require("@beecode/msh-logger/logger-strategy/console");
9
+ var _simple = require("@beecode/msh-logger/logger-strategy/console/log-strategy/simple");
10
+ var _pattern = require("@beecode/msh-util/singleton/pattern");
11
+ // import { config } from '../util/config.js'
12
+
13
+ var logger = exports.logger = (0, _pattern.singletonPattern)(function () {
14
+ return new _console.LoggerStrategyConsole({
15
+ consoleLogStrategy: new _simple.ConsoleLogStrategySimple(),
16
+ logLevel: _mshLogger.LogLevel.DEBUG
17
+ // TODO: ESM: fix debug level
18
+ // logLevel: (LogLevel[config().logLevel.toUpperCase()] as any) ?? LogLevel.INFO,
19
+ });
20
+ });
@@ -0,0 +1,4 @@
1
+ export declare const objectUtil: {
2
+ sortObjectByKeys: <T extends Record<string, any>>(unordered: T) => T;
3
+ };
4
+ //# sourceMappingURL=object-util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-util.d.ts","sourceRoot":"","sources":["../../src/util/object-util.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;iEACuC,CAAC,KAAG,CAAC;CAUlE,CAAA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.objectUtil = void 0;
7
+ var objectUtil = exports.objectUtil = {
8
+ sortObjectByKeys: function sortObjectByKeys(unordered) {
9
+ return Object.keys(unordered).sort().reduce(function (obj, key) {
10
+ // @ts-expect-error
11
+ obj[key] = unordered[key];
12
+ return obj;
13
+ }, {});
14
+ }
15
+ };
@@ -0,0 +1,8 @@
1
+ import { ChoiceCollection } from 'inquirer';
2
+ import { BaseMenu } from '../util/base-menu.js';
3
+ export declare abstract class SubMenu extends BaseMenu {
4
+ private __mainMenu;
5
+ protected constructor(message: string, choices: ChoiceCollection);
6
+ run(preSelected?: string): Promise<void>;
7
+ }
8
+ //# sourceMappingURL=sub-menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub-menu.d.ts","sourceRoot":"","sources":["../../src/util/sub-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAG9C,8BAAsB,OAAQ,SAAQ,QAAQ;YAG/B,UAAU;IAIxB,SAAS,aAAa,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB;IAI1D,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAS9C"}