tnp-helpers 18.0.21 → 18.0.23

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 (248) hide show
  1. package/assets/shared/shared_folder_info.txt +1 -1
  2. package/browser/README.md +24 -24
  3. package/browser/esm2022/lib/base/classes/base-npm-helpers.mjs +21 -1
  4. package/browser/esm2022/lib/helpers/helpers.mjs +1 -11
  5. package/browser/fesm2022/tnp-helpers.mjs +20 -12
  6. package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
  7. package/browser/lib/base/classes/base-npm-helpers.d.ts +3 -0
  8. package/browser/lib/helpers/helpers.d.ts +0 -4
  9. package/client/README.md +24 -24
  10. package/client/esm2022/lib/base/classes/base-npm-helpers.mjs +21 -1
  11. package/client/esm2022/lib/helpers/helpers.mjs +1 -11
  12. package/client/fesm2022/tnp-helpers.mjs +20 -12
  13. package/client/fesm2022/tnp-helpers.mjs.map +1 -1
  14. package/client/lib/base/classes/base-npm-helpers.d.ts +3 -0
  15. package/client/lib/helpers/helpers.d.ts +0 -4
  16. package/index.js.map +1 -1
  17. package/lib/base/classes/base-bower-json.js.map +1 -1
  18. package/lib/base/classes/base-cli-worker-config.js.map +1 -1
  19. package/lib/base/classes/base-cli-worker-controller.js.map +1 -1
  20. package/lib/base/classes/base-cli-worker.js.map +1 -1
  21. package/lib/base/classes/base-command-line-feature.backend.js.map +1 -1
  22. package/lib/base/classes/base-compiler-for-project.js.map +1 -1
  23. package/lib/base/classes/base-db.js.map +1 -1
  24. package/lib/base/classes/base-debounce-compiler-for-project.js.map +1 -1
  25. package/lib/base/classes/base-detached-service.d.ts +1 -2
  26. package/lib/base/classes/base-detached-service.js +6 -10
  27. package/lib/base/classes/base-detached-service.js.map +1 -1
  28. package/lib/base/classes/base-feature-for-project.js.map +1 -1
  29. package/lib/base/classes/base-git.js.map +1 -1
  30. package/lib/base/classes/base-global-command-line.backend.d.ts +2 -0
  31. package/lib/base/classes/base-global-command-line.backend.js +12 -0
  32. package/lib/base/classes/base-global-command-line.backend.js.map +1 -1
  33. package/lib/base/classes/base-ignore-hide.js.map +1 -1
  34. package/lib/base/classes/base-json-file-reader.js.map +1 -1
  35. package/lib/base/classes/base-library-build.js.map +1 -1
  36. package/lib/base/classes/base-linked-projects.js.map +1 -1
  37. package/lib/base/classes/base-node-modules.js.map +1 -1
  38. package/lib/base/classes/base-npm-helpers.d.ts +3 -0
  39. package/lib/base/classes/base-npm-helpers.js +18 -0
  40. package/lib/base/classes/base-npm-helpers.js.map +1 -1
  41. package/lib/base/classes/base-package-json.js.map +1 -1
  42. package/lib/base/classes/base-process-manager.js.map +1 -1
  43. package/lib/base/classes/base-project-resolver.js.map +1 -1
  44. package/lib/base/classes/base-project.js.map +1 -1
  45. package/lib/base/classes/base-quick-fixes.js.map +1 -1
  46. package/lib/base/classes/base-release-process.js.map +1 -1
  47. package/lib/base/classes/base-start-config.backend.js +0 -7
  48. package/lib/base/classes/base-start-config.backend.js.map +1 -1
  49. package/lib/base/classes/base-static-pages.js.map +1 -1
  50. package/lib/base/classes/base-vscode.js.map +1 -1
  51. package/lib/base/classes/index.js.map +1 -1
  52. package/lib/base/commit-data.js.map +1 -1
  53. package/lib/base/config-database.js.map +1 -1
  54. package/lib/base/core-project.js.map +1 -1
  55. package/lib/base/gh-temp-code.js.map +1 -1
  56. package/lib/base/index-rebuilder.backend.d.ts +0 -1
  57. package/lib/base/index-rebuilder.backend.js.map +1 -1
  58. package/lib/base/index.js.map +1 -1
  59. package/lib/base/linked-project.js.map +1 -1
  60. package/lib/base/project-database.js.map +1 -1
  61. package/lib/base/tcp-udp-ports/index.js.map +1 -1
  62. package/lib/base/tcp-udp-ports/not-assignable-port.entity.d.ts +0 -1
  63. package/lib/base/tcp-udp-ports/not-assignable-port.entity.js +2 -2
  64. package/lib/base/tcp-udp-ports/not-assignable-port.entity.js.map +1 -1
  65. package/lib/base/tcp-udp-ports/ports.controller.js.map +1 -1
  66. package/lib/base/tcp-udp-ports/ports.entity.js.map +1 -1
  67. package/lib/base/tcp-udp-ports/tcp-udp-ports.context.js.map +1 -1
  68. package/lib/base/tcp-udp-ports/tcp-upd-ports.worker.js.map +1 -1
  69. package/lib/base/translate.js.map +1 -1
  70. package/lib/build-info._auto-generated_.js.map +1 -1
  71. package/lib/helpers/for-backend/helpers-cli-tool.backend.js.map +1 -1
  72. package/lib/helpers/for-backend/helpers-console-gui.js.map +1 -1
  73. package/lib/helpers/for-backend/helpers-dependencies.backend.js.map +1 -1
  74. package/lib/helpers/for-backend/helpers-file-folders.backend.js.map +1 -1
  75. package/lib/helpers/for-backend/helpers-git.backend.js +12 -8
  76. package/lib/helpers/for-backend/helpers-git.backend.js.map +1 -1
  77. package/lib/helpers/for-backend/helpers-network.backend.js.map +1 -1
  78. package/lib/helpers/for-backend/helpers-npm.backend.js.map +1 -1
  79. package/lib/helpers/for-backend/helpers-path.backend.js.map +1 -1
  80. package/lib/helpers/for-backend/helpers-process.backend.js.map +1 -1
  81. package/lib/helpers/for-backend/helpers-system-terminal.backend.js.map +1 -1
  82. package/lib/helpers/for-backend/helpers-vscode.backend.js.map +1 -1
  83. package/lib/helpers/for-browser/angular.helper.js +2 -2
  84. package/lib/helpers/for-browser/angular.helper.js.map +1 -1
  85. package/lib/helpers/for-browser/helpers-browser.js.map +1 -1
  86. package/lib/helpers/helpers-array-obj.js.map +1 -1
  87. package/lib/helpers/helpers-json5.backend.js.map +1 -1
  88. package/lib/helpers/helpers-numbers.js.map +1 -1
  89. package/lib/helpers/helpers-strings-regexes.js.map +1 -1
  90. package/lib/helpers/helpers-strings.js.map +1 -1
  91. package/lib/helpers/helpers.d.ts +0 -4
  92. package/lib/helpers/helpers.js +0 -15
  93. package/lib/helpers/helpers.js.map +1 -1
  94. package/lib/index._auto-generated_.d.ts +0 -1
  95. package/lib/index._auto-generated_.js.map +1 -1
  96. package/lib/index.js.map +1 -1
  97. package/lib/lowdb/adapters/Memory.js.map +1 -1
  98. package/lib/lowdb/adapters/browser/LocalStorage.js.map +1 -1
  99. package/lib/lowdb/adapters/browser/SessionStorage.js.map +1 -1
  100. package/lib/lowdb/adapters/browser/WebStorage.js.map +1 -1
  101. package/lib/lowdb/adapters/node/DataFile.js.map +1 -1
  102. package/lib/lowdb/adapters/node/JSONFile.js.map +1 -1
  103. package/lib/lowdb/adapters/node/TextFile.js.map +1 -1
  104. package/lib/lowdb/adapters/node/steno.js.map +1 -1
  105. package/lib/lowdb/browser.js.map +1 -1
  106. package/lib/lowdb/core/Low.js.map +1 -1
  107. package/lib/lowdb/examples/browser.js.map +1 -1
  108. package/lib/lowdb/examples/cli.d.ts +0 -1
  109. package/lib/lowdb/examples/cli.js.map +1 -1
  110. package/lib/lowdb/examples/in-memory.d.ts +0 -1
  111. package/lib/lowdb/examples/in-memory.js.map +1 -1
  112. package/lib/lowdb/examples/server.d.ts +0 -1
  113. package/lib/lowdb/examples/server.js.map +1 -1
  114. package/lib/lowdb/index.js.map +1 -1
  115. package/lib/lowdb/node.js.map +1 -1
  116. package/lib/lowdb/presets/browser.js.map +1 -1
  117. package/lib/lowdb/presets/node.js.map +1 -1
  118. package/lib/models.js.map +1 -1
  119. package/lib/old/base-component.d.ts +0 -1
  120. package/lib/old/base-component.js +2 -2
  121. package/lib/old/base-component.js.map +1 -1
  122. package/lib/old/base-formly-component.d.ts +0 -1
  123. package/lib/old/base-formly-component.js +2 -2
  124. package/lib/old/base-formly-component.js.map +1 -1
  125. package/lib/old/condition-wait.d.ts +0 -1
  126. package/lib/old/condition-wait.js.map +1 -1
  127. package/lib/old/dual-component-ctrl.d.ts +0 -1
  128. package/lib/old/dual-component-ctrl.js +2 -2
  129. package/lib/old/dual-component-ctrl.js.map +1 -1
  130. package/lib/old/execute-command.js.map +1 -1
  131. package/lib/old/helpers.js.map +1 -1
  132. package/lib/old/models.js.map +1 -1
  133. package/lib/utils.js.map +1 -1
  134. package/lib/validators/validators-firedev.js.map +1 -1
  135. package/lib/validators/validators-git.js.map +1 -1
  136. package/lib/validators/validators-network.js.map +1 -1
  137. package/lib/validators/validators.js.map +1 -1
  138. package/migrations/1736198527297_init.js.map +1 -1
  139. package/migrations/1736199486472_addingNotAssignablePorts.js.map +1 -1
  140. package/migrations/1736454437350_addFreePorts.js.map +1 -1
  141. package/migrations/index.js.map +1 -1
  142. package/migrations/migrations_index._auto-generated_.js.map +1 -1
  143. package/package.json +4 -4
  144. package/taon.jsonc +33 -33
  145. package/tmp-environment.json +3 -3
  146. package/websql/README.md +24 -24
  147. package/websql/esm2022/lib/base/classes/base-npm-helpers.mjs +21 -1
  148. package/websql/esm2022/lib/helpers/helpers.mjs +1 -11
  149. package/websql/fesm2022/tnp-helpers.mjs +20 -12
  150. package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
  151. package/websql/lib/base/classes/base-npm-helpers.d.ts +3 -0
  152. package/websql/lib/helpers/helpers.d.ts +0 -4
  153. package/lib/base/base-cli-worker-config.d.ts +0 -27
  154. package/lib/base/base-cli-worker-config.js +0 -53
  155. package/lib/base/base-cli-worker-config.js.map +0 -1
  156. package/lib/base/base-cli-worker-controller.d.ts +0 -15
  157. package/lib/base/base-cli-worker-controller.js +0 -154
  158. package/lib/base/base-cli-worker-controller.js.map +0 -1
  159. package/lib/base/base-cli-worker.d.ts +0 -82
  160. package/lib/base/base-cli-worker.js +0 -654
  161. package/lib/base/base-cli-worker.js.map +0 -1
  162. package/lib/base/base-command-line.backend.d.ts +0 -174
  163. package/lib/base/base-command-line.backend.js +0 -2221
  164. package/lib/base/base-command-line.backend.js.map +0 -1
  165. package/lib/base/base-compiler-for-project.d.ts +0 -7
  166. package/lib/base/base-compiler-for-project.js +0 -62
  167. package/lib/base/base-compiler-for-project.js.map +0 -1
  168. package/lib/base/base-db.d.ts +0 -12
  169. package/lib/base/base-db.js +0 -74
  170. package/lib/base/base-db.js.map +0 -1
  171. package/lib/base/base-debounce-compiler-for-project.d.ts +0 -28
  172. package/lib/base/base-debounce-compiler-for-project.js +0 -82
  173. package/lib/base/base-debounce-compiler-for-project.js.map +0 -1
  174. package/lib/base/base-detached-service.d.ts +0 -6
  175. package/lib/base/base-detached-service.js +0 -16
  176. package/lib/base/base-detached-service.js.map +0 -1
  177. package/lib/base/base-feature-for-project.d.ts +0 -5
  178. package/lib/base/base-feature-for-project.js +0 -11
  179. package/lib/base/base-feature-for-project.js.map +0 -1
  180. package/lib/base/base-git.d.ts +0 -148
  181. package/lib/base/base-git.js +0 -1202
  182. package/lib/base/base-git.js.map +0 -1
  183. package/lib/base/base-github-pages.d.ts +0 -14
  184. package/lib/base/base-github-pages.js +0 -173
  185. package/lib/base/base-github-pages.js.map +0 -1
  186. package/lib/base/base-ignore-hide.d.ts +0 -14
  187. package/lib/base/base-ignore-hide.js +0 -55
  188. package/lib/base/base-ignore-hide.js.map +0 -1
  189. package/lib/base/base-library-build.d.ts +0 -65
  190. package/lib/base/base-library-build.js +0 -717
  191. package/lib/base/base-library-build.js.map +0 -1
  192. package/lib/base/base-linked-projects.d.ts +0 -24
  193. package/lib/base/base-linked-projects.js +0 -408
  194. package/lib/base/base-linked-projects.js.map +0 -1
  195. package/lib/base/base-npm-helpers.d.ts +0 -128
  196. package/lib/base/base-npm-helpers.js +0 -774
  197. package/lib/base/base-npm-helpers.js.map +0 -1
  198. package/lib/base/base-project-resolver.d.ts +0 -41
  199. package/lib/base/base-project-resolver.js +0 -308
  200. package/lib/base/base-project-resolver.js.map +0 -1
  201. package/lib/base/base-project.d.ts +0 -244
  202. package/lib/base/base-project.js +0 -1223
  203. package/lib/base/base-project.js.map +0 -1
  204. package/lib/base/base-quick-fixes.d.ts +0 -6
  205. package/lib/base/base-quick-fixes.js +0 -31
  206. package/lib/base/base-quick-fixes.js.map +0 -1
  207. package/lib/base/base-release-process.d.ts +0 -69
  208. package/lib/base/base-release-process.js +0 -913
  209. package/lib/base/base-release-process.js.map +0 -1
  210. package/lib/base/base-start-config.backend.d.ts +0 -36
  211. package/lib/base/base-start-config.backend.js +0 -167
  212. package/lib/base/base-start-config.backend.js.map +0 -1
  213. package/lib/base/base-vscode.d.ts +0 -12
  214. package/lib/base/base-vscode.js +0 -139
  215. package/lib/base/base-vscode.js.map +0 -1
  216. package/lib/base/classes/base-command-line.backend.d.ts +0 -175
  217. package/lib/base/classes/base-command-line.backend.js +0 -2235
  218. package/lib/base/classes/base-command-line.backend.js.map +0 -1
  219. package/lib/base/classes/base-github-pages.d.ts +0 -14
  220. package/lib/base/classes/base-github-pages.js +0 -173
  221. package/lib/base/classes/base-github-pages.js.map +0 -1
  222. package/lib/base/classes/index copy.d.ts +0 -22
  223. package/lib/base/classes/index copy.js +0 -28
  224. package/lib/base/classes/index copy.js.map +0 -1
  225. package/lib/base/command-line-feature.backend.d.ts +0 -51
  226. package/lib/base/command-line-feature.backend.js +0 -206
  227. package/lib/base/command-line-feature.backend.js.map +0 -1
  228. package/lib/base/ports-worker.d.ts +0 -32
  229. package/lib/base/ports-worker.js +0 -244
  230. package/lib/base/ports-worker.js.map +0 -1
  231. package/lib/base/tcp-udp-ports/port.entity.d.ts +0 -0
  232. package/lib/base/tcp-udp-ports/port.entity.js +0 -5
  233. package/lib/base/tcp-udp-ports/port.entity.js.map +0 -1
  234. package/lib/base/tcp-upd-ports.worker.d.ts +0 -13
  235. package/lib/base/tcp-upd-ports.worker.js +0 -99
  236. package/lib/base/tcp-upd-ports.worker.js.map +0 -1
  237. package/lib/helpers/for-backend/ts-code/index.d.ts +0 -1
  238. package/lib/helpers/for-backend/ts-code/index.js +0 -5
  239. package/lib/helpers/for-backend/ts-code/index.js.map +0 -1
  240. package/lib/helpers/for-backend/ts-code/ts-code-extractor.d.ts +0 -26
  241. package/lib/helpers/for-backend/ts-code/ts-code-extractor.js +0 -62
  242. package/lib/helpers/for-backend/ts-code/ts-code-extractor.js.map +0 -1
  243. package/lib/helpers/for-backend/ts-code/ts-code-modifier.backend.d.ts +0 -19
  244. package/lib/helpers/for-backend/ts-code/ts-code-modifier.backend.js +0 -81
  245. package/lib/helpers/for-backend/ts-code/ts-code-modifier.backend.js.map +0 -1
  246. package/lib/helpers/for-backend/ts-code/ts-import-export-extractor.d.ts +0 -29
  247. package/lib/helpers/for-backend/ts-code/ts-import-export-extractor.js +0 -81
  248. package/lib/helpers/for-backend/ts-code/ts-import-export-extractor.js.map +0 -1
@@ -1,2235 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseCommandLine = void 0;
4
- var tslib_1 = require("tslib");
5
- var index_1 = require("../../index");
6
- var command_line_feature_backend_1 = require("./../command-line-feature.backend");
7
- var tnp_core_1 = require("tnp-core");
8
- var tnp_config_1 = require("tnp-config");
9
- var tnp_config_2 = require("tnp-config");
10
- var tnp_core_2 = require("tnp-core");
11
- var gh_temp_code_1 = require("../gh-temp-code");
12
- var BaseCommandLine = /** @class */ (function (_super) {
13
- tslib_1.__extends(BaseCommandLine, _super);
14
- function BaseCommandLine() {
15
- return _super !== null && _super.apply(this, arguments) || this;
16
- }
17
- BaseCommandLine.prototype._ = function () {
18
- index_1.Helpers.error('Please select git command');
19
- };
20
- //#region commands / prevent cwd is not project
21
- /**
22
- * TODO return argument not need for now
23
- */
24
- BaseCommandLine.prototype.cwdIsProject = function (options) {
25
- return tslib_1.__awaiter(this, void 0, void 0, function () {
26
- var requireProjectWithGitRoot, proj, useRoot;
27
- return tslib_1.__generator(this, function (_a) {
28
- switch (_a.label) {
29
- case 0:
30
- requireProjectWithGitRoot = (options || {}).requireProjectWithGitRoot;
31
- if (!!this.project && !requireProjectWithGitRoot) {
32
- return [2 /*return*/, true];
33
- }
34
- if (!(requireProjectWithGitRoot &&
35
- (!this.project || !this.project.git.isGitRoot))) return [3 /*break*/, 3];
36
- proj = this.ins.nearestTo(this.cwd, { findGitRoot: true });
37
- if (!proj) return [3 /*break*/, 2];
38
- index_1.Helpers.info("\n Current folder (".concat(this.cwd, ")\n is not a git root folder, but nearest project with\n git root has been found in: ").concat(tnp_core_1.chalk.bold(proj.genericName), "\n\n "));
39
- return [4 /*yield*/, index_1.Helpers.questionYesNo('Would you like to use this project ?')];
40
- case 1:
41
- useRoot = _a.sent();
42
- if (useRoot) {
43
- this.project = proj;
44
- this.cwd = proj.location;
45
- return [2 /*return*/, true];
46
- }
47
- else {
48
- index_1.Helpers.error("[".concat(tnp_config_2.config.frameworkName, "] This is not git root project folder"), true, true);
49
- }
50
- return [3 /*break*/, 3];
51
- case 2:
52
- index_1.Helpers.error("[".concat(tnp_config_2.config.frameworkName, "] This folder is not project folder"), false, true);
53
- _a.label = 3;
54
- case 3: return [2 /*return*/, true];
55
- }
56
- });
57
- });
58
- };
59
- //#endregion
60
- //#region commands / hosts
61
- BaseCommandLine.prototype.hosts = function () {
62
- index_1.Helpers.run("code ".concat((0, tnp_core_2.crossPlatformPath)(tnp_config_1.HOST_FILE_PATH))).sync();
63
- process.exit(0);
64
- };
65
- //#endregion
66
- //#region commands / count commits
67
- BaseCommandLine.prototype.countCommits = function () {
68
- console.log(index_1.Helpers.git.countCommits(this.cwd));
69
- this._exit();
70
- };
71
- //#endregion
72
- //#region commands / remove submodules
73
- BaseCommandLine.prototype.removeSubmodules = function () {
74
- var e_1, _a;
75
- index_1.Helpers.taskStarted('Removing submodules...');
76
- try {
77
- for (var _b = tslib_1.__values(index_1.Helpers.foldersFrom(this.cwd, {
78
- recursive: false,
79
- })), _c = _b.next(); !_c.done; _c = _b.next()) {
80
- var folderAbsPath = _c.value;
81
- if (index_1.Helpers.exists((0, tnp_core_2.crossPlatformPath)([folderAbsPath, '.git']))) {
82
- try {
83
- index_1.Helpers.run("git rm --cached ".concat(tnp_core_1.path.basename(folderAbsPath))).sync();
84
- }
85
- catch (error) { }
86
- }
87
- }
88
- }
89
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
90
- finally {
91
- try {
92
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
93
- }
94
- finally { if (e_1) throw e_1.error; }
95
- }
96
- index_1.Helpers.taskDone('Done');
97
- this._exit();
98
- };
99
- //#endregion
100
- //#region commands / set editor
101
- BaseCommandLine.prototype.setEditor = function () {
102
- return tslib_1.__awaiter(this, void 0, void 0, function () {
103
- return tslib_1.__generator(this, function (_a) {
104
- switch (_a.label) {
105
- case 0: return [4 /*yield*/, this.ins.configDb.selectCodeEditor()];
106
- case 1:
107
- _a.sent();
108
- this._exit();
109
- return [2 /*return*/];
110
- }
111
- });
112
- });
113
- };
114
- //#endregion
115
- //#region commands / quick git update
116
- /**
117
- * quick git update push
118
- */
119
- BaseCommandLine.prototype.update = function () {
120
- return tslib_1.__awaiter(this, void 0, void 0, function () {
121
- return tslib_1.__generator(this, function (_a) {
122
- switch (_a.label) {
123
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
124
- case 1:
125
- if (!(_a.sent())) {
126
- return [2 /*return*/];
127
- }
128
- index_1.Helpers.info('Updating & push project...');
129
- try {
130
- this.project.git.addAndCommit("chore: ".concat(!!this.firstArg ? this.firstArg : 'update'));
131
- }
132
- catch (error) { }
133
- return [4 /*yield*/, this.project.git.pushCurrentBranch({
134
- askToRetry: true,
135
- forcePushNoQuestion: true,
136
- })];
137
- case 2:
138
- _a.sent();
139
- index_1.Helpers.info('Done');
140
- this._exit();
141
- return [2 /*return*/];
142
- }
143
- });
144
- });
145
- };
146
- BaseCommandLine.prototype.deepUp = function () {
147
- return tslib_1.__awaiter(this, arguments, void 0, function (noExit) {
148
- if (noExit === void 0) { noExit = false; }
149
- return tslib_1.__generator(this, function (_a) {
150
- switch (_a.label) {
151
- case 0: return [4 /*yield*/, this.deepUpdate(noExit)];
152
- case 1:
153
- _a.sent();
154
- return [2 /*return*/];
155
- }
156
- });
157
- });
158
- };
159
- BaseCommandLine.prototype.deepUpdate = function () {
160
- return tslib_1.__awaiter(this, arguments, void 0, function (noExit) {
161
- var updateProject;
162
- var _this = this;
163
- if (noExit === void 0) { noExit = false; }
164
- return tslib_1.__generator(this, function (_a) {
165
- switch (_a.label) {
166
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
167
- case 1:
168
- if (!(_a.sent())) {
169
- return [2 /*return*/];
170
- }
171
- index_1.Helpers.info('Deep updating & pushing project with children...');
172
- updateProject = function (project) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
173
- var error_1, _a, _b, child, e_2_1;
174
- var e_2, _c;
175
- return tslib_1.__generator(this, function (_d) {
176
- switch (_d.label) {
177
- case 0:
178
- _d.trys.push([0, 2, , 3]);
179
- return [4 /*yield*/, project.npmHelpers.bumpPatchVersion()];
180
- case 1:
181
- _d.sent();
182
- return [3 /*break*/, 3];
183
- case 2:
184
- error_1 = _d.sent();
185
- return [3 /*break*/, 3];
186
- case 3:
187
- try {
188
- project.git.addAndCommit("chore: ".concat(!!this.firstArg ? this.args.join(' ') : 'update'));
189
- }
190
- catch (error) { }
191
- return [4 /*yield*/, project.git.pushCurrentBranch({
192
- askToRetry: true,
193
- forcePushNoQuestion: true,
194
- })];
195
- case 4:
196
- _d.sent();
197
- if (!!project.isMonorepo) return [3 /*break*/, 12];
198
- _d.label = 5;
199
- case 5:
200
- _d.trys.push([5, 10, 11, 12]);
201
- _a = tslib_1.__values(project.children), _b = _a.next();
202
- _d.label = 6;
203
- case 6:
204
- if (!!_b.done) return [3 /*break*/, 9];
205
- child = _b.value;
206
- if (!child.git.isGitRoot) return [3 /*break*/, 8];
207
- return [4 /*yield*/, updateProject(child)];
208
- case 7:
209
- _d.sent();
210
- _d.label = 8;
211
- case 8:
212
- _b = _a.next();
213
- return [3 /*break*/, 6];
214
- case 9: return [3 /*break*/, 12];
215
- case 10:
216
- e_2_1 = _d.sent();
217
- e_2 = { error: e_2_1 };
218
- return [3 /*break*/, 12];
219
- case 11:
220
- try {
221
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
222
- }
223
- finally { if (e_2) throw e_2.error; }
224
- return [7 /*endfinally*/];
225
- case 12: return [2 /*return*/];
226
- }
227
- });
228
- }); };
229
- return [4 /*yield*/, updateProject(this.project)];
230
- case 2:
231
- _a.sent();
232
- index_1.Helpers.info('Done');
233
- this._exit();
234
- return [2 /*return*/];
235
- }
236
- });
237
- });
238
- };
239
- /**
240
- * Push update
241
- */
242
- BaseCommandLine.prototype.up = function () {
243
- return tslib_1.__awaiter(this, void 0, void 0, function () {
244
- return tslib_1.__generator(this, function (_a) {
245
- switch (_a.label) {
246
- case 0: return [4 /*yield*/, this.update()];
247
- case 1:
248
- _a.sent();
249
- return [2 /*return*/];
250
- }
251
- });
252
- });
253
- };
254
- /**
255
- * Push update
256
- */
257
- BaseCommandLine.prototype.pu = function () {
258
- return tslib_1.__awaiter(this, void 0, void 0, function () {
259
- return tslib_1.__generator(this, function (_a) {
260
- switch (_a.label) {
261
- case 0: return [4 /*yield*/, this.update()];
262
- case 1:
263
- _a.sent();
264
- return [2 /*return*/];
265
- }
266
- });
267
- });
268
- };
269
- //#endregion
270
- //#region commands / develop
271
- BaseCommandLine.prototype.develop = function () {
272
- return tslib_1.__awaiter(this, void 0, void 0, function () {
273
- var founded, results, openInEditor, res;
274
- var _this = this;
275
- return tslib_1.__generator(this, function (_a) {
276
- switch (_a.label) {
277
- case 0:
278
- // Helpers.clearConsole();
279
- index_1.Helpers.taskStarted("getting all projects...");
280
- return [4 /*yield*/, this.ins.projectsDb.getAllProjectsFromDB()];
281
- case 1:
282
- founded = ((_a.sent()) || [])
283
- .filter(function (p) { return index_1.Helpers.exists(p.location); })
284
- .map(function (p) {
285
- var proj = _this.ins.From(p.location);
286
- // console.log(`Proj for ${p.location} `, !!proj)
287
- if (proj) {
288
- return proj;
289
- // return proj.embeddedProject ? proj.embeddedProject : proj;
290
- }
291
- // const nereset = this.ins.nearestTo(p.location);
292
- // if (nereset) {
293
- // const embeded = nereset.linkedProjects.find(l => crossPlatformPath([nereset.location, l.relativeClonePath]) === p.location);
294
- // if (embeded) {
295
- // return this.ins.From([nereset.location, embeded.relativeClonePath]);
296
- // }
297
- // }
298
- })
299
- .filter(function (p) { return !!p; });
300
- index_1.Helpers.taskDone("found ".concat(founded.length, " projects..."));
301
- index_1.Helpers.taskStarted("searching for project...");
302
- results = index_1.Helpers.uniqArray(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(index_1.Helpers.arrays.fuzzy(this.args.join(' '), founded, function (p) { return p.name; })
303
- .results), false), tslib_1.__read(index_1.Helpers.arrays.fuzzy(this.args.join(' '), founded, function (p) { return p.basename; })
304
- .results), false), tslib_1.__read(index_1.Helpers.arrays.fuzzy(this.args.join(' '), founded, function (p) { return p.location; })
305
- .results), false), 'location');
306
- index_1.Helpers.taskDone("found ".concat(results.length, " projects..."));
307
- openInEditor = function (proj) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
308
- var editor, embededProject, porjToOpen, locaitonFolderToOpen, error_2;
309
- return tslib_1.__generator(this, function (_a) {
310
- switch (_a.label) {
311
- case 0:
312
- index_1.Helpers.taskStarted("Getting code editor info...");
313
- return [4 /*yield*/, this.ins.configDb.getCodeEditor()];
314
- case 1:
315
- editor = _a.sent();
316
- index_1.Helpers.taskDone("Got code editor info...");
317
- embededProject = proj.linkedProjects.embeddedProject;
318
- porjToOpen = embededProject || proj;
319
- locaitonFolderToOpen = porjToOpen.location;
320
- index_1.Helpers.info('Initing and opening project...');
321
- _a.label = 2;
322
- case 2:
323
- _a.trys.push([2, 4, , 5]);
324
- return [4 /*yield*/, (porjToOpen === null || porjToOpen === void 0 ? void 0 : porjToOpen.struct())];
325
- case 3:
326
- _a.sent();
327
- return [3 /*break*/, 5];
328
- case 4:
329
- error_2 = _a.sent();
330
- return [3 /*break*/, 5];
331
- case 5:
332
- index_1.Helpers.run("".concat(editor, " ").concat(locaitonFolderToOpen)).sync();
333
- return [2 /*return*/];
334
- }
335
- });
336
- }); };
337
- if (!(results.length === 1)) return [3 /*break*/, 3];
338
- return [4 /*yield*/, openInEditor(tnp_core_1._.first(results))];
339
- case 2:
340
- _a.sent();
341
- return [3 /*break*/, 7];
342
- case 3:
343
- if (!(results.length === 0)) return [3 /*break*/, 4];
344
- index_1.Helpers.error("No project found by name: \"".concat(this.args.join(' '), "\""), false, true);
345
- return [3 /*break*/, 7];
346
- case 4:
347
- index_1.Helpers.info("Opening console gui to select project...");
348
- return [4 /*yield*/, index_1.Helpers.consoleGui.select('Select project to open', results.map(function (p) {
349
- return {
350
- name: p.genericName,
351
- value: p.location,
352
- };
353
- }), true)];
354
- case 5:
355
- res = _a.sent();
356
- return [4 /*yield*/, openInEditor(this.ins.From(res))];
357
- case 6:
358
- _a.sent();
359
- _a.label = 7;
360
- case 7:
361
- this._exit();
362
- return [2 /*return*/];
363
- }
364
- });
365
- });
366
- };
367
- BaseCommandLine.prototype.dev = function () {
368
- return tslib_1.__awaiter(this, void 0, void 0, function () {
369
- return tslib_1.__generator(this, function (_a) {
370
- switch (_a.label) {
371
- case 0: return [4 /*yield*/, this.develop()];
372
- case 1: return [2 /*return*/, _a.sent()];
373
- }
374
- });
375
- });
376
- };
377
- //#endregion
378
- //#region commands / repulll
379
- BaseCommandLine.prototype.repul = function () {
380
- return tslib_1.__awaiter(this, void 0, void 0, function () {
381
- return tslib_1.__generator(this, function (_a) {
382
- switch (_a.label) {
383
- case 0: return [4 /*yield*/, this.repull()];
384
- case 1:
385
- _a.sent();
386
- return [2 /*return*/];
387
- }
388
- });
389
- });
390
- };
391
- BaseCommandLine.prototype.repull = function () {
392
- return tslib_1.__awaiter(this, void 0, void 0, function () {
393
- return tslib_1.__generator(this, function (_a) {
394
- switch (_a.label) {
395
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
396
- case 1:
397
- if (!(_a.sent())) {
398
- return [2 /*return*/];
399
- }
400
- return [4 /*yield*/, this.project.git.resetHard({ HEAD: 10 })];
401
- case 2:
402
- _a.sent();
403
- return [4 /*yield*/, this.pull()];
404
- case 3:
405
- _a.sent();
406
- return [2 /*return*/];
407
- }
408
- });
409
- });
410
- };
411
- //#endregion
412
- //#region commands / pull
413
- BaseCommandLine.prototype.pull = function () {
414
- return tslib_1.__awaiter(this, void 0, void 0, function () {
415
- return tslib_1.__generator(this, function (_a) {
416
- switch (_a.label) {
417
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
418
- case 1:
419
- if (!(_a.sent())) {
420
- return [2 /*return*/];
421
- }
422
- return [4 /*yield*/, this.project.git.pullProcess({
423
- setOrigin: this.params['setOrigin'],
424
- })];
425
- case 2:
426
- _a.sent();
427
- this._exit();
428
- return [2 /*return*/];
429
- }
430
- });
431
- });
432
- };
433
- //#endregion
434
- //#region commands / pull all
435
- BaseCommandLine.prototype.pullAll = function () {
436
- return tslib_1.__awaiter(this, void 0, void 0, function () {
437
- return tslib_1.__generator(this, function (_a) {
438
- switch (_a.label) {
439
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
440
- case 1:
441
- if (!(_a.sent())) {
442
- return [2 /*return*/];
443
- }
444
- return [4 /*yield*/, this.project.git.pullProcess({
445
- cloneChildren: true,
446
- setOrigin: this.params['setOrigin'],
447
- })];
448
- case 2:
449
- _a.sent();
450
- this._exit();
451
- return [2 /*return*/];
452
- }
453
- });
454
- });
455
- };
456
- //#endregion
457
- BaseCommandLine.prototype.pp = function () {
458
- return tslib_1.__awaiter(this, void 0, void 0, function () {
459
- var currentBranch;
460
- return tslib_1.__generator(this, function (_a) {
461
- currentBranch = this.project.git.currentBranchName;
462
- this.project
463
- .run("git push origin ".concat(currentBranch, " && git pull origin ").concat(currentBranch))
464
- .sync();
465
- console.log('Done push and pull');
466
- this._exit();
467
- return [2 /*return*/];
468
- });
469
- });
470
- };
471
- //#region commands / reset
472
- BaseCommandLine.prototype.__resetInfo = function (branchToReset) {
473
- index_1.Helpers.info("\n\n YOU ARE RESETING EVERYTHING TO BRANCH: ".concat(tnp_core_1.chalk.bold(branchToReset), "\n\n- curret project (").concat(this.project.name, ")\n").concat(tnp_core_1._.isArray(this.project.children) && this.project.children.length > 0
474
- ? "- modules:\n".concat(this.project.children
475
- .map(function (c) { return "\t".concat(c.basename, " (").concat(tnp_core_1.chalk.yellow(c.name), ")"); })
476
- .join('\n'))
477
- : '', "\n "));
478
- };
479
- BaseCommandLine.prototype.fetch = function () {
480
- return tslib_1.__awaiter(this, void 0, void 0, function () {
481
- var _a, _b;
482
- return tslib_1.__generator(this, function (_c) {
483
- try {
484
- (_b = (_a = this.project) === null || _a === void 0 ? void 0 : _a.git) === null || _b === void 0 ? void 0 : _b.fetch();
485
- }
486
- catch (error) { }
487
- this._exit();
488
- return [2 /*return*/];
489
- });
490
- });
491
- };
492
- BaseCommandLine.prototype.reset = function () {
493
- return tslib_1.__awaiter(this, void 0, void 0, function () {
494
- var parent, branchFromLinkedProjectConfig, overrideBranchToReset, resetOnlyChildren, branches, resetProject, res;
495
- var _this = this;
496
- var _a, _b, _c, _d, _e;
497
- return tslib_1.__generator(this, function (_f) {
498
- switch (_f.label) {
499
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
500
- case 1:
501
- // Helpers.clearConsole();
502
- if (!(_f.sent())) {
503
- return [2 /*return*/];
504
- }
505
- parent = this.project.parent;
506
- branchFromLinkedProjectConfig = (_b = (_a = parent === null || parent === void 0 ? void 0 : parent.linkedProjects) === null || _a === void 0 ? void 0 : _a.linkedProjects.find(function (l) {
507
- return ((0, tnp_core_2.crossPlatformPath)([parent.location, l.relativeClonePath]) ===
508
- _this.project.location);
509
- })) === null || _b === void 0 ? void 0 : _b.deafultBranch;
510
- overrideBranchToReset = this.firstArg ||
511
- branchFromLinkedProjectConfig ||
512
- ((_c = this.project.core) === null || _c === void 0 ? void 0 : _c.branch) ||
513
- this.project.getDefaultDevelopmentBranch() ||
514
- this.project.git.currentBranchName;
515
- if ((_d = this.project.core) === null || _d === void 0 ? void 0 : _d.branch) {
516
- index_1.Helpers.info("\n\n Core branch for project: ".concat((_e = this.project.core) === null || _e === void 0 ? void 0 : _e.branch, "\n\n "));
517
- }
518
- resetOnlyChildren = !!this.project.linkedProjects.getLinkedProjectsConfig().resetOnlyChildren;
519
- branches = index_1.Helpers.uniqArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(this.__filterBranchesByPattern(overrideBranchToReset)), false), tslib_1.__read(this.__filterBranchesByPattern('')), false));
520
- if (!resetOnlyChildren) return [3 /*break*/, 2];
521
- index_1.Helpers.info("Reseting only children...for defualt branches.");
522
- return [3 /*break*/, 5];
523
- case 2:
524
- if (!(branches.length > 0)) return [3 /*break*/, 4];
525
- return [4 /*yield*/, this.__selectBrach(branches, 'reset')];
526
- case 3:
527
- overrideBranchToReset = _f.sent();
528
- return [3 /*break*/, 5];
529
- case 4:
530
- index_1.Helpers.error("No branch found by name \"".concat(overrideBranchToReset || this.firstArg, "\""), false, true);
531
- _f.label = 5;
532
- case 5:
533
- overrideBranchToReset = overrideBranchToReset || '';
534
- this.__resetInfo(overrideBranchToReset
535
- ? overrideBranchToReset
536
- : this.project.getDefaultDevelopmentBranch());
537
- resetProject = this.project;
538
- if (!(this.project.git.isInsideGitRepo && !this.project.git.isGitRoot)) return [3 /*break*/, 7];
539
- index_1.Helpers.warn("You are not in root of git repo...", false);
540
- resetProject = this.ins.nearestTo((0, tnp_core_2.crossPlatformPath)([this.project.location, '..']), {
541
- findGitRoot: true,
542
- });
543
- return [4 /*yield*/, index_1.Helpers.questionYesNo("Would you like to reset root repo instead (project=".concat(tnp_core_1.chalk.bold.red(resetProject.genericName), ") ?"))];
544
- case 6:
545
- if (!(_f.sent())) {
546
- index_1.Helpers.error("Aborted", false, true);
547
- }
548
- _f.label = 7;
549
- case 7: return [4 /*yield*/, index_1.Helpers.questionYesNo("Reset hard and pull current project " +
550
- "".concat(resetProject.linkedProjects.linkedProjects.length > 0 ? '(and children)' : '', " ?"))];
551
- case 8:
552
- res = _f.sent();
553
- if (!res) return [3 /*break*/, 10];
554
- return [4 /*yield*/, resetProject.resetProcess(overrideBranchToReset)];
555
- case 9:
556
- _f.sent();
557
- _f.label = 10;
558
- case 10:
559
- this._exit();
560
- return [2 /*return*/];
561
- }
562
- });
563
- });
564
- };
565
- //#endregion
566
- //#region commands / soft
567
- BaseCommandLine.prototype.soft = function () {
568
- return tslib_1.__awaiter(this, void 0, void 0, function () {
569
- return tslib_1.__generator(this, function (_a) {
570
- switch (_a.label) {
571
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
572
- case 1:
573
- // TODO when aciton commit
574
- if (!(_a.sent())) {
575
- return [2 /*return*/];
576
- }
577
- this.project.git.resetSoftHEAD(1);
578
- this._exit();
579
- return [2 /*return*/];
580
- }
581
- });
582
- });
583
- };
584
- //#endregion
585
- //#region commands / rebase
586
- BaseCommandLine.prototype.rebase = function () {
587
- return tslib_1.__awaiter(this, void 0, void 0, function () {
588
- var currentBranch, safeReset, rebaseBranch, branches, error_3;
589
- return tslib_1.__generator(this, function (_a) {
590
- switch (_a.label) {
591
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
592
- case 1:
593
- if (!(_a.sent())) {
594
- return [2 /*return*/];
595
- }
596
- currentBranch = this.project.git.currentBranchName;
597
- safeReset = 10;
598
- rebaseBranch = this.firstArg || this.project.getDefaultDevelopmentBranch();
599
- branches = this.__filterBranchesByPattern(rebaseBranch);
600
- if (!(branches.length > 0)) return [3 /*break*/, 3];
601
- return [4 /*yield*/, this.__selectBrach(branches, 'reset')];
602
- case 2:
603
- rebaseBranch = _a.sent();
604
- return [3 /*break*/, 4];
605
- case 3:
606
- index_1.Helpers.error("No branch found by name \"".concat(rebaseBranch, "\""), false, true);
607
- _a.label = 4;
608
- case 4:
609
- _a.trys.push([4, 6, , 8]);
610
- this.project
611
- .run("git reset--hard && git checkout ".concat(rebaseBranch, " && git reset--hard HEAD~").concat(safeReset, " && git pull origin ").concat(rebaseBranch, " ") +
612
- "&& git checkout ".concat(currentBranch, " && git reset--soft HEAD~1 && git stash && git reset--hard HEAD~").concat(safeReset, " && git rebase ").concat(rebaseBranch, " && git stash apply"), { output: false, silence: true })
613
- .sync();
614
- return [4 /*yield*/, this.project.init()];
615
- case 5:
616
- _a.sent();
617
- index_1.Helpers.info('REBASE DONE');
618
- return [3 /*break*/, 8];
619
- case 6:
620
- error_3 = _a.sent();
621
- return [4 /*yield*/, this.project.init()];
622
- case 7:
623
- _a.sent();
624
- index_1.Helpers.warn('PLEASE MERGE YOUR CHANGES');
625
- return [3 /*break*/, 8];
626
- case 8:
627
- this._exit();
628
- return [2 /*return*/];
629
- }
630
- });
631
- });
632
- };
633
- //#endregion
634
- //#region commands / stash
635
- /**
636
- * stash only staged files
637
- */
638
- BaseCommandLine.prototype.stash = function () {
639
- return tslib_1.__awaiter(this, void 0, void 0, function () {
640
- return tslib_1.__generator(this, function (_a) {
641
- switch (_a.label) {
642
- case 0:
643
- index_1.Helpers.info("Stashing only staged files...");
644
- return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
645
- case 1:
646
- if (!(_a.sent())) {
647
- return [2 /*return*/];
648
- }
649
- this.project.git.stash({ onlyStaged: true });
650
- this._exit();
651
- return [2 /*return*/];
652
- }
653
- });
654
- });
655
- };
656
- //#endregion
657
- //#region commands / stash all
658
- /**
659
- * stash all files
660
- */
661
- BaseCommandLine.prototype.stashAll = function () {
662
- return tslib_1.__awaiter(this, void 0, void 0, function () {
663
- return tslib_1.__generator(this, function (_a) {
664
- switch (_a.label) {
665
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
666
- case 1:
667
- if (!(_a.sent())) {
668
- return [2 /*return*/];
669
- }
670
- this.project.git.stageAllFiles();
671
- this.project.git.stash({ onlyStaged: false });
672
- this._exit();
673
- return [2 /*return*/];
674
- }
675
- });
676
- });
677
- };
678
- //#endregion
679
- //#region commands / push all origins
680
- /**
681
- * push force to all orgins
682
- */
683
- BaseCommandLine.prototype.pushAllForce = function () {
684
- return tslib_1.__awaiter(this, void 0, void 0, function () {
685
- return tslib_1.__generator(this, function (_a) {
686
- switch (_a.label) {
687
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
688
- case 1:
689
- if (!(_a.sent())) {
690
- return [2 /*return*/];
691
- }
692
- return [4 /*yield*/, this.pushAll(true)];
693
- case 2:
694
- _a.sent();
695
- return [2 /*return*/];
696
- }
697
- });
698
- });
699
- };
700
- BaseCommandLine.prototype.pAllForce = function () {
701
- return tslib_1.__awaiter(this, void 0, void 0, function () {
702
- return tslib_1.__generator(this, function (_a) {
703
- switch (_a.label) {
704
- case 0: return [4 /*yield*/, this.pushAllForce()];
705
- case 1:
706
- _a.sent();
707
- return [2 /*return*/];
708
- }
709
- });
710
- });
711
- };
712
- BaseCommandLine.prototype.pAllf = function () {
713
- return tslib_1.__awaiter(this, void 0, void 0, function () {
714
- return tslib_1.__generator(this, function (_a) {
715
- switch (_a.label) {
716
- case 0: return [4 /*yield*/, this.pushAllForce()];
717
- case 1:
718
- _a.sent();
719
- return [2 /*return*/];
720
- }
721
- });
722
- });
723
- };
724
- BaseCommandLine.prototype.pAll = function () {
725
- return tslib_1.__awaiter(this, void 0, void 0, function () {
726
- return tslib_1.__generator(this, function (_a) {
727
- switch (_a.label) {
728
- case 0: return [4 /*yield*/, this.pushAll()];
729
- case 1:
730
- _a.sent();
731
- return [2 /*return*/];
732
- }
733
- });
734
- });
735
- };
736
- /**
737
- * push to all origins
738
- */
739
- BaseCommandLine.prototype.pushAll = function () {
740
- return tslib_1.__awaiter(this, arguments, void 0, function (force) {
741
- var remotes, index, _a, origin_1, url;
742
- if (force === void 0) { force = false; }
743
- return tslib_1.__generator(this, function (_b) {
744
- switch (_b.label) {
745
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
746
- case 1:
747
- if (!(_b.sent())) {
748
- return [2 /*return*/];
749
- }
750
- remotes = this.project.git.allOrigins;
751
- index_1.Helpers.info("\n\n Remotes for repo:\n\n".concat(remotes.map(function (r, i) { return "".concat(i + 1, ". ").concat(r.origin, " ").concat(r.url); }).join('\n'), "\n\n"));
752
- index = 0;
753
- _b.label = 2;
754
- case 2:
755
- if (!(index < remotes.length)) return [3 /*break*/, 5];
756
- _a = remotes[index], origin_1 = _a.origin, url = _a.url;
757
- index_1.Helpers.taskStarted("Pushing to ".concat(tnp_core_1.chalk.bold(origin_1), " (").concat(url, ")..."));
758
- return [4 /*yield*/, this.push({ force: force, origin: origin_1, noExit: true })];
759
- case 3:
760
- _b.sent();
761
- index_1.Helpers.taskDone("Pushed to ".concat(origin_1));
762
- _b.label = 4;
763
- case 4:
764
- index++;
765
- return [3 /*break*/, 2];
766
- case 5:
767
- this._exit();
768
- return [2 /*return*/];
769
- }
770
- });
771
- });
772
- };
773
- //#endregion
774
- //#region commands / push force
775
- BaseCommandLine.prototype.forcePush = function () {
776
- return tslib_1.__awaiter(this, void 0, void 0, function () {
777
- return tslib_1.__generator(this, function (_a) {
778
- switch (_a.label) {
779
- case 0: return [4 /*yield*/, this.push({ force: true, typeofCommit: 'feature' })];
780
- case 1:
781
- _a.sent();
782
- return [2 /*return*/];
783
- }
784
- });
785
- });
786
- };
787
- BaseCommandLine.prototype.pushForce = function () {
788
- return tslib_1.__awaiter(this, void 0, void 0, function () {
789
- return tslib_1.__generator(this, function (_a) {
790
- switch (_a.label) {
791
- case 0: return [4 /*yield*/, this.push({ force: true, typeofCommit: 'feature' })];
792
- case 1:
793
- _a.sent();
794
- return [2 /*return*/];
795
- }
796
- });
797
- });
798
- };
799
- //#endregion
800
- //#region commands / commit
801
- /**
802
- * Commit and push this for single repo
803
- */
804
- BaseCommandLine.prototype.commit = function () {
805
- return tslib_1.__awaiter(this, arguments, void 0, function (options) {
806
- var _this = this;
807
- if (options === void 0) { options = {}; }
808
- return tslib_1.__generator(this, function (_a) {
809
- switch (_a.label) {
810
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
811
- case 1:
812
- if (!(_a.sent())) {
813
- return [2 /*return*/];
814
- }
815
- return [4 /*yield*/, this.project.git.meltActionCommits()];
816
- case 2:
817
- _a.sent();
818
- return [4 /*yield*/, this.project.git.pushProcess(tslib_1.__assign(tslib_1.__assign({}, options), { forcePushNoQuestion: options.force, args: this.args, exitCallBack: function () {
819
- _this._exit();
820
- }, skipChildren: true, overrideCommitMessage: this.args.join(' '), setOrigin: this.params['setOrigin'], currentOrigin: this.project.git.originURL }))];
821
- case 3:
822
- _a.sent();
823
- if (options.noExit) {
824
- return [2 /*return*/];
825
- }
826
- this._exit();
827
- return [2 /*return*/];
828
- }
829
- });
830
- });
831
- };
832
- //#endregion
833
- //#region commands / push
834
- BaseCommandLine.prototype._preventPushPullFromNotCorrectBranch = function () {
835
- return tslib_1.__awaiter(this, void 0, void 0, function () {
836
- var _loop_1, this_1, state_1;
837
- return tslib_1.__generator(this, function (_a) {
838
- switch (_a.label) {
839
- case 0:
840
- _loop_1 = function () {
841
- var devBranch, options_1, res;
842
- return tslib_1.__generator(this, function (_b) {
843
- switch (_b.label) {
844
- case 0:
845
- devBranch = this_1.project.git.duringPushWarnIfProjectNotOnSpecyficDevBranch();
846
- if (!(!!devBranch && devBranch !== this_1.project.git.currentBranchName)) return [3 /*break*/, 2];
847
- index_1.Helpers.warn("\n\n ".concat(this_1.project.genericName, "\n\n You are not on ").concat(devBranch, " branch. Please switch to this branch and try again\n\n\n\n "), false);
848
- options_1 = {
849
- open: { name: 'Open in vscode' },
850
- continue: { name: 'Continue (check again)' },
851
- continueForce: { name: 'Continue (without checking)' },
852
- exit: { name: 'Exit process' },
853
- };
854
- return [4 /*yield*/, index_1.Helpers.selectChoicesAsk('What you want to do ?', Object.keys(options_1).map(function (k) {
855
- return { name: options_1[k].name, value: k };
856
- }))];
857
- case 1:
858
- res = _b.sent();
859
- if (res === 'continue') {
860
- return [2 /*return*/, "continue"];
861
- }
862
- if (res === 'exit') {
863
- this_1._exit();
864
- }
865
- if (res === 'open') {
866
- this_1.project.run('code . ').sync();
867
- return [2 /*return*/, "continue"];
868
- }
869
- if (res === 'continueForce') {
870
- return [2 /*return*/, { value: void 0 }];
871
- }
872
- _b.label = 2;
873
- case 2: return [2 /*return*/, { value: void 0 }];
874
- }
875
- });
876
- };
877
- this_1 = this;
878
- _a.label = 1;
879
- case 1:
880
- if (!true) return [3 /*break*/, 3];
881
- return [5 /*yield**/, _loop_1()];
882
- case 2:
883
- state_1 = _a.sent();
884
- if (typeof state_1 === "object")
885
- return [2 /*return*/, state_1.value];
886
- return [3 /*break*/, 1];
887
- case 3: return [2 /*return*/];
888
- }
889
- });
890
- });
891
- };
892
- BaseCommandLine.prototype.qPush = function () {
893
- return tslib_1.__awaiter(this, void 0, void 0, function () {
894
- return tslib_1.__generator(this, function (_a) {
895
- switch (_a.label) {
896
- case 0: return [4 /*yield*/, this.quickPush()];
897
- case 1:
898
- _a.sent();
899
- return [2 /*return*/];
900
- }
901
- });
902
- });
903
- };
904
- BaseCommandLine.prototype.quickPush = function () {
905
- return tslib_1.__awaiter(this, void 0, void 0, function () {
906
- return tslib_1.__generator(this, function (_a) {
907
- switch (_a.label) {
908
- case 0: return [4 /*yield*/, this.push({ skipLint: true })];
909
- case 1:
910
- _a.sent();
911
- return [2 /*return*/];
912
- }
913
- });
914
- });
915
- };
916
- BaseCommandLine.prototype.push = function () {
917
- return tslib_1.__awaiter(this, arguments, void 0, function (options) {
918
- var _this = this;
919
- if (options === void 0) { options = {}; }
920
- return tslib_1.__generator(this, function (_a) {
921
- switch (_a.label) {
922
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
923
- case 1:
924
- // console.log('args', this.args);
925
- // console.log(`argsWithParams "${this.argsWithParams}"` );
926
- if (!(_a.sent())) {
927
- return [2 /*return*/];
928
- }
929
- return [4 /*yield*/, this._preventPushPullFromNotCorrectBranch()];
930
- case 2:
931
- _a.sent();
932
- return [4 /*yield*/, this.project.git.pushProcess(tslib_1.__assign(tslib_1.__assign({}, options), { forcePushNoQuestion: options.force, args: (options === null || options === void 0 ? void 0 : options.overrideCommitMessage)
933
- ? ((options === null || options === void 0 ? void 0 : options.overrideCommitMessage) || '').split(' ')
934
- : this.args, exitCallBack: function () {
935
- _this._exit();
936
- }, setOrigin: this.params['setOrigin'], currentOrigin: this.project.git.originURL }))];
937
- case 3:
938
- _a.sent();
939
- if (options.noExit) {
940
- return [2 /*return*/];
941
- }
942
- this._exit();
943
- return [2 /*return*/];
944
- }
945
- });
946
- });
947
- };
948
- //#endregion
949
- //#region commands / melt
950
- BaseCommandLine.prototype.melt = function () {
951
- return tslib_1.__awaiter(this, void 0, void 0, function () {
952
- return tslib_1.__generator(this, function (_a) {
953
- switch (_a.label) {
954
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
955
- case 1:
956
- if (!(_a.sent())) {
957
- return [2 /*return*/];
958
- }
959
- return [4 /*yield*/, this.meltUpdateCommits(true)];
960
- case 2:
961
- _a.sent();
962
- this._exit();
963
- return [2 /*return*/];
964
- }
965
- });
966
- });
967
- };
968
- //#endregion
969
- //#region commands / melt updat ecommits
970
- BaseCommandLine.prototype.meltUpdateCommits = function () {
971
- return tslib_1.__awaiter(this, arguments, void 0, function (hideInfo) {
972
- if (hideInfo === void 0) { hideInfo = false; }
973
- return tslib_1.__generator(this, function (_a) {
974
- switch (_a.label) {
975
- case 0:
976
- if (!(this.project.git.meltActionCommits() > 0)) return [3 /*break*/, 2];
977
- if (!!hideInfo) return [3 /*break*/, 2];
978
- this.project.git.stageAllFiles();
979
- return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Update commits has been reset. Continue with changes ?')];
980
- case 1:
981
- if (!(_a.sent())) {
982
- this._exit();
983
- }
984
- _a.label = 2;
985
- case 2: return [2 /*return*/];
986
- }
987
- });
988
- });
989
- };
990
- //#endregion
991
- //#region commands / push feature
992
- BaseCommandLine.prototype.pf = function () {
993
- return tslib_1.__awaiter(this, void 0, void 0, function () {
994
- return tslib_1.__generator(this, function (_a) {
995
- switch (_a.label) {
996
- case 0: return [4 /*yield*/, this.pushFeature()];
997
- case 1:
998
- _a.sent();
999
- return [2 /*return*/];
1000
- }
1001
- });
1002
- });
1003
- };
1004
- BaseCommandLine.prototype.pRel = function () {
1005
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1006
- return tslib_1.__generator(this, function (_a) {
1007
- switch (_a.label) {
1008
- case 0: return [4 /*yield*/, this.pushRelease()];
1009
- case 1:
1010
- _a.sent();
1011
- return [2 /*return*/];
1012
- }
1013
- });
1014
- });
1015
- };
1016
- BaseCommandLine.prototype.pRelease = function () {
1017
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1018
- return tslib_1.__generator(this, function (_a) {
1019
- switch (_a.label) {
1020
- case 0: return [4 /*yield*/, this.pushRelease()];
1021
- case 1:
1022
- _a.sent();
1023
- return [2 /*return*/];
1024
- }
1025
- });
1026
- });
1027
- };
1028
- BaseCommandLine.prototype.pushRelease = function () {
1029
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1030
- return tslib_1.__generator(this, function (_a) {
1031
- switch (_a.label) {
1032
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1033
- case 1:
1034
- _a.sent();
1035
- return [4 /*yield*/, this.push({
1036
- typeofCommit: 'release',
1037
- commitMessageRequired: true,
1038
- overrideCommitMessage: "".concat(tnp_core_1._.first(this.project.releaseProcess.getReleaseWords()), " ") +
1039
- "version ".concat(this.project.npmHelpers.version),
1040
- })];
1041
- case 2:
1042
- _a.sent();
1043
- return [2 /*return*/];
1044
- }
1045
- });
1046
- });
1047
- };
1048
- BaseCommandLine.prototype.mPush = function () {
1049
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1050
- return tslib_1.__generator(this, function (_a) {
1051
- switch (_a.label) {
1052
- case 0: return [4 /*yield*/, this.meltPush()];
1053
- case 1:
1054
- _a.sent();
1055
- return [2 /*return*/];
1056
- }
1057
- });
1058
- });
1059
- };
1060
- BaseCommandLine.prototype.fmPush = function () {
1061
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1062
- return tslib_1.__generator(this, function (_a) {
1063
- switch (_a.label) {
1064
- case 0: return [4 /*yield*/, this.forceMeltPush()];
1065
- case 1:
1066
- _a.sent();
1067
- return [2 /*return*/];
1068
- }
1069
- });
1070
- });
1071
- };
1072
- BaseCommandLine.prototype.mfPush = function () {
1073
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1074
- return tslib_1.__generator(this, function (_a) {
1075
- switch (_a.label) {
1076
- case 0: return [4 /*yield*/, this.forceMeltPush()];
1077
- case 1:
1078
- _a.sent();
1079
- return [2 /*return*/];
1080
- }
1081
- });
1082
- });
1083
- };
1084
- BaseCommandLine.prototype.mforcePush = function () {
1085
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1086
- return tslib_1.__generator(this, function (_a) {
1087
- switch (_a.label) {
1088
- case 0: return [4 /*yield*/, this.forceMeltPush()];
1089
- case 1:
1090
- _a.sent();
1091
- return [2 /*return*/];
1092
- }
1093
- });
1094
- });
1095
- };
1096
- BaseCommandLine.prototype.meltforcePush = function () {
1097
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1098
- return tslib_1.__generator(this, function (_a) {
1099
- switch (_a.label) {
1100
- case 0: return [4 /*yield*/, this.forceMeltPush()];
1101
- case 1:
1102
- _a.sent();
1103
- return [2 /*return*/];
1104
- }
1105
- });
1106
- });
1107
- };
1108
- BaseCommandLine.prototype.forceMeltPush = function () {
1109
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1110
- return tslib_1.__generator(this, function (_a) {
1111
- switch (_a.label) {
1112
- case 0: return [4 /*yield*/, this.meltPush(true)];
1113
- case 1:
1114
- _a.sent();
1115
- return [2 /*return*/];
1116
- }
1117
- });
1118
- });
1119
- };
1120
- BaseCommandLine.prototype.meltPush = function () {
1121
- return tslib_1.__awaiter(this, arguments, void 0, function (force) {
1122
- if (force === void 0) { force = false; }
1123
- return tslib_1.__generator(this, function (_a) {
1124
- switch (_a.label) {
1125
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1126
- case 1:
1127
- _a.sent();
1128
- return [4 /*yield*/, this.push({
1129
- mergeUpdateCommits: true,
1130
- force: force,
1131
- })];
1132
- case 2:
1133
- _a.sent();
1134
- return [2 /*return*/];
1135
- }
1136
- });
1137
- });
1138
- };
1139
- BaseCommandLine.prototype.pushFeature = function () {
1140
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1141
- return tslib_1.__generator(this, function (_a) {
1142
- switch (_a.label) {
1143
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1144
- case 1:
1145
- _a.sent();
1146
- return [4 /*yield*/, this.push({ typeofCommit: 'feature', commitMessageRequired: true })];
1147
- case 2:
1148
- _a.sent();
1149
- return [2 /*return*/];
1150
- }
1151
- });
1152
- });
1153
- };
1154
- //#endregion
1155
- //#region commands / push fix
1156
- BaseCommandLine.prototype.pushFix = function () {
1157
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1158
- return tslib_1.__generator(this, function (_a) {
1159
- switch (_a.label) {
1160
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1161
- case 1:
1162
- _a.sent();
1163
- return [4 /*yield*/, this.push({ typeofCommit: 'bugfix', commitMessageRequired: true })];
1164
- case 2:
1165
- _a.sent();
1166
- return [2 /*return*/];
1167
- }
1168
- });
1169
- });
1170
- };
1171
- BaseCommandLine.prototype.pfix = function () {
1172
- this.pushFix();
1173
- };
1174
- //#endregion
1175
- //#region commands / push chore
1176
- BaseCommandLine.prototype.pushChore = function () {
1177
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1178
- return tslib_1.__generator(this, function (_a) {
1179
- switch (_a.label) {
1180
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1181
- case 1:
1182
- _a.sent();
1183
- return [4 /*yield*/, this.push({ typeofCommit: 'chore', commitMessageRequired: true })];
1184
- case 2:
1185
- _a.sent();
1186
- return [2 /*return*/];
1187
- }
1188
- });
1189
- });
1190
- };
1191
- BaseCommandLine.prototype.pc = function () {
1192
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1193
- return tslib_1.__generator(this, function (_a) {
1194
- switch (_a.label) {
1195
- case 0: return [4 /*yield*/, this.pushChore()];
1196
- case 1:
1197
- _a.sent();
1198
- return [2 /*return*/];
1199
- }
1200
- });
1201
- });
1202
- };
1203
- //#endregion
1204
- //#region commands / push refactor
1205
- BaseCommandLine.prototype.pushRefactor = function () {
1206
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1207
- return tslib_1.__generator(this, function (_a) {
1208
- switch (_a.label) {
1209
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1210
- case 1:
1211
- _a.sent();
1212
- return [4 /*yield*/, this.push({ typeofCommit: 'refactor', commitMessageRequired: true })];
1213
- case 2:
1214
- _a.sent();
1215
- return [2 /*return*/];
1216
- }
1217
- });
1218
- });
1219
- };
1220
- BaseCommandLine.prototype.pushref = function () {
1221
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1222
- return tslib_1.__generator(this, function (_a) {
1223
- switch (_a.label) {
1224
- case 0: return [4 /*yield*/, this.pushRefactor()];
1225
- case 1:
1226
- _a.sent();
1227
- return [2 /*return*/];
1228
- }
1229
- });
1230
- });
1231
- };
1232
- BaseCommandLine.prototype.pref = function () {
1233
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1234
- return tslib_1.__generator(this, function (_a) {
1235
- switch (_a.label) {
1236
- case 0: return [4 /*yield*/, this.pushRefactor()];
1237
- case 1:
1238
- _a.sent();
1239
- return [2 /*return*/];
1240
- }
1241
- });
1242
- });
1243
- };
1244
- //#endregion
1245
- //#region commands / push style
1246
- BaseCommandLine.prototype.pushStyle = function () {
1247
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1248
- return tslib_1.__generator(this, function (_a) {
1249
- switch (_a.label) {
1250
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1251
- case 1:
1252
- _a.sent();
1253
- return [4 /*yield*/, this.push({ typeofCommit: 'style', commitMessageRequired: true })];
1254
- case 2:
1255
- _a.sent();
1256
- return [2 /*return*/];
1257
- }
1258
- });
1259
- });
1260
- };
1261
- BaseCommandLine.prototype.pstyl = function () {
1262
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1263
- return tslib_1.__generator(this, function (_a) {
1264
- switch (_a.label) {
1265
- case 0: return [4 /*yield*/, this.pushStyle()];
1266
- case 1:
1267
- _a.sent();
1268
- return [2 /*return*/];
1269
- }
1270
- });
1271
- });
1272
- };
1273
- BaseCommandLine.prototype.pstyle = function () {
1274
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1275
- return tslib_1.__generator(this, function (_a) {
1276
- switch (_a.label) {
1277
- case 0: return [4 /*yield*/, this.pushStyle()];
1278
- case 1:
1279
- _a.sent();
1280
- return [2 /*return*/];
1281
- }
1282
- });
1283
- });
1284
- };
1285
- //#endregion
1286
- //#region commands / push docs
1287
- BaseCommandLine.prototype.pushDocs = function () {
1288
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1289
- return tslib_1.__generator(this, function (_a) {
1290
- switch (_a.label) {
1291
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1292
- case 1:
1293
- _a.sent();
1294
- return [4 /*yield*/, this.push({ typeofCommit: 'docs', commitMessageRequired: true })];
1295
- case 2:
1296
- _a.sent();
1297
- return [2 /*return*/];
1298
- }
1299
- });
1300
- });
1301
- };
1302
- BaseCommandLine.prototype.pd = function () {
1303
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1304
- return tslib_1.__generator(this, function (_a) {
1305
- switch (_a.label) {
1306
- case 0: return [4 /*yield*/, this.pushDocs()];
1307
- case 1:
1308
- _a.sent();
1309
- return [2 /*return*/];
1310
- }
1311
- });
1312
- });
1313
- };
1314
- BaseCommandLine.prototype.pdocs = function () {
1315
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1316
- return tslib_1.__generator(this, function (_a) {
1317
- switch (_a.label) {
1318
- case 0: return [4 /*yield*/, this.pushDocs()];
1319
- case 1:
1320
- _a.sent();
1321
- return [2 /*return*/];
1322
- }
1323
- });
1324
- });
1325
- };
1326
- //#endregion
1327
- //#region commands / push test
1328
- BaseCommandLine.prototype.pushTest = function () {
1329
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1330
- return tslib_1.__generator(this, function (_a) {
1331
- switch (_a.label) {
1332
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1333
- case 1:
1334
- _a.sent();
1335
- return [4 /*yield*/, this.push({ typeofCommit: 'test', commitMessageRequired: true })];
1336
- case 2:
1337
- _a.sent();
1338
- return [2 /*return*/];
1339
- }
1340
- });
1341
- });
1342
- };
1343
- BaseCommandLine.prototype.pTest = function () {
1344
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1345
- return tslib_1.__generator(this, function (_a) {
1346
- switch (_a.label) {
1347
- case 0: return [4 /*yield*/, this.pushTest()];
1348
- case 1:
1349
- _a.sent();
1350
- return [2 /*return*/];
1351
- }
1352
- });
1353
- });
1354
- };
1355
- BaseCommandLine.prototype.pTests = function () {
1356
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1357
- return tslib_1.__generator(this, function (_a) {
1358
- switch (_a.label) {
1359
- case 0: return [4 /*yield*/, this.pushTest()];
1360
- case 1:
1361
- _a.sent();
1362
- return [2 /*return*/];
1363
- }
1364
- });
1365
- });
1366
- };
1367
- //#endregion
1368
- //#region commands / push perf
1369
- BaseCommandLine.prototype.pushPerf = function () {
1370
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1371
- return tslib_1.__generator(this, function (_a) {
1372
- switch (_a.label) {
1373
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1374
- case 1:
1375
- _a.sent();
1376
- return [4 /*yield*/, this.push({
1377
- typeofCommit: 'performance',
1378
- commitMessageRequired: true,
1379
- })];
1380
- case 2:
1381
- _a.sent();
1382
- return [2 /*return*/];
1383
- }
1384
- });
1385
- });
1386
- };
1387
- //#endregion
1388
- //#region commands / push ci
1389
- BaseCommandLine.prototype.pushCi = function () {
1390
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1391
- return tslib_1.__generator(this, function (_a) {
1392
- switch (_a.label) {
1393
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1394
- case 1:
1395
- _a.sent();
1396
- return [4 /*yield*/, this.push({ typeofCommit: 'ci', commitMessageRequired: true })];
1397
- case 2:
1398
- _a.sent();
1399
- return [2 /*return*/];
1400
- }
1401
- });
1402
- });
1403
- };
1404
- //#endregion
1405
- //#region commands / select branch
1406
- BaseCommandLine.prototype.branch = function () {
1407
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1408
- var branchName, branches;
1409
- return tslib_1.__generator(this, function (_a) {
1410
- switch (_a.label) {
1411
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1412
- case 1:
1413
- if (!(_a.sent())) {
1414
- return [2 /*return*/];
1415
- }
1416
- return [4 /*yield*/, this.project.struct()];
1417
- case 2:
1418
- _a.sent();
1419
- branchName = this.firstArg;
1420
- branches = this.__filterBranchesByPattern(branchName);
1421
- if (!(branches.length > 0)) return [3 /*break*/, 4];
1422
- return [4 /*yield*/, this.__selectBrach(branches, 'checkout')];
1423
- case 3:
1424
- branchName = _a.sent();
1425
- return [3 /*break*/, 5];
1426
- case 4:
1427
- index_1.Helpers.error("No branch found by name \"".concat(branchName, "\""), false, true);
1428
- _a.label = 5;
1429
- case 5:
1430
- this.project.git.checkout(branchName);
1431
- this._exit();
1432
- return [2 /*return*/];
1433
- }
1434
- });
1435
- });
1436
- };
1437
- //#endregion
1438
- //#region commands / push build
1439
- BaseCommandLine.prototype.pushBuild = function () {
1440
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1441
- return tslib_1.__generator(this, function (_a) {
1442
- switch (_a.label) {
1443
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1444
- case 1:
1445
- _a.sent();
1446
- return [4 /*yield*/, this.push({ typeofCommit: 'build', commitMessageRequired: true })];
1447
- case 2:
1448
- _a.sent();
1449
- return [2 /*return*/];
1450
- }
1451
- });
1452
- });
1453
- };
1454
- //#endregion
1455
- //#region commands / set origin
1456
- BaseCommandLine.prototype.SET_ORIGIN = function () {
1457
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1458
- var newOriginNameOrUrl, proj;
1459
- return tslib_1.__generator(this, function (_a) {
1460
- switch (_a.label) {
1461
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1462
- case 1:
1463
- if (!(_a.sent())) {
1464
- return [2 /*return*/];
1465
- }
1466
- newOriginNameOrUrl = this.firstArg;
1467
- proj = this.project;
1468
- if (proj && proj.git.isInsideGitRepo) {
1469
- proj.run("git remote rm origin").sync();
1470
- proj.run("git remote add origin ".concat(newOriginNameOrUrl, " ")).sync();
1471
- index_1.Helpers.info("Done");
1472
- }
1473
- else {
1474
- index_1.Helpers.error("This folder is not a git repo... ", false, true);
1475
- }
1476
- this._exit();
1477
- return [2 /*return*/];
1478
- }
1479
- });
1480
- });
1481
- };
1482
- //#endregion
1483
- //#region commands / rename origin
1484
- BaseCommandLine.prototype.RENAME_ORIGIN = function () {
1485
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1486
- var newOriginNameOrUrl, proj;
1487
- return tslib_1.__generator(this, function (_a) {
1488
- switch (_a.label) {
1489
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1490
- case 1:
1491
- if (!(_a.sent())) {
1492
- return [2 /*return*/];
1493
- }
1494
- newOriginNameOrUrl = this.firstArg;
1495
- proj = this.project;
1496
- if (proj && proj.git.isInsideGitRepo) {
1497
- proj.git.renameOrigin(newOriginNameOrUrl);
1498
- }
1499
- else {
1500
- index_1.Helpers.error("This folder is not a git repo... ", false, true);
1501
- }
1502
- this._exit();
1503
- return [2 /*return*/];
1504
- }
1505
- });
1506
- });
1507
- };
1508
- //#endregion
1509
- //#region commands / last hash tag
1510
- BaseCommandLine.prototype.LAST_TAG_HASH = function () {
1511
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1512
- return tslib_1.__generator(this, function (_a) {
1513
- switch (_a.label) {
1514
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1515
- case 1:
1516
- if (!(_a.sent())) {
1517
- return [2 /*return*/];
1518
- }
1519
- index_1.Helpers.info(this.project.git.lastTagHash());
1520
- this._exit();
1521
- return [2 /*return*/];
1522
- }
1523
- });
1524
- });
1525
- };
1526
- //#endregion
1527
- //#region commands / last tag
1528
- BaseCommandLine.prototype.LAST_TAG = function () {
1529
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1530
- var proj;
1531
- return tslib_1.__generator(this, function (_a) {
1532
- switch (_a.label) {
1533
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1534
- case 1:
1535
- if (!(_a.sent())) {
1536
- return [2 /*return*/];
1537
- }
1538
- proj = this.project;
1539
- index_1.Helpers.info("\n\n last tag: ".concat(proj.git.lastTagVersionName, "\n last tag hash: ").concat(proj.git.lastTagHash(), "\n\n"));
1540
- this._exit();
1541
- return [2 /*return*/];
1542
- }
1543
- });
1544
- });
1545
- };
1546
- //#endregion
1547
- //#region commands / check tag exists
1548
- BaseCommandLine.prototype.CHECK_TAG_EXISTS = function () {
1549
- index_1.Helpers.info("tag \"".concat(this.firstArg, "\" exits = ").concat(index_1.Helpers.git.checkTagExists(this.firstArg), " "));
1550
- this._exit();
1551
- };
1552
- //#endregion
1553
- //#region commands / lint
1554
- /**
1555
- * TODO move somewhere
1556
- */
1557
- BaseCommandLine.prototype.lint = function () {
1558
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1559
- return tslib_1.__generator(this, function (_a) {
1560
- switch (_a.label) {
1561
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1562
- case 1:
1563
- if (!(_a.sent())) {
1564
- return [2 /*return*/];
1565
- }
1566
- return [4 /*yield*/, this.project.lint()];
1567
- case 2:
1568
- _a.sent();
1569
- return [2 /*return*/];
1570
- }
1571
- });
1572
- });
1573
- };
1574
- //#endregion
1575
- //#region commands / version
1576
- /**
1577
- * TODO move somewhere
1578
- */
1579
- BaseCommandLine.prototype.version = function () {
1580
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1581
- return tslib_1.__generator(this, function (_a) {
1582
- switch (_a.label) {
1583
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
1584
- case 1:
1585
- if (!(_a.sent())) {
1586
- return [2 /*return*/];
1587
- }
1588
- console.log('Current project verison: ' + this.project.npmHelpers.version);
1589
- this._exit();
1590
- return [2 /*return*/];
1591
- }
1592
- });
1593
- });
1594
- };
1595
- //#endregion
1596
- //#region commands / init
1597
- /**
1598
- * TODO move somewhere
1599
- */
1600
- BaseCommandLine.prototype.init = function () {
1601
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1602
- return tslib_1.__generator(this, function (_a) {
1603
- switch (_a.label) {
1604
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
1605
- case 1:
1606
- if (!(_a.sent())) {
1607
- return [2 /*return*/];
1608
- }
1609
- return [4 /*yield*/, this.project.init()];
1610
- case 2:
1611
- _a.sent();
1612
- this._exit();
1613
- return [2 /*return*/];
1614
- }
1615
- });
1616
- });
1617
- };
1618
- /**
1619
- * init parent and first level children
1620
- */
1621
- BaseCommandLine.prototype.initAll = function () {
1622
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1623
- var _a, _b, child, e_3_1;
1624
- var e_3, _c;
1625
- return tslib_1.__generator(this, function (_d) {
1626
- switch (_d.label) {
1627
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
1628
- case 1:
1629
- if (!(_d.sent())) {
1630
- return [2 /*return*/];
1631
- }
1632
- return [4 /*yield*/, this.project.init()];
1633
- case 2:
1634
- _d.sent();
1635
- _d.label = 3;
1636
- case 3:
1637
- _d.trys.push([3, 8, 9, 10]);
1638
- _a = tslib_1.__values(this.project.children), _b = _a.next();
1639
- _d.label = 4;
1640
- case 4:
1641
- if (!!_b.done) return [3 /*break*/, 7];
1642
- child = _b.value;
1643
- return [4 /*yield*/, child.init()];
1644
- case 5:
1645
- _d.sent();
1646
- _d.label = 6;
1647
- case 6:
1648
- _b = _a.next();
1649
- return [3 /*break*/, 4];
1650
- case 7: return [3 /*break*/, 10];
1651
- case 8:
1652
- e_3_1 = _d.sent();
1653
- e_3 = { error: e_3_1 };
1654
- return [3 /*break*/, 10];
1655
- case 9:
1656
- try {
1657
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
1658
- }
1659
- finally { if (e_3) throw e_3.error; }
1660
- return [7 /*endfinally*/];
1661
- case 10:
1662
- this._exit();
1663
- return [2 /*return*/];
1664
- }
1665
- });
1666
- });
1667
- };
1668
- //#endregion
1669
- //#region commands / struct
1670
- /**
1671
- * TODO move somewhere
1672
- */
1673
- BaseCommandLine.prototype.struct = function () {
1674
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1675
- return tslib_1.__generator(this, function (_a) {
1676
- switch (_a.label) {
1677
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
1678
- case 1:
1679
- if (!(_a.sent())) {
1680
- return [2 /*return*/];
1681
- }
1682
- return [4 /*yield*/, this.project.struct()];
1683
- case 2:
1684
- _a.sent();
1685
- this._exit();
1686
- return [2 /*return*/];
1687
- }
1688
- });
1689
- });
1690
- };
1691
- //#endregion
1692
- //#region commands / info
1693
- /**
1694
- * TODO move somewhere
1695
- */
1696
- BaseCommandLine.prototype.info = function () {
1697
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1698
- return tslib_1.__generator(this, function (_a) {
1699
- switch (_a.label) {
1700
- case 0: return [4 /*yield*/, this.cwdIsProject({
1701
- requireProjectWithGitRoot: false,
1702
- })];
1703
- case 1:
1704
- if (!(_a.sent())) {
1705
- return [2 /*return*/];
1706
- }
1707
- index_1.Helpers.clearConsole();
1708
- return [4 /*yield*/, this.project.info()];
1709
- case 2:
1710
- _a.sent();
1711
- return [4 /*yield*/, this.project.linkedProjects.saveAllLinkedProjectsToDB()];
1712
- case 3:
1713
- _a.sent();
1714
- this._exit();
1715
- return [2 /*return*/];
1716
- }
1717
- });
1718
- });
1719
- };
1720
- //#endregion
1721
- //#region commands / info
1722
- BaseCommandLine.prototype.modified = function () {
1723
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1724
- var proj, libs;
1725
- return tslib_1.__generator(this, function (_a) {
1726
- switch (_a.label) {
1727
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1728
- case 1:
1729
- if (!(_a.sent())) {
1730
- return [2 /*return*/];
1731
- }
1732
- proj = this.project;
1733
- libs = proj.children.filter(function (child) {
1734
- process.stdout.write('.');
1735
- return child.git.thereAreSomeUncommitedChangeExcept([
1736
- tnp_config_2.config.file.package_json,
1737
- ]);
1738
- });
1739
- console.log('\n' + index_1.Helpers.terminalLine());
1740
- index_1.Helpers.info(libs.length
1741
- ? libs
1742
- .map(function (c) {
1743
- return "".concat(tnp_core_1.chalk.bold(c.name), " (").concat(c.git.uncommitedFiles.map(function (p) { return tnp_core_1.chalk.black(tnp_core_1.path.basename(p)); }).join(', '), ")");
1744
- })
1745
- .join('\n')
1746
- : 'Nothing modifed');
1747
- this._exit();
1748
- return [2 /*return*/];
1749
- }
1750
- });
1751
- });
1752
- };
1753
- //#endregion
1754
- //#region commands / update
1755
- BaseCommandLine.prototype.UPDATE = function () {
1756
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1757
- var linkedProjects;
1758
- var _this = this;
1759
- return tslib_1.__generator(this, function (_a) {
1760
- switch (_a.label) {
1761
- case 0:
1762
- linkedProjects = index_1.LinkedProject.detect(this.project.location).filter(function (linkedProj) {
1763
- return _this.project.ins.From([
1764
- _this.project.location,
1765
- linkedProj.relativeClonePath,
1766
- ]);
1767
- });
1768
- return [4 /*yield*/, index_1.Helpers.questionYesNo("\n\n Deteced project:\n".concat(linkedProjects.map(function (l) { return "- ".concat(l.relativeClonePath); }).join('\n'), "\n\n\nWould you like to update current project configuration?"))];
1769
- case 1:
1770
- if (_a.sent()) {
1771
- this.project.linkedProjects.addLinkedProjects(linkedProjects);
1772
- }
1773
- return [4 /*yield*/, this.project.init()];
1774
- case 2:
1775
- _a.sent();
1776
- index_1.Helpers.info("Linked projects updated");
1777
- this._exit(0);
1778
- return [2 /*return*/];
1779
- }
1780
- });
1781
- });
1782
- };
1783
- //#endregion
1784
- //#region commands / changes
1785
- BaseCommandLine.prototype.changes = function () {
1786
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1787
- var _a, _b, _c, _d, chil, _e, _f, e_4_1;
1788
- var e_4, _g;
1789
- return tslib_1.__generator(this, function (_h) {
1790
- switch (_h.label) {
1791
- case 0:
1792
- _b = (_a = index_1.Helpers).info;
1793
- return [4 /*yield*/, this.project.git.changesSummary()];
1794
- case 1:
1795
- _b.apply(_a, [_h.sent()]);
1796
- index_1.Helpers.terminalLine();
1797
- _h.label = 2;
1798
- case 2:
1799
- _h.trys.push([2, 7, 8, 9]);
1800
- _c = tslib_1.__values(this.project.children), _d = _c.next();
1801
- _h.label = 3;
1802
- case 3:
1803
- if (!!_d.done) return [3 /*break*/, 6];
1804
- chil = _d.value;
1805
- _f = (_e = index_1.Helpers).info;
1806
- return [4 /*yield*/, chil.git.changesSummary()];
1807
- case 4:
1808
- _f.apply(_e, [_h.sent()]);
1809
- _h.label = 5;
1810
- case 5:
1811
- _d = _c.next();
1812
- return [3 /*break*/, 3];
1813
- case 6: return [3 /*break*/, 9];
1814
- case 7:
1815
- e_4_1 = _h.sent();
1816
- e_4 = { error: e_4_1 };
1817
- return [3 /*break*/, 9];
1818
- case 8:
1819
- try {
1820
- if (_d && !_d.done && (_g = _c.return)) _g.call(_c);
1821
- }
1822
- finally { if (e_4) throw e_4.error; }
1823
- return [7 /*endfinally*/];
1824
- case 9:
1825
- this._exit();
1826
- return [2 /*return*/];
1827
- }
1828
- });
1829
- });
1830
- };
1831
- //#endregion
1832
- //#region commands / branch name
1833
- BaseCommandLine.prototype.BRANCH_NAME = function () {
1834
- console.log("current branch name: \"".concat(index_1.Helpers.git.currentBranchName(process.cwd()), "\""));
1835
- this._exit();
1836
- };
1837
- //#endregion
1838
- //#region commands / remotes
1839
- BaseCommandLine.prototype.REMOTES = function () {
1840
- console.log(index_1.Helpers.git.allOrigins(this.cwd));
1841
- this._exit();
1842
- };
1843
- BaseCommandLine.prototype.SET_REMOTE_SSH = function () {
1844
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1845
- return tslib_1.__generator(this, function (_a) {
1846
- switch (_a.label) {
1847
- case 0: return [4 /*yield*/, index_1.Helpers.git.changeRemoteFromHttpsToSSh(this.cwd)];
1848
- case 1:
1849
- _a.sent();
1850
- this._exit();
1851
- return [2 /*return*/];
1852
- }
1853
- });
1854
- });
1855
- };
1856
- BaseCommandLine.prototype.SET_REMOTE_http = function () {
1857
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1858
- return tslib_1.__generator(this, function (_a) {
1859
- switch (_a.label) {
1860
- case 0: return [4 /*yield*/, index_1.Helpers.git.changeRemoveFromSshToHttps(this.cwd)];
1861
- case 1:
1862
- _a.sent();
1863
- this._exit();
1864
- return [2 /*return*/];
1865
- }
1866
- });
1867
- });
1868
- };
1869
- BaseCommandLine.prototype.SET_REMOTE_https = function () {
1870
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1871
- return tslib_1.__generator(this, function (_a) {
1872
- switch (_a.label) {
1873
- case 0: return [4 /*yield*/, this.SET_REMOTE_http()];
1874
- case 1:
1875
- _a.sent();
1876
- return [2 /*return*/];
1877
- }
1878
- });
1879
- });
1880
- };
1881
- BaseCommandLine.prototype._resolveChildFromArg = function () {
1882
- var _this = this;
1883
- var _a = index_1.Helpers.cliTool.resolveItemFromArgsBegin(this.args, function (arg) {
1884
- return _this.ins.From([_this.cwd, arg]);
1885
- }), projFromArg = _a.resolved, clearedCommand = _a.clearedCommand;
1886
- if (!!projFromArg) {
1887
- this.args = clearedCommand.split(' ');
1888
- this.cwd = projFromArg.location;
1889
- this.project = projFromArg;
1890
- }
1891
- };
1892
- BaseCommandLine.prototype.origin = function () {
1893
- this._resolveChildFromArg();
1894
- console.log(index_1.Helpers.git.getOriginURL(this.cwd));
1895
- this._exit();
1896
- };
1897
- BaseCommandLine.prototype.remote = function () {
1898
- console.log(index_1.Helpers.git.getOriginURL(this.cwd));
1899
- this._exit();
1900
- };
1901
- BaseCommandLine.prototype.originHttp = function () {
1902
- console.log(index_1.Helpers.git.originSshToHttp(index_1.Helpers.git.getOriginURL(this.cwd)));
1903
- this._exit();
1904
- };
1905
- BaseCommandLine.prototype.originHttps = function () {
1906
- console.log(index_1.Helpers.git.originSshToHttp(index_1.Helpers.git.getOriginURL(this.cwd)));
1907
- this._exit();
1908
- };
1909
- BaseCommandLine.prototype.originssh = function () {
1910
- console.log(index_1.Helpers.git.originHttpToSsh(index_1.Helpers.git.getOriginURL(this.cwd)));
1911
- this._exit();
1912
- };
1913
- BaseCommandLine.prototype.origins = function () {
1914
- this.REMOTES();
1915
- };
1916
- //#endregion
1917
- //#region commands / git config
1918
- BaseCommandLine.prototype.gitConfig = function () {
1919
- var root = index_1.Helpers.git.findGitRoot(this.cwd);
1920
- index_1.Helpers.run("code ".concat((0, tnp_core_2.crossPlatformPath)([root, '.git', 'config']))).sync();
1921
- this._exit();
1922
- };
1923
- //#endregion
1924
- //#region commands / lastCommitHash
1925
- BaseCommandLine.prototype.LAST_COMMIT_HASH = function () {
1926
- console.log(index_1.Helpers.git.lastCommitHash(this.cwd));
1927
- this._exit();
1928
- };
1929
- //#endregion
1930
- //#region commands / commit message by hash
1931
- BaseCommandLine.prototype.COMMIT_MESSAGE_BY_HASH = function () {
1932
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1933
- var hash, _a, _b;
1934
- return tslib_1.__generator(this, function (_c) {
1935
- switch (_c.label) {
1936
- case 0:
1937
- hash = this.firstArg;
1938
- _b = (_a = console).log;
1939
- return [4 /*yield*/, this.project.git.getCommitMessageByHash(hash)];
1940
- case 1:
1941
- _b.apply(_a, [_c.sent()]);
1942
- this._exit();
1943
- return [2 /*return*/];
1944
- }
1945
- });
1946
- });
1947
- };
1948
- //#endregion
1949
- //#region commands / last 5 commit hashes
1950
- BaseCommandLine.prototype.LAST_5_COMMITS = function () {
1951
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1952
- var index, hash;
1953
- return tslib_1.__generator(this, function (_a) {
1954
- switch (_a.label) {
1955
- case 0:
1956
- index = 0;
1957
- _a.label = 1;
1958
- case 1:
1959
- if (!(index < 5)) return [3 /*break*/, 4];
1960
- return [4 /*yield*/, this.project.git.getCommitHashByIndex(index)];
1961
- case 2:
1962
- hash = _a.sent();
1963
- console.log(hash);
1964
- _a.label = 3;
1965
- case 3:
1966
- index++;
1967
- return [3 /*break*/, 1];
1968
- case 4:
1969
- this._exit();
1970
- return [2 /*return*/];
1971
- }
1972
- });
1973
- });
1974
- };
1975
- //#endregion
1976
- //#region commands / update deps from
1977
- BaseCommandLine.prototype.updateDepsFrom = function () {
1978
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1979
- var locations;
1980
- var _this = this;
1981
- return tslib_1.__generator(this, function (_a) {
1982
- locations = this.args.join(' ').trim() === '' ? [] : this.args;
1983
- if (tnp_core_1._.isArray(locations)) {
1984
- locations = locations.map(function (l) {
1985
- if (tnp_core_1.path.isAbsolute(l)) {
1986
- return tnp_core_1.path.resolve(l);
1987
- }
1988
- return tnp_core_1.path.resolve(tnp_core_1.path.join(_this.cwd, l));
1989
- });
1990
- }
1991
- this.project.npmHelpers.updateDepsFrom(locations);
1992
- this._exit();
1993
- return [2 /*return*/];
1994
- });
1995
- });
1996
- };
1997
- //#endregion
1998
- //#region is terminal supported
1999
- BaseCommandLine.prototype.isTerminalSupported = function () {
2000
- console.log("Terminal is supported: ".concat(index_1.Helpers.isSupportedTaonTerminal));
2001
- this._exit();
2002
- };
2003
- //#endregion
2004
- //#region prox ext
2005
- BaseCommandLine.prototype.INSTALL_PROJECT_EXTENSIONS = function () {
2006
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2007
- return tslib_1.__generator(this, function (_a) {
2008
- switch (_a.label) {
2009
- case 0: return [4 /*yield*/, this.INSTALL_PROJ_EXT()];
2010
- case 1:
2011
- _a.sent();
2012
- return [2 /*return*/];
2013
- }
2014
- });
2015
- });
2016
- };
2017
- BaseCommandLine.prototype.INSTALL_PROJECT_EXT = function () {
2018
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2019
- return tslib_1.__generator(this, function (_a) {
2020
- switch (_a.label) {
2021
- case 0: return [4 /*yield*/, this.INSTALL_PROJ_EXT()];
2022
- case 1:
2023
- _a.sent();
2024
- return [2 /*return*/];
2025
- }
2026
- });
2027
- });
2028
- };
2029
- BaseCommandLine.prototype.INS_PROJ_EXT = function () {
2030
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2031
- return tslib_1.__generator(this, function (_a) {
2032
- switch (_a.label) {
2033
- case 0: return [4 /*yield*/, this.INSTALL_PROJ_EXT()];
2034
- case 1:
2035
- _a.sent();
2036
- return [2 /*return*/];
2037
- }
2038
- });
2039
- });
2040
- };
2041
- BaseCommandLine.prototype.INSTALL_PROJ_EXT = function () {
2042
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2043
- var p, extensions, menuItems, extensionsToInstall, index, extname;
2044
- return tslib_1.__generator(this, function (_a) {
2045
- switch (_a.label) {
2046
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
2047
- case 1:
2048
- if (!(_a.sent())) {
2049
- return [2 /*return*/];
2050
- }
2051
- this.project.vsCodeHelpers.recreateExtensions();
2052
- p = this.project.pathFor('.vscode/extensions.json');
2053
- extensions = index_1.Helpers.readJson(p, { recommendations: [] }, true);
2054
- menuItems = extensions.recommendations.map(function (r) {
2055
- return { name: r, value: r, enabled: true, selected: true };
2056
- });
2057
- extensionsToInstall = [];
2058
- _a.label = 2;
2059
- case 2:
2060
- if (!true) return [3 /*break*/, 5];
2061
- index_1.Helpers.clearConsole();
2062
- return [4 /*yield*/, index_1.Helpers.consoleGui.multiselect('Select extensions to install', menuItems, true, menuItems)];
2063
- case 3:
2064
- extensionsToInstall = _a.sent();
2065
- index_1.Helpers.info(extensionsToInstall.join(', '));
2066
- return [4 /*yield*/, index_1.Helpers.questionYesNo("Install extensions ?")];
2067
- case 4:
2068
- if (!(_a.sent())) {
2069
- return [3 /*break*/, 2];
2070
- }
2071
- return [3 /*break*/, 5];
2072
- case 5:
2073
- for (index = 0; index < extensionsToInstall.length; index++) {
2074
- extname = extensionsToInstall[index];
2075
- try {
2076
- index_1.Helpers.taskStarted("Installing: ".concat(extname));
2077
- index_1.Helpers.run("code --install-extension ".concat(extname)).sync();
2078
- index_1.Helpers.taskDone("Installed: ".concat(extname));
2079
- }
2080
- catch (error) {
2081
- index_1.Helpers.warn("Not able to install ".concat(extname));
2082
- index_1.Helpers.pressKeyOrWait('Press any key to continue...');
2083
- }
2084
- }
2085
- index_1.Helpers.info('Done installing');
2086
- this._exit();
2087
- return [2 /*return*/];
2088
- }
2089
- });
2090
- });
2091
- };
2092
- //#endregion
2093
- //#region proj db
2094
- BaseCommandLine.prototype.projdb = function () {
2095
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2096
- return tslib_1.__generator(this, function (_a) {
2097
- switch (_a.label) {
2098
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
2099
- case 1:
2100
- if (!(_a.sent())) {
2101
- return [2 /*return*/];
2102
- }
2103
- index_1.Helpers.info("Projects db location:\n ".concat(this.project.linkedProjects.projectsDbLocation, "\n\n opening in vscode...\n\n "));
2104
- index_1.Helpers.run("code ".concat(this.project.linkedProjects.projectsDbLocation)).sync();
2105
- this._exit();
2106
- return [2 /*return*/];
2107
- }
2108
- });
2109
- });
2110
- };
2111
- //#endregion
2112
- //#region filter all project branches by pattern
2113
- BaseCommandLine.prototype.__filterBranchesByPattern = function (branchPatternOrBranchName) {
2114
- var branches = index_1.Helpers.arrays.uniqArray(this.project.git.getBranchesNamesBy(branchPatternOrBranchName) ||
2115
- this.project.getMainBranches());
2116
- // console.log('branches', branches);
2117
- return branches;
2118
- };
2119
- //#endregion
2120
- //#region select branch from list of branches
2121
- BaseCommandLine.prototype.__selectBrach = function (branches, task) {
2122
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2123
- var childrenMsg;
2124
- return tslib_1.__generator(this, function (_a) {
2125
- switch (_a.label) {
2126
- case 0:
2127
- childrenMsg = this.project.children.length == 0
2128
- ? '(no children in project)'
2129
- : '(with children)';
2130
- return [4 /*yield*/, index_1.Helpers.autocompleteAsk("Choose branch to ".concat(task, " in this project ").concat(childrenMsg, ": "), branches.map(function (b) {
2131
- return { name: b, value: b };
2132
- }))];
2133
- case 1: return [2 /*return*/, _a.sent()];
2134
- }
2135
- });
2136
- });
2137
- };
2138
- //#endregion
2139
- //#region commands / clone
2140
- BaseCommandLine.prototype.clone = function () {
2141
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2142
- var url, originType;
2143
- return tslib_1.__generator(this, function (_a) {
2144
- url = this.firstArg;
2145
- originType = this.params['setOrigin'];
2146
- if (originType) {
2147
- if (originType === 'ssh') {
2148
- url = index_1.Helpers.git.originHttpToSsh(url);
2149
- }
2150
- if (originType === 'http') {
2151
- url = index_1.Helpers.git.originSshToHttp(url);
2152
- }
2153
- }
2154
- index_1.Helpers.git.clone({
2155
- url: url,
2156
- cwd: this.cwd,
2157
- });
2158
- this._exit();
2159
- return [2 /*return*/];
2160
- });
2161
- });
2162
- };
2163
- //#endregion
2164
- //#region commands / ghtemp
2165
- BaseCommandLine.prototype.ghSave = function () {
2166
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2167
- return tslib_1.__generator(this, function (_a) {
2168
- switch (_a.label) {
2169
- case 0: return [4 /*yield*/, new gh_temp_code_1.GhTempCode(this.cwd, this.project).init().save()];
2170
- case 1:
2171
- _a.sent();
2172
- this._exit();
2173
- return [2 /*return*/];
2174
- }
2175
- });
2176
- });
2177
- };
2178
- BaseCommandLine.prototype.ghRestore = function () {
2179
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2180
- return tslib_1.__generator(this, function (_a) {
2181
- switch (_a.label) {
2182
- case 0: return [4 /*yield*/, new gh_temp_code_1.GhTempCode(this.cwd, this.project).init().restore()];
2183
- case 1:
2184
- _a.sent();
2185
- this._exit();
2186
- return [2 /*return*/];
2187
- }
2188
- });
2189
- });
2190
- };
2191
- //#endregion
2192
- //#region commands / start cli service ports worker
2193
- BaseCommandLine.prototype.startCliServicePortsWorker = function () {
2194
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2195
- return tslib_1.__generator(this, function (_a) {
2196
- switch (_a.label) {
2197
- case 0: return [4 /*yield*/, this.ins.portsWorker.cliStartProcedure(this.params)];
2198
- case 1:
2199
- _a.sent();
2200
- return [2 /*return*/];
2201
- }
2202
- });
2203
- });
2204
- };
2205
- //#endregion
2206
- //#region commands / pause terminal
2207
- BaseCommandLine.prototype.pauseTerminal = function () {
2208
- index_1.Helpers.pressKeyAndContinue();
2209
- this._exit();
2210
- };
2211
- //#endregion
2212
- //#region commands / gh pages init
2213
- BaseCommandLine.prototype.ghPagesInit = function () {
2214
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2215
- return tslib_1.__generator(this, function (_a) {
2216
- switch (_a.label) {
2217
- case 0: return [4 /*yield*/, this.project.init()];
2218
- case 1:
2219
- _a.sent();
2220
- return [4 /*yield*/, this.project.githubPages.init(this.params['provider'] || 'github', !!this.params['full'])];
2221
- case 2:
2222
- _a.sent();
2223
- index_1.Helpers.run('code .', {
2224
- cwd: this.project.githubPages.mainFolderAbsPath,
2225
- }).sync();
2226
- this._exit();
2227
- return [2 /*return*/];
2228
- }
2229
- });
2230
- });
2231
- };
2232
- return BaseCommandLine;
2233
- }(command_line_feature_backend_1.CommandLineFeature));
2234
- exports.BaseCommandLine = BaseCommandLine;
2235
- //# sourceMappingURL=base-command-line.backend.js.map