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,2221 +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
- //#region commands / reset
458
- BaseCommandLine.prototype.__resetInfo = function (branchToReset) {
459
- 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
460
- ? "- modules:\n".concat(this.project.children
461
- .map(function (c) { return "\t".concat(c.basename, " (").concat(tnp_core_1.chalk.yellow(c.name), ")"); })
462
- .join('\n'))
463
- : '', "\n "));
464
- };
465
- BaseCommandLine.prototype.fetch = function () {
466
- return tslib_1.__awaiter(this, void 0, void 0, function () {
467
- var _a, _b;
468
- return tslib_1.__generator(this, function (_c) {
469
- try {
470
- (_b = (_a = this.project) === null || _a === void 0 ? void 0 : _a.git) === null || _b === void 0 ? void 0 : _b.fetch();
471
- }
472
- catch (error) { }
473
- this._exit();
474
- return [2 /*return*/];
475
- });
476
- });
477
- };
478
- BaseCommandLine.prototype.reset = function () {
479
- return tslib_1.__awaiter(this, void 0, void 0, function () {
480
- var parent, branchFromLinkedProjectConfig, overrideBranchToReset, resetOnlyChildren, branches, resetProject, res;
481
- var _this = this;
482
- var _a, _b, _c, _d, _e;
483
- return tslib_1.__generator(this, function (_f) {
484
- switch (_f.label) {
485
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
486
- case 1:
487
- // Helpers.clearConsole();
488
- if (!(_f.sent())) {
489
- return [2 /*return*/];
490
- }
491
- parent = this.project.parent;
492
- branchFromLinkedProjectConfig = (_b = (_a = parent === null || parent === void 0 ? void 0 : parent.linkedProjects) === null || _a === void 0 ? void 0 : _a.linkedProjects.find(function (l) {
493
- return ((0, tnp_core_2.crossPlatformPath)([parent.location, l.relativeClonePath]) ===
494
- _this.project.location);
495
- })) === null || _b === void 0 ? void 0 : _b.deafultBranch;
496
- overrideBranchToReset = this.firstArg ||
497
- branchFromLinkedProjectConfig ||
498
- ((_c = this.project.core) === null || _c === void 0 ? void 0 : _c.branch) ||
499
- this.project.getDefaultDevelopmentBranch() ||
500
- this.project.git.currentBranchName;
501
- if ((_d = this.project.core) === null || _d === void 0 ? void 0 : _d.branch) {
502
- 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 "));
503
- }
504
- resetOnlyChildren = !!this.project.linkedProjects.getLinkedProjectsConfig().resetOnlyChildren;
505
- branches = index_1.Helpers.uniqArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(this.__filterBranchesByPattern(overrideBranchToReset)), false), tslib_1.__read(this.__filterBranchesByPattern('')), false));
506
- if (!resetOnlyChildren) return [3 /*break*/, 2];
507
- index_1.Helpers.info("Reseting only children...for defualt branches.");
508
- return [3 /*break*/, 5];
509
- case 2:
510
- if (!(branches.length > 0)) return [3 /*break*/, 4];
511
- return [4 /*yield*/, this.__selectBrach(branches, 'reset')];
512
- case 3:
513
- overrideBranchToReset = _f.sent();
514
- return [3 /*break*/, 5];
515
- case 4:
516
- index_1.Helpers.error("No branch found by name \"".concat(overrideBranchToReset || this.firstArg, "\""), false, true);
517
- _f.label = 5;
518
- case 5:
519
- overrideBranchToReset = overrideBranchToReset || '';
520
- this.__resetInfo(overrideBranchToReset
521
- ? overrideBranchToReset
522
- : this.project.getDefaultDevelopmentBranch());
523
- resetProject = this.project;
524
- if (!(this.project.git.isInsideGitRepo && !this.project.git.isGitRoot)) return [3 /*break*/, 7];
525
- index_1.Helpers.warn("You are not in root of git repo...", false);
526
- resetProject = this.ins.nearestTo((0, tnp_core_2.crossPlatformPath)([this.project.location, '..']), {
527
- findGitRoot: true,
528
- });
529
- 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), ") ?"))];
530
- case 6:
531
- if (!(_f.sent())) {
532
- index_1.Helpers.error("Aborted", false, true);
533
- }
534
- _f.label = 7;
535
- case 7: return [4 /*yield*/, index_1.Helpers.questionYesNo("Reset hard and pull current project " +
536
- "".concat(resetProject.linkedProjects.linkedProjects.length > 0 ? '(and children)' : '', " ?"))];
537
- case 8:
538
- res = _f.sent();
539
- if (!res) return [3 /*break*/, 10];
540
- return [4 /*yield*/, resetProject.resetProcess(overrideBranchToReset)];
541
- case 9:
542
- _f.sent();
543
- _f.label = 10;
544
- case 10:
545
- this._exit();
546
- return [2 /*return*/];
547
- }
548
- });
549
- });
550
- };
551
- //#endregion
552
- //#region commands / soft
553
- BaseCommandLine.prototype.soft = function () {
554
- return tslib_1.__awaiter(this, void 0, void 0, function () {
555
- return tslib_1.__generator(this, function (_a) {
556
- switch (_a.label) {
557
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
558
- case 1:
559
- // TODO when aciton commit
560
- if (!(_a.sent())) {
561
- return [2 /*return*/];
562
- }
563
- this.project.git.resetSoftHEAD(1);
564
- this._exit();
565
- return [2 /*return*/];
566
- }
567
- });
568
- });
569
- };
570
- //#endregion
571
- //#region commands / rebase
572
- BaseCommandLine.prototype.rebase = function () {
573
- return tslib_1.__awaiter(this, void 0, void 0, function () {
574
- var currentBranch, safeReset, rebaseBranch, branches, error_3;
575
- return tslib_1.__generator(this, function (_a) {
576
- switch (_a.label) {
577
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
578
- case 1:
579
- if (!(_a.sent())) {
580
- return [2 /*return*/];
581
- }
582
- currentBranch = this.project.git.currentBranchName;
583
- safeReset = 10;
584
- rebaseBranch = this.firstArg || this.project.getDefaultDevelopmentBranch();
585
- branches = this.__filterBranchesByPattern(rebaseBranch);
586
- if (!(branches.length > 0)) return [3 /*break*/, 3];
587
- return [4 /*yield*/, this.__selectBrach(branches, 'reset')];
588
- case 2:
589
- rebaseBranch = _a.sent();
590
- return [3 /*break*/, 4];
591
- case 3:
592
- index_1.Helpers.error("No branch found by name \"".concat(rebaseBranch, "\""), false, true);
593
- _a.label = 4;
594
- case 4:
595
- _a.trys.push([4, 6, , 8]);
596
- this.project
597
- .run("git reset--hard && git checkout ".concat(rebaseBranch, " && git reset--hard HEAD~").concat(safeReset, " && git pull origin ").concat(rebaseBranch, " ") +
598
- "&& 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 })
599
- .sync();
600
- return [4 /*yield*/, this.project.init()];
601
- case 5:
602
- _a.sent();
603
- index_1.Helpers.info('REBASE DONE');
604
- return [3 /*break*/, 8];
605
- case 6:
606
- error_3 = _a.sent();
607
- return [4 /*yield*/, this.project.init()];
608
- case 7:
609
- _a.sent();
610
- index_1.Helpers.warn('PLEASE MERGE YOUR CHANGES');
611
- return [3 /*break*/, 8];
612
- case 8:
613
- this._exit();
614
- return [2 /*return*/];
615
- }
616
- });
617
- });
618
- };
619
- //#endregion
620
- //#region commands / stash
621
- /**
622
- * stash only staged files
623
- */
624
- BaseCommandLine.prototype.stash = function () {
625
- return tslib_1.__awaiter(this, void 0, void 0, function () {
626
- return tslib_1.__generator(this, function (_a) {
627
- switch (_a.label) {
628
- case 0:
629
- index_1.Helpers.info("Stashing only staged files...");
630
- return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
631
- case 1:
632
- if (!(_a.sent())) {
633
- return [2 /*return*/];
634
- }
635
- this.project.git.stash({ onlyStaged: true });
636
- this._exit();
637
- return [2 /*return*/];
638
- }
639
- });
640
- });
641
- };
642
- //#endregion
643
- //#region commands / stash all
644
- /**
645
- * stash all files
646
- */
647
- BaseCommandLine.prototype.stashAll = function () {
648
- return tslib_1.__awaiter(this, void 0, void 0, function () {
649
- return tslib_1.__generator(this, function (_a) {
650
- switch (_a.label) {
651
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
652
- case 1:
653
- if (!(_a.sent())) {
654
- return [2 /*return*/];
655
- }
656
- this.project.git.stageAllFiles();
657
- this.project.git.stash({ onlyStaged: false });
658
- this._exit();
659
- return [2 /*return*/];
660
- }
661
- });
662
- });
663
- };
664
- //#endregion
665
- //#region commands / push all origins
666
- /**
667
- * push force to all orgins
668
- */
669
- BaseCommandLine.prototype.pushAllForce = function () {
670
- return tslib_1.__awaiter(this, void 0, void 0, function () {
671
- return tslib_1.__generator(this, function (_a) {
672
- switch (_a.label) {
673
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
674
- case 1:
675
- if (!(_a.sent())) {
676
- return [2 /*return*/];
677
- }
678
- return [4 /*yield*/, this.pushAll(true)];
679
- case 2:
680
- _a.sent();
681
- return [2 /*return*/];
682
- }
683
- });
684
- });
685
- };
686
- BaseCommandLine.prototype.pAllForce = function () {
687
- return tslib_1.__awaiter(this, void 0, void 0, function () {
688
- return tslib_1.__generator(this, function (_a) {
689
- switch (_a.label) {
690
- case 0: return [4 /*yield*/, this.pushAllForce()];
691
- case 1:
692
- _a.sent();
693
- return [2 /*return*/];
694
- }
695
- });
696
- });
697
- };
698
- BaseCommandLine.prototype.pAllf = function () {
699
- return tslib_1.__awaiter(this, void 0, void 0, function () {
700
- return tslib_1.__generator(this, function (_a) {
701
- switch (_a.label) {
702
- case 0: return [4 /*yield*/, this.pushAllForce()];
703
- case 1:
704
- _a.sent();
705
- return [2 /*return*/];
706
- }
707
- });
708
- });
709
- };
710
- BaseCommandLine.prototype.pAll = function () {
711
- return tslib_1.__awaiter(this, void 0, void 0, function () {
712
- return tslib_1.__generator(this, function (_a) {
713
- switch (_a.label) {
714
- case 0: return [4 /*yield*/, this.pushAll()];
715
- case 1:
716
- _a.sent();
717
- return [2 /*return*/];
718
- }
719
- });
720
- });
721
- };
722
- /**
723
- * push to all origins
724
- */
725
- BaseCommandLine.prototype.pushAll = function () {
726
- return tslib_1.__awaiter(this, arguments, void 0, function (force) {
727
- var remotes, index, _a, origin_1, url;
728
- if (force === void 0) { force = false; }
729
- return tslib_1.__generator(this, function (_b) {
730
- switch (_b.label) {
731
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
732
- case 1:
733
- if (!(_b.sent())) {
734
- return [2 /*return*/];
735
- }
736
- remotes = this.project.git.allOrigins;
737
- 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"));
738
- index = 0;
739
- _b.label = 2;
740
- case 2:
741
- if (!(index < remotes.length)) return [3 /*break*/, 5];
742
- _a = remotes[index], origin_1 = _a.origin, url = _a.url;
743
- index_1.Helpers.taskStarted("Pushing to ".concat(tnp_core_1.chalk.bold(origin_1), " (").concat(url, ")..."));
744
- return [4 /*yield*/, this.push({ force: force, origin: origin_1, noExit: true })];
745
- case 3:
746
- _b.sent();
747
- index_1.Helpers.taskDone("Pushed to ".concat(origin_1));
748
- _b.label = 4;
749
- case 4:
750
- index++;
751
- return [3 /*break*/, 2];
752
- case 5:
753
- this._exit();
754
- return [2 /*return*/];
755
- }
756
- });
757
- });
758
- };
759
- //#endregion
760
- //#region commands / push force
761
- BaseCommandLine.prototype.forcePush = function () {
762
- return tslib_1.__awaiter(this, void 0, void 0, function () {
763
- return tslib_1.__generator(this, function (_a) {
764
- switch (_a.label) {
765
- case 0: return [4 /*yield*/, this.push({ force: true, typeofCommit: 'feature' })];
766
- case 1:
767
- _a.sent();
768
- return [2 /*return*/];
769
- }
770
- });
771
- });
772
- };
773
- BaseCommandLine.prototype.pushForce = function () {
774
- return tslib_1.__awaiter(this, void 0, void 0, function () {
775
- return tslib_1.__generator(this, function (_a) {
776
- switch (_a.label) {
777
- case 0: return [4 /*yield*/, this.push({ force: true, typeofCommit: 'feature' })];
778
- case 1:
779
- _a.sent();
780
- return [2 /*return*/];
781
- }
782
- });
783
- });
784
- };
785
- //#endregion
786
- //#region commands / commit
787
- /**
788
- * Commit and push this for single repo
789
- */
790
- BaseCommandLine.prototype.commit = function () {
791
- return tslib_1.__awaiter(this, arguments, void 0, function (options) {
792
- var _this = this;
793
- if (options === void 0) { options = {}; }
794
- return tslib_1.__generator(this, function (_a) {
795
- switch (_a.label) {
796
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
797
- case 1:
798
- if (!(_a.sent())) {
799
- return [2 /*return*/];
800
- }
801
- return [4 /*yield*/, this.project.git.meltActionCommits()];
802
- case 2:
803
- _a.sent();
804
- return [4 /*yield*/, this.project.git.pushProcess(tslib_1.__assign(tslib_1.__assign({}, options), { forcePushNoQuestion: options.force, args: this.args, exitCallBack: function () {
805
- _this._exit();
806
- }, skipChildren: true, overrideCommitMessage: this.args.join(' '), setOrigin: this.params['setOrigin'], currentOrigin: this.project.git.originURL }))];
807
- case 3:
808
- _a.sent();
809
- if (options.noExit) {
810
- return [2 /*return*/];
811
- }
812
- this._exit();
813
- return [2 /*return*/];
814
- }
815
- });
816
- });
817
- };
818
- //#endregion
819
- //#region commands / push
820
- BaseCommandLine.prototype._preventPushPullFromNotCorrectBranch = function () {
821
- return tslib_1.__awaiter(this, void 0, void 0, function () {
822
- var _loop_1, this_1, state_1;
823
- return tslib_1.__generator(this, function (_a) {
824
- switch (_a.label) {
825
- case 0:
826
- _loop_1 = function () {
827
- var devBranch, options_1, res;
828
- return tslib_1.__generator(this, function (_b) {
829
- switch (_b.label) {
830
- case 0:
831
- devBranch = this_1.project.git.duringPushWarnIfProjectNotOnSpecyficDevBranch();
832
- if (!(!!devBranch && devBranch !== this_1.project.git.currentBranchName)) return [3 /*break*/, 2];
833
- 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);
834
- options_1 = {
835
- open: { name: 'Open in vscode' },
836
- continue: { name: 'Continue (check again)' },
837
- continueForce: { name: 'Continue (without checking)' },
838
- exit: { name: 'Exit process' },
839
- };
840
- return [4 /*yield*/, index_1.Helpers.selectChoicesAsk('What you want to do ?', Object.keys(options_1).map(function (k) {
841
- return { name: options_1[k].name, value: k };
842
- }))];
843
- case 1:
844
- res = _b.sent();
845
- if (res === 'continue') {
846
- return [2 /*return*/, "continue"];
847
- }
848
- if (res === 'exit') {
849
- this_1._exit();
850
- }
851
- if (res === 'open') {
852
- this_1.project.run('code . ').sync();
853
- return [2 /*return*/, "continue"];
854
- }
855
- if (res === 'continueForce') {
856
- return [2 /*return*/, { value: void 0 }];
857
- }
858
- _b.label = 2;
859
- case 2: return [2 /*return*/, { value: void 0 }];
860
- }
861
- });
862
- };
863
- this_1 = this;
864
- _a.label = 1;
865
- case 1:
866
- if (!true) return [3 /*break*/, 3];
867
- return [5 /*yield**/, _loop_1()];
868
- case 2:
869
- state_1 = _a.sent();
870
- if (typeof state_1 === "object")
871
- return [2 /*return*/, state_1.value];
872
- return [3 /*break*/, 1];
873
- case 3: return [2 /*return*/];
874
- }
875
- });
876
- });
877
- };
878
- BaseCommandLine.prototype.qPush = function () {
879
- return tslib_1.__awaiter(this, void 0, void 0, function () {
880
- return tslib_1.__generator(this, function (_a) {
881
- switch (_a.label) {
882
- case 0: return [4 /*yield*/, this.quickPush()];
883
- case 1:
884
- _a.sent();
885
- return [2 /*return*/];
886
- }
887
- });
888
- });
889
- };
890
- BaseCommandLine.prototype.quickPush = function () {
891
- return tslib_1.__awaiter(this, void 0, void 0, function () {
892
- return tslib_1.__generator(this, function (_a) {
893
- switch (_a.label) {
894
- case 0: return [4 /*yield*/, this.push({ skipLint: true })];
895
- case 1:
896
- _a.sent();
897
- return [2 /*return*/];
898
- }
899
- });
900
- });
901
- };
902
- BaseCommandLine.prototype.push = function () {
903
- return tslib_1.__awaiter(this, arguments, void 0, function (options) {
904
- var _this = this;
905
- if (options === void 0) { options = {}; }
906
- return tslib_1.__generator(this, function (_a) {
907
- switch (_a.label) {
908
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
909
- case 1:
910
- // console.log('args', this.args);
911
- // console.log(`argsWithParams "${this.argsWithParams}"` );
912
- if (!(_a.sent())) {
913
- return [2 /*return*/];
914
- }
915
- return [4 /*yield*/, this._preventPushPullFromNotCorrectBranch()];
916
- case 2:
917
- _a.sent();
918
- 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)
919
- ? ((options === null || options === void 0 ? void 0 : options.overrideCommitMessage) || '').split(' ')
920
- : this.args, exitCallBack: function () {
921
- _this._exit();
922
- }, setOrigin: this.params['setOrigin'], currentOrigin: this.project.git.originURL }))];
923
- case 3:
924
- _a.sent();
925
- if (options.noExit) {
926
- return [2 /*return*/];
927
- }
928
- this._exit();
929
- return [2 /*return*/];
930
- }
931
- });
932
- });
933
- };
934
- //#endregion
935
- //#region commands / melt
936
- BaseCommandLine.prototype.melt = function () {
937
- return tslib_1.__awaiter(this, void 0, void 0, function () {
938
- return tslib_1.__generator(this, function (_a) {
939
- switch (_a.label) {
940
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
941
- case 1:
942
- if (!(_a.sent())) {
943
- return [2 /*return*/];
944
- }
945
- return [4 /*yield*/, this.meltUpdateCommits(true)];
946
- case 2:
947
- _a.sent();
948
- this._exit();
949
- return [2 /*return*/];
950
- }
951
- });
952
- });
953
- };
954
- //#endregion
955
- //#region commands / melt updat ecommits
956
- BaseCommandLine.prototype.meltUpdateCommits = function () {
957
- return tslib_1.__awaiter(this, arguments, void 0, function (hideInfo) {
958
- if (hideInfo === void 0) { hideInfo = false; }
959
- return tslib_1.__generator(this, function (_a) {
960
- switch (_a.label) {
961
- case 0:
962
- if (!(this.project.git.meltActionCommits() > 0)) return [3 /*break*/, 2];
963
- if (!!hideInfo) return [3 /*break*/, 2];
964
- this.project.git.stageAllFiles();
965
- return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Update commits has been reset. Continue with changes ?')];
966
- case 1:
967
- if (!(_a.sent())) {
968
- this._exit();
969
- }
970
- _a.label = 2;
971
- case 2: return [2 /*return*/];
972
- }
973
- });
974
- });
975
- };
976
- //#endregion
977
- //#region commands / push feature
978
- BaseCommandLine.prototype.pf = function () {
979
- return tslib_1.__awaiter(this, void 0, void 0, function () {
980
- return tslib_1.__generator(this, function (_a) {
981
- switch (_a.label) {
982
- case 0: return [4 /*yield*/, this.pushFeature()];
983
- case 1:
984
- _a.sent();
985
- return [2 /*return*/];
986
- }
987
- });
988
- });
989
- };
990
- BaseCommandLine.prototype.pRel = function () {
991
- return tslib_1.__awaiter(this, void 0, void 0, function () {
992
- return tslib_1.__generator(this, function (_a) {
993
- switch (_a.label) {
994
- case 0: return [4 /*yield*/, this.pushRelease()];
995
- case 1:
996
- _a.sent();
997
- return [2 /*return*/];
998
- }
999
- });
1000
- });
1001
- };
1002
- BaseCommandLine.prototype.pRelease = function () {
1003
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1004
- return tslib_1.__generator(this, function (_a) {
1005
- switch (_a.label) {
1006
- case 0: return [4 /*yield*/, this.pushRelease()];
1007
- case 1:
1008
- _a.sent();
1009
- return [2 /*return*/];
1010
- }
1011
- });
1012
- });
1013
- };
1014
- BaseCommandLine.prototype.pushRelease = function () {
1015
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1016
- return tslib_1.__generator(this, function (_a) {
1017
- switch (_a.label) {
1018
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1019
- case 1:
1020
- _a.sent();
1021
- return [4 /*yield*/, this.push({
1022
- typeofCommit: 'release',
1023
- commitMessageRequired: true,
1024
- overrideCommitMessage: "".concat(tnp_core_1._.first(this.project.releaseProcess.getReleaseWords()), " ") +
1025
- "version ".concat(this.project.npmHelpers.version),
1026
- })];
1027
- case 2:
1028
- _a.sent();
1029
- return [2 /*return*/];
1030
- }
1031
- });
1032
- });
1033
- };
1034
- BaseCommandLine.prototype.mPush = function () {
1035
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1036
- return tslib_1.__generator(this, function (_a) {
1037
- switch (_a.label) {
1038
- case 0: return [4 /*yield*/, this.meltPush()];
1039
- case 1:
1040
- _a.sent();
1041
- return [2 /*return*/];
1042
- }
1043
- });
1044
- });
1045
- };
1046
- BaseCommandLine.prototype.fmPush = function () {
1047
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1048
- return tslib_1.__generator(this, function (_a) {
1049
- switch (_a.label) {
1050
- case 0: return [4 /*yield*/, this.forceMeltPush()];
1051
- case 1:
1052
- _a.sent();
1053
- return [2 /*return*/];
1054
- }
1055
- });
1056
- });
1057
- };
1058
- BaseCommandLine.prototype.mfPush = function () {
1059
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1060
- return tslib_1.__generator(this, function (_a) {
1061
- switch (_a.label) {
1062
- case 0: return [4 /*yield*/, this.forceMeltPush()];
1063
- case 1:
1064
- _a.sent();
1065
- return [2 /*return*/];
1066
- }
1067
- });
1068
- });
1069
- };
1070
- BaseCommandLine.prototype.mforcePush = function () {
1071
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1072
- return tslib_1.__generator(this, function (_a) {
1073
- switch (_a.label) {
1074
- case 0: return [4 /*yield*/, this.forceMeltPush()];
1075
- case 1:
1076
- _a.sent();
1077
- return [2 /*return*/];
1078
- }
1079
- });
1080
- });
1081
- };
1082
- BaseCommandLine.prototype.meltforcePush = function () {
1083
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1084
- return tslib_1.__generator(this, function (_a) {
1085
- switch (_a.label) {
1086
- case 0: return [4 /*yield*/, this.forceMeltPush()];
1087
- case 1:
1088
- _a.sent();
1089
- return [2 /*return*/];
1090
- }
1091
- });
1092
- });
1093
- };
1094
- BaseCommandLine.prototype.forceMeltPush = function () {
1095
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1096
- return tslib_1.__generator(this, function (_a) {
1097
- switch (_a.label) {
1098
- case 0: return [4 /*yield*/, this.meltPush(true)];
1099
- case 1:
1100
- _a.sent();
1101
- return [2 /*return*/];
1102
- }
1103
- });
1104
- });
1105
- };
1106
- BaseCommandLine.prototype.meltPush = function () {
1107
- return tslib_1.__awaiter(this, arguments, void 0, function (force) {
1108
- if (force === void 0) { force = false; }
1109
- return tslib_1.__generator(this, function (_a) {
1110
- switch (_a.label) {
1111
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1112
- case 1:
1113
- _a.sent();
1114
- return [4 /*yield*/, this.push({
1115
- mergeUpdateCommits: true,
1116
- force: force,
1117
- })];
1118
- case 2:
1119
- _a.sent();
1120
- return [2 /*return*/];
1121
- }
1122
- });
1123
- });
1124
- };
1125
- BaseCommandLine.prototype.pushFeature = function () {
1126
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1127
- return tslib_1.__generator(this, function (_a) {
1128
- switch (_a.label) {
1129
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1130
- case 1:
1131
- _a.sent();
1132
- return [4 /*yield*/, this.push({ typeofCommit: 'feature', commitMessageRequired: true })];
1133
- case 2:
1134
- _a.sent();
1135
- return [2 /*return*/];
1136
- }
1137
- });
1138
- });
1139
- };
1140
- //#endregion
1141
- //#region commands / push fix
1142
- BaseCommandLine.prototype.pushFix = function () {
1143
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1144
- return tslib_1.__generator(this, function (_a) {
1145
- switch (_a.label) {
1146
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1147
- case 1:
1148
- _a.sent();
1149
- return [4 /*yield*/, this.push({ typeofCommit: 'bugfix', commitMessageRequired: true })];
1150
- case 2:
1151
- _a.sent();
1152
- return [2 /*return*/];
1153
- }
1154
- });
1155
- });
1156
- };
1157
- BaseCommandLine.prototype.pfix = function () {
1158
- this.pushFix();
1159
- };
1160
- //#endregion
1161
- //#region commands / push chore
1162
- BaseCommandLine.prototype.pushChore = function () {
1163
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1164
- return tslib_1.__generator(this, function (_a) {
1165
- switch (_a.label) {
1166
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1167
- case 1:
1168
- _a.sent();
1169
- return [4 /*yield*/, this.push({ typeofCommit: 'chore', commitMessageRequired: true })];
1170
- case 2:
1171
- _a.sent();
1172
- return [2 /*return*/];
1173
- }
1174
- });
1175
- });
1176
- };
1177
- BaseCommandLine.prototype.pc = function () {
1178
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1179
- return tslib_1.__generator(this, function (_a) {
1180
- switch (_a.label) {
1181
- case 0: return [4 /*yield*/, this.pushChore()];
1182
- case 1:
1183
- _a.sent();
1184
- return [2 /*return*/];
1185
- }
1186
- });
1187
- });
1188
- };
1189
- //#endregion
1190
- //#region commands / push refactor
1191
- BaseCommandLine.prototype.pushRefactor = 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.meltUpdateCommits()];
1196
- case 1:
1197
- _a.sent();
1198
- return [4 /*yield*/, this.push({ typeofCommit: 'refactor', commitMessageRequired: true })];
1199
- case 2:
1200
- _a.sent();
1201
- return [2 /*return*/];
1202
- }
1203
- });
1204
- });
1205
- };
1206
- BaseCommandLine.prototype.pushref = function () {
1207
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1208
- return tslib_1.__generator(this, function (_a) {
1209
- switch (_a.label) {
1210
- case 0: return [4 /*yield*/, this.pushRefactor()];
1211
- case 1:
1212
- _a.sent();
1213
- return [2 /*return*/];
1214
- }
1215
- });
1216
- });
1217
- };
1218
- BaseCommandLine.prototype.pref = function () {
1219
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1220
- return tslib_1.__generator(this, function (_a) {
1221
- switch (_a.label) {
1222
- case 0: return [4 /*yield*/, this.pushRefactor()];
1223
- case 1:
1224
- _a.sent();
1225
- return [2 /*return*/];
1226
- }
1227
- });
1228
- });
1229
- };
1230
- //#endregion
1231
- //#region commands / push style
1232
- BaseCommandLine.prototype.pushStyle = 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.meltUpdateCommits()];
1237
- case 1:
1238
- _a.sent();
1239
- return [4 /*yield*/, this.push({ typeofCommit: 'style', commitMessageRequired: true })];
1240
- case 2:
1241
- _a.sent();
1242
- return [2 /*return*/];
1243
- }
1244
- });
1245
- });
1246
- };
1247
- BaseCommandLine.prototype.pstyl = function () {
1248
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1249
- return tslib_1.__generator(this, function (_a) {
1250
- switch (_a.label) {
1251
- case 0: return [4 /*yield*/, this.pushStyle()];
1252
- case 1:
1253
- _a.sent();
1254
- return [2 /*return*/];
1255
- }
1256
- });
1257
- });
1258
- };
1259
- BaseCommandLine.prototype.pstyle = function () {
1260
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1261
- return tslib_1.__generator(this, function (_a) {
1262
- switch (_a.label) {
1263
- case 0: return [4 /*yield*/, this.pushStyle()];
1264
- case 1:
1265
- _a.sent();
1266
- return [2 /*return*/];
1267
- }
1268
- });
1269
- });
1270
- };
1271
- //#endregion
1272
- //#region commands / push docs
1273
- BaseCommandLine.prototype.pushDocs = 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.meltUpdateCommits()];
1278
- case 1:
1279
- _a.sent();
1280
- return [4 /*yield*/, this.push({ typeofCommit: 'docs', commitMessageRequired: true })];
1281
- case 2:
1282
- _a.sent();
1283
- return [2 /*return*/];
1284
- }
1285
- });
1286
- });
1287
- };
1288
- BaseCommandLine.prototype.pd = function () {
1289
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1290
- return tslib_1.__generator(this, function (_a) {
1291
- switch (_a.label) {
1292
- case 0: return [4 /*yield*/, this.pushDocs()];
1293
- case 1:
1294
- _a.sent();
1295
- return [2 /*return*/];
1296
- }
1297
- });
1298
- });
1299
- };
1300
- BaseCommandLine.prototype.pdocs = function () {
1301
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1302
- return tslib_1.__generator(this, function (_a) {
1303
- switch (_a.label) {
1304
- case 0: return [4 /*yield*/, this.pushDocs()];
1305
- case 1:
1306
- _a.sent();
1307
- return [2 /*return*/];
1308
- }
1309
- });
1310
- });
1311
- };
1312
- //#endregion
1313
- //#region commands / push test
1314
- BaseCommandLine.prototype.pushTest = 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.meltUpdateCommits()];
1319
- case 1:
1320
- _a.sent();
1321
- return [4 /*yield*/, this.push({ typeofCommit: 'test', commitMessageRequired: true })];
1322
- case 2:
1323
- _a.sent();
1324
- return [2 /*return*/];
1325
- }
1326
- });
1327
- });
1328
- };
1329
- BaseCommandLine.prototype.pTest = function () {
1330
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1331
- return tslib_1.__generator(this, function (_a) {
1332
- switch (_a.label) {
1333
- case 0: return [4 /*yield*/, this.pushTest()];
1334
- case 1:
1335
- _a.sent();
1336
- return [2 /*return*/];
1337
- }
1338
- });
1339
- });
1340
- };
1341
- BaseCommandLine.prototype.pTests = function () {
1342
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1343
- return tslib_1.__generator(this, function (_a) {
1344
- switch (_a.label) {
1345
- case 0: return [4 /*yield*/, this.pushTest()];
1346
- case 1:
1347
- _a.sent();
1348
- return [2 /*return*/];
1349
- }
1350
- });
1351
- });
1352
- };
1353
- //#endregion
1354
- //#region commands / push perf
1355
- BaseCommandLine.prototype.pushPerf = 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.meltUpdateCommits()];
1360
- case 1:
1361
- _a.sent();
1362
- return [4 /*yield*/, this.push({
1363
- typeofCommit: 'performance',
1364
- commitMessageRequired: true,
1365
- })];
1366
- case 2:
1367
- _a.sent();
1368
- return [2 /*return*/];
1369
- }
1370
- });
1371
- });
1372
- };
1373
- //#endregion
1374
- //#region commands / push ci
1375
- BaseCommandLine.prototype.pushCi = function () {
1376
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1377
- return tslib_1.__generator(this, function (_a) {
1378
- switch (_a.label) {
1379
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1380
- case 1:
1381
- _a.sent();
1382
- return [4 /*yield*/, this.push({ typeofCommit: 'ci', commitMessageRequired: true })];
1383
- case 2:
1384
- _a.sent();
1385
- return [2 /*return*/];
1386
- }
1387
- });
1388
- });
1389
- };
1390
- //#endregion
1391
- //#region commands / select branch
1392
- BaseCommandLine.prototype.branch = function () {
1393
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1394
- var branchName, branches;
1395
- return tslib_1.__generator(this, function (_a) {
1396
- switch (_a.label) {
1397
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1398
- case 1:
1399
- if (!(_a.sent())) {
1400
- return [2 /*return*/];
1401
- }
1402
- return [4 /*yield*/, this.project.struct()];
1403
- case 2:
1404
- _a.sent();
1405
- branchName = this.firstArg;
1406
- branches = this.__filterBranchesByPattern(branchName);
1407
- if (!(branches.length > 0)) return [3 /*break*/, 4];
1408
- return [4 /*yield*/, this.__selectBrach(branches, 'checkout')];
1409
- case 3:
1410
- branchName = _a.sent();
1411
- return [3 /*break*/, 5];
1412
- case 4:
1413
- index_1.Helpers.error("No branch found by name \"".concat(branchName, "\""), false, true);
1414
- _a.label = 5;
1415
- case 5:
1416
- this.project.git.checkout(branchName);
1417
- this._exit();
1418
- return [2 /*return*/];
1419
- }
1420
- });
1421
- });
1422
- };
1423
- //#endregion
1424
- //#region commands / push build
1425
- BaseCommandLine.prototype.pushBuild = function () {
1426
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1427
- return tslib_1.__generator(this, function (_a) {
1428
- switch (_a.label) {
1429
- case 0: return [4 /*yield*/, this.meltUpdateCommits()];
1430
- case 1:
1431
- _a.sent();
1432
- return [4 /*yield*/, this.push({ typeofCommit: 'build', commitMessageRequired: true })];
1433
- case 2:
1434
- _a.sent();
1435
- return [2 /*return*/];
1436
- }
1437
- });
1438
- });
1439
- };
1440
- //#endregion
1441
- //#region commands / set origin
1442
- BaseCommandLine.prototype.SET_ORIGIN = function () {
1443
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1444
- var newOriginNameOrUrl, proj;
1445
- return tslib_1.__generator(this, function (_a) {
1446
- switch (_a.label) {
1447
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1448
- case 1:
1449
- if (!(_a.sent())) {
1450
- return [2 /*return*/];
1451
- }
1452
- newOriginNameOrUrl = this.firstArg;
1453
- proj = this.project;
1454
- if (proj && proj.git.isInsideGitRepo) {
1455
- proj.run("git remote rm origin").sync();
1456
- proj.run("git remote add origin ".concat(newOriginNameOrUrl, " ")).sync();
1457
- index_1.Helpers.info("Done");
1458
- }
1459
- else {
1460
- index_1.Helpers.error("This folder is not a git repo... ", false, true);
1461
- }
1462
- this._exit();
1463
- return [2 /*return*/];
1464
- }
1465
- });
1466
- });
1467
- };
1468
- //#endregion
1469
- //#region commands / rename origin
1470
- BaseCommandLine.prototype.RENAME_ORIGIN = function () {
1471
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1472
- var newOriginNameOrUrl, proj;
1473
- return tslib_1.__generator(this, function (_a) {
1474
- switch (_a.label) {
1475
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1476
- case 1:
1477
- if (!(_a.sent())) {
1478
- return [2 /*return*/];
1479
- }
1480
- newOriginNameOrUrl = this.firstArg;
1481
- proj = this.project;
1482
- if (proj && proj.git.isInsideGitRepo) {
1483
- proj.git.renameOrigin(newOriginNameOrUrl);
1484
- }
1485
- else {
1486
- index_1.Helpers.error("This folder is not a git repo... ", false, true);
1487
- }
1488
- this._exit();
1489
- return [2 /*return*/];
1490
- }
1491
- });
1492
- });
1493
- };
1494
- //#endregion
1495
- //#region commands / last hash tag
1496
- BaseCommandLine.prototype.LAST_TAG_HASH = function () {
1497
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1498
- return tslib_1.__generator(this, function (_a) {
1499
- switch (_a.label) {
1500
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1501
- case 1:
1502
- if (!(_a.sent())) {
1503
- return [2 /*return*/];
1504
- }
1505
- index_1.Helpers.info(this.project.git.lastTagHash());
1506
- this._exit();
1507
- return [2 /*return*/];
1508
- }
1509
- });
1510
- });
1511
- };
1512
- //#endregion
1513
- //#region commands / last tag
1514
- BaseCommandLine.prototype.LAST_TAG = function () {
1515
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1516
- var proj;
1517
- return tslib_1.__generator(this, function (_a) {
1518
- switch (_a.label) {
1519
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1520
- case 1:
1521
- if (!(_a.sent())) {
1522
- return [2 /*return*/];
1523
- }
1524
- proj = this.project;
1525
- index_1.Helpers.info("\n\n last tag: ".concat(proj.git.lastTagVersionName, "\n last tag hash: ").concat(proj.git.lastTagHash(), "\n\n"));
1526
- this._exit();
1527
- return [2 /*return*/];
1528
- }
1529
- });
1530
- });
1531
- };
1532
- //#endregion
1533
- //#region commands / check tag exists
1534
- BaseCommandLine.prototype.CHECK_TAG_EXISTS = function () {
1535
- index_1.Helpers.info("tag \"".concat(this.firstArg, "\" exits = ").concat(index_1.Helpers.git.checkTagExists(this.firstArg), " "));
1536
- this._exit();
1537
- };
1538
- //#endregion
1539
- //#region commands / lint
1540
- /**
1541
- * TODO move somewhere
1542
- */
1543
- BaseCommandLine.prototype.lint = function () {
1544
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1545
- return tslib_1.__generator(this, function (_a) {
1546
- switch (_a.label) {
1547
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1548
- case 1:
1549
- if (!(_a.sent())) {
1550
- return [2 /*return*/];
1551
- }
1552
- return [4 /*yield*/, this.project.lint()];
1553
- case 2:
1554
- _a.sent();
1555
- return [2 /*return*/];
1556
- }
1557
- });
1558
- });
1559
- };
1560
- //#endregion
1561
- //#region commands / version
1562
- /**
1563
- * TODO move somewhere
1564
- */
1565
- BaseCommandLine.prototype.version = function () {
1566
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1567
- return tslib_1.__generator(this, function (_a) {
1568
- switch (_a.label) {
1569
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
1570
- case 1:
1571
- if (!(_a.sent())) {
1572
- return [2 /*return*/];
1573
- }
1574
- console.log('Current project verison: ' + this.project.npmHelpers.version);
1575
- this._exit();
1576
- return [2 /*return*/];
1577
- }
1578
- });
1579
- });
1580
- };
1581
- //#endregion
1582
- //#region commands / init
1583
- /**
1584
- * TODO move somewhere
1585
- */
1586
- BaseCommandLine.prototype.init = function () {
1587
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1588
- return tslib_1.__generator(this, function (_a) {
1589
- switch (_a.label) {
1590
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
1591
- case 1:
1592
- if (!(_a.sent())) {
1593
- return [2 /*return*/];
1594
- }
1595
- return [4 /*yield*/, this.project.init()];
1596
- case 2:
1597
- _a.sent();
1598
- this._exit();
1599
- return [2 /*return*/];
1600
- }
1601
- });
1602
- });
1603
- };
1604
- /**
1605
- * init parent and first level children
1606
- */
1607
- BaseCommandLine.prototype.initAll = function () {
1608
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1609
- var _a, _b, child, e_3_1;
1610
- var e_3, _c;
1611
- return tslib_1.__generator(this, function (_d) {
1612
- switch (_d.label) {
1613
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
1614
- case 1:
1615
- if (!(_d.sent())) {
1616
- return [2 /*return*/];
1617
- }
1618
- return [4 /*yield*/, this.project.init()];
1619
- case 2:
1620
- _d.sent();
1621
- _d.label = 3;
1622
- case 3:
1623
- _d.trys.push([3, 8, 9, 10]);
1624
- _a = tslib_1.__values(this.project.children), _b = _a.next();
1625
- _d.label = 4;
1626
- case 4:
1627
- if (!!_b.done) return [3 /*break*/, 7];
1628
- child = _b.value;
1629
- return [4 /*yield*/, child.init()];
1630
- case 5:
1631
- _d.sent();
1632
- _d.label = 6;
1633
- case 6:
1634
- _b = _a.next();
1635
- return [3 /*break*/, 4];
1636
- case 7: return [3 /*break*/, 10];
1637
- case 8:
1638
- e_3_1 = _d.sent();
1639
- e_3 = { error: e_3_1 };
1640
- return [3 /*break*/, 10];
1641
- case 9:
1642
- try {
1643
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
1644
- }
1645
- finally { if (e_3) throw e_3.error; }
1646
- return [7 /*endfinally*/];
1647
- case 10:
1648
- this._exit();
1649
- return [2 /*return*/];
1650
- }
1651
- });
1652
- });
1653
- };
1654
- //#endregion
1655
- //#region commands / struct
1656
- /**
1657
- * TODO move somewhere
1658
- */
1659
- BaseCommandLine.prototype.struct = function () {
1660
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1661
- return tslib_1.__generator(this, function (_a) {
1662
- switch (_a.label) {
1663
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
1664
- case 1:
1665
- if (!(_a.sent())) {
1666
- return [2 /*return*/];
1667
- }
1668
- return [4 /*yield*/, this.project.struct()];
1669
- case 2:
1670
- _a.sent();
1671
- this._exit();
1672
- return [2 /*return*/];
1673
- }
1674
- });
1675
- });
1676
- };
1677
- //#endregion
1678
- //#region commands / info
1679
- /**
1680
- * TODO move somewhere
1681
- */
1682
- BaseCommandLine.prototype.info = function () {
1683
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1684
- return tslib_1.__generator(this, function (_a) {
1685
- switch (_a.label) {
1686
- case 0: return [4 /*yield*/, this.cwdIsProject({
1687
- requireProjectWithGitRoot: false,
1688
- })];
1689
- case 1:
1690
- if (!(_a.sent())) {
1691
- return [2 /*return*/];
1692
- }
1693
- index_1.Helpers.clearConsole();
1694
- return [4 /*yield*/, this.project.info()];
1695
- case 2:
1696
- _a.sent();
1697
- return [4 /*yield*/, this.project.linkedProjects.saveAllLinkedProjectsToDB()];
1698
- case 3:
1699
- _a.sent();
1700
- this._exit();
1701
- return [2 /*return*/];
1702
- }
1703
- });
1704
- });
1705
- };
1706
- //#endregion
1707
- //#region commands / info
1708
- BaseCommandLine.prototype.modified = function () {
1709
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1710
- var proj, libs;
1711
- return tslib_1.__generator(this, function (_a) {
1712
- switch (_a.label) {
1713
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: true })];
1714
- case 1:
1715
- if (!(_a.sent())) {
1716
- return [2 /*return*/];
1717
- }
1718
- proj = this.project;
1719
- libs = proj.children.filter(function (child) {
1720
- process.stdout.write('.');
1721
- return child.git.thereAreSomeUncommitedChangeExcept([
1722
- tnp_config_2.config.file.package_json,
1723
- ]);
1724
- });
1725
- console.log('\n' + index_1.Helpers.terminalLine());
1726
- index_1.Helpers.info(libs.length
1727
- ? libs
1728
- .map(function (c) {
1729
- 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(', '), ")");
1730
- })
1731
- .join('\n')
1732
- : 'Nothing modifed');
1733
- this._exit();
1734
- return [2 /*return*/];
1735
- }
1736
- });
1737
- });
1738
- };
1739
- //#endregion
1740
- //#region commands / update
1741
- BaseCommandLine.prototype.UPDATE = function () {
1742
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1743
- var linkedProjects;
1744
- var _this = this;
1745
- return tslib_1.__generator(this, function (_a) {
1746
- switch (_a.label) {
1747
- case 0:
1748
- linkedProjects = index_1.LinkedProject.detect(this.project.location).filter(function (linkedProj) {
1749
- return _this.project.ins.From([
1750
- _this.project.location,
1751
- linkedProj.relativeClonePath,
1752
- ]);
1753
- });
1754
- 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?"))];
1755
- case 1:
1756
- if (_a.sent()) {
1757
- this.project.linkedProjects.addLinkedProjects(linkedProjects);
1758
- }
1759
- return [4 /*yield*/, this.project.init()];
1760
- case 2:
1761
- _a.sent();
1762
- index_1.Helpers.info("Linked projects updated");
1763
- this._exit(0);
1764
- return [2 /*return*/];
1765
- }
1766
- });
1767
- });
1768
- };
1769
- //#endregion
1770
- //#region commands / changes
1771
- BaseCommandLine.prototype.changes = function () {
1772
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1773
- var _a, _b, _c, _d, chil, _e, _f, e_4_1;
1774
- var e_4, _g;
1775
- return tslib_1.__generator(this, function (_h) {
1776
- switch (_h.label) {
1777
- case 0:
1778
- _b = (_a = index_1.Helpers).info;
1779
- return [4 /*yield*/, this.project.git.changesSummary()];
1780
- case 1:
1781
- _b.apply(_a, [_h.sent()]);
1782
- index_1.Helpers.terminalLine();
1783
- _h.label = 2;
1784
- case 2:
1785
- _h.trys.push([2, 7, 8, 9]);
1786
- _c = tslib_1.__values(this.project.children), _d = _c.next();
1787
- _h.label = 3;
1788
- case 3:
1789
- if (!!_d.done) return [3 /*break*/, 6];
1790
- chil = _d.value;
1791
- _f = (_e = index_1.Helpers).info;
1792
- return [4 /*yield*/, chil.git.changesSummary()];
1793
- case 4:
1794
- _f.apply(_e, [_h.sent()]);
1795
- _h.label = 5;
1796
- case 5:
1797
- _d = _c.next();
1798
- return [3 /*break*/, 3];
1799
- case 6: return [3 /*break*/, 9];
1800
- case 7:
1801
- e_4_1 = _h.sent();
1802
- e_4 = { error: e_4_1 };
1803
- return [3 /*break*/, 9];
1804
- case 8:
1805
- try {
1806
- if (_d && !_d.done && (_g = _c.return)) _g.call(_c);
1807
- }
1808
- finally { if (e_4) throw e_4.error; }
1809
- return [7 /*endfinally*/];
1810
- case 9:
1811
- this._exit();
1812
- return [2 /*return*/];
1813
- }
1814
- });
1815
- });
1816
- };
1817
- //#endregion
1818
- //#region commands / branch name
1819
- BaseCommandLine.prototype.BRANCH_NAME = function () {
1820
- console.log("current branch name: \"".concat(index_1.Helpers.git.currentBranchName(process.cwd()), "\""));
1821
- this._exit();
1822
- };
1823
- //#endregion
1824
- //#region commands / remotes
1825
- BaseCommandLine.prototype.REMOTES = function () {
1826
- console.log(index_1.Helpers.git.allOrigins(this.cwd));
1827
- this._exit();
1828
- };
1829
- BaseCommandLine.prototype.SET_REMOTE_SSH = function () {
1830
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1831
- return tslib_1.__generator(this, function (_a) {
1832
- switch (_a.label) {
1833
- case 0: return [4 /*yield*/, index_1.Helpers.git.changeRemoteFromHttpsToSSh(this.cwd)];
1834
- case 1:
1835
- _a.sent();
1836
- this._exit();
1837
- return [2 /*return*/];
1838
- }
1839
- });
1840
- });
1841
- };
1842
- BaseCommandLine.prototype.SET_REMOTE_http = function () {
1843
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1844
- return tslib_1.__generator(this, function (_a) {
1845
- switch (_a.label) {
1846
- case 0: return [4 /*yield*/, index_1.Helpers.git.changeRemoveFromSshToHttps(this.cwd)];
1847
- case 1:
1848
- _a.sent();
1849
- this._exit();
1850
- return [2 /*return*/];
1851
- }
1852
- });
1853
- });
1854
- };
1855
- BaseCommandLine.prototype.SET_REMOTE_https = function () {
1856
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1857
- return tslib_1.__generator(this, function (_a) {
1858
- switch (_a.label) {
1859
- case 0: return [4 /*yield*/, this.SET_REMOTE_http()];
1860
- case 1:
1861
- _a.sent();
1862
- return [2 /*return*/];
1863
- }
1864
- });
1865
- });
1866
- };
1867
- BaseCommandLine.prototype._resolveChildFromArg = function () {
1868
- var _this = this;
1869
- var _a = index_1.Helpers.cliTool.resolveItemFromArgsBegin(this.args, function (arg) {
1870
- return _this.ins.From([_this.cwd, arg]);
1871
- }), projFromArg = _a.resolved, clearedCommand = _a.clearedCommand;
1872
- if (!!projFromArg) {
1873
- this.args = clearedCommand.split(' ');
1874
- this.cwd = projFromArg.location;
1875
- this.project = projFromArg;
1876
- }
1877
- };
1878
- BaseCommandLine.prototype.origin = function () {
1879
- this._resolveChildFromArg();
1880
- console.log(index_1.Helpers.git.getOriginURL(this.cwd));
1881
- this._exit();
1882
- };
1883
- BaseCommandLine.prototype.remote = function () {
1884
- console.log(index_1.Helpers.git.getOriginURL(this.cwd));
1885
- this._exit();
1886
- };
1887
- BaseCommandLine.prototype.originHttp = function () {
1888
- console.log(index_1.Helpers.git.originSshToHttp(index_1.Helpers.git.getOriginURL(this.cwd)));
1889
- this._exit();
1890
- };
1891
- BaseCommandLine.prototype.originHttps = function () {
1892
- console.log(index_1.Helpers.git.originSshToHttp(index_1.Helpers.git.getOriginURL(this.cwd)));
1893
- this._exit();
1894
- };
1895
- BaseCommandLine.prototype.originssh = function () {
1896
- console.log(index_1.Helpers.git.originHttpToSsh(index_1.Helpers.git.getOriginURL(this.cwd)));
1897
- this._exit();
1898
- };
1899
- BaseCommandLine.prototype.origins = function () {
1900
- this.REMOTES();
1901
- };
1902
- //#endregion
1903
- //#region commands / git config
1904
- BaseCommandLine.prototype.gitConfig = function () {
1905
- var root = index_1.Helpers.git.findGitRoot(this.cwd);
1906
- index_1.Helpers.run("code ".concat((0, tnp_core_2.crossPlatformPath)([root, '.git', 'config']))).sync();
1907
- this._exit();
1908
- };
1909
- //#endregion
1910
- //#region commands / lastCommitHash
1911
- BaseCommandLine.prototype.LAST_COMMIT_HASH = function () {
1912
- console.log(index_1.Helpers.git.lastCommitHash(this.cwd));
1913
- this._exit();
1914
- };
1915
- //#endregion
1916
- //#region commands / commit message by hash
1917
- BaseCommandLine.prototype.COMMIT_MESSAGE_BY_HASH = function () {
1918
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1919
- var hash, _a, _b;
1920
- return tslib_1.__generator(this, function (_c) {
1921
- switch (_c.label) {
1922
- case 0:
1923
- hash = this.firstArg;
1924
- _b = (_a = console).log;
1925
- return [4 /*yield*/, this.project.git.getCommitMessageByHash(hash)];
1926
- case 1:
1927
- _b.apply(_a, [_c.sent()]);
1928
- this._exit();
1929
- return [2 /*return*/];
1930
- }
1931
- });
1932
- });
1933
- };
1934
- //#endregion
1935
- //#region commands / last 5 commit hashes
1936
- BaseCommandLine.prototype.LAST_5_COMMITS = function () {
1937
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1938
- var index, hash;
1939
- return tslib_1.__generator(this, function (_a) {
1940
- switch (_a.label) {
1941
- case 0:
1942
- index = 0;
1943
- _a.label = 1;
1944
- case 1:
1945
- if (!(index < 5)) return [3 /*break*/, 4];
1946
- return [4 /*yield*/, this.project.git.getCommitHashByIndex(index)];
1947
- case 2:
1948
- hash = _a.sent();
1949
- console.log(hash);
1950
- _a.label = 3;
1951
- case 3:
1952
- index++;
1953
- return [3 /*break*/, 1];
1954
- case 4:
1955
- this._exit();
1956
- return [2 /*return*/];
1957
- }
1958
- });
1959
- });
1960
- };
1961
- //#endregion
1962
- //#region commands / update deps from
1963
- BaseCommandLine.prototype.updateDepsFrom = function () {
1964
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1965
- var locations;
1966
- var _this = this;
1967
- return tslib_1.__generator(this, function (_a) {
1968
- locations = this.args.join(' ').trim() === '' ? [] : this.args;
1969
- if (tnp_core_1._.isArray(locations)) {
1970
- locations = locations.map(function (l) {
1971
- if (tnp_core_1.path.isAbsolute(l)) {
1972
- return tnp_core_1.path.resolve(l);
1973
- }
1974
- return tnp_core_1.path.resolve(tnp_core_1.path.join(_this.cwd, l));
1975
- });
1976
- }
1977
- this.project.npmHelpers.updateDepsFrom(locations);
1978
- this._exit();
1979
- return [2 /*return*/];
1980
- });
1981
- });
1982
- };
1983
- //#endregion
1984
- //#region is terminal supported
1985
- BaseCommandLine.prototype.isTerminalSupported = function () {
1986
- console.log("Terminal is supported: ".concat(index_1.Helpers.isSupportedTaonTerminal));
1987
- this._exit();
1988
- };
1989
- //#endregion
1990
- //#region prox ext
1991
- BaseCommandLine.prototype.INSTALL_PROJECT_EXTENSIONS = function () {
1992
- return tslib_1.__awaiter(this, void 0, void 0, function () {
1993
- return tslib_1.__generator(this, function (_a) {
1994
- switch (_a.label) {
1995
- case 0: return [4 /*yield*/, this.INSTALL_PROJ_EXT()];
1996
- case 1:
1997
- _a.sent();
1998
- return [2 /*return*/];
1999
- }
2000
- });
2001
- });
2002
- };
2003
- BaseCommandLine.prototype.INSTALL_PROJECT_EXT = function () {
2004
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2005
- return tslib_1.__generator(this, function (_a) {
2006
- switch (_a.label) {
2007
- case 0: return [4 /*yield*/, this.INSTALL_PROJ_EXT()];
2008
- case 1:
2009
- _a.sent();
2010
- return [2 /*return*/];
2011
- }
2012
- });
2013
- });
2014
- };
2015
- BaseCommandLine.prototype.INS_PROJ_EXT = function () {
2016
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2017
- return tslib_1.__generator(this, function (_a) {
2018
- switch (_a.label) {
2019
- case 0: return [4 /*yield*/, this.INSTALL_PROJ_EXT()];
2020
- case 1:
2021
- _a.sent();
2022
- return [2 /*return*/];
2023
- }
2024
- });
2025
- });
2026
- };
2027
- BaseCommandLine.prototype.INSTALL_PROJ_EXT = function () {
2028
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2029
- var p, extensions, menuItems, extensionsToInstall, index, extname;
2030
- return tslib_1.__generator(this, function (_a) {
2031
- switch (_a.label) {
2032
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
2033
- case 1:
2034
- if (!(_a.sent())) {
2035
- return [2 /*return*/];
2036
- }
2037
- this.project.vsCodeHelpers.recreateExtensions();
2038
- p = this.project.pathFor('.vscode/extensions.json');
2039
- extensions = index_1.Helpers.readJson(p, { recommendations: [] }, true);
2040
- menuItems = extensions.recommendations.map(function (r) {
2041
- return { name: r, value: r, enabled: true, selected: true };
2042
- });
2043
- extensionsToInstall = [];
2044
- _a.label = 2;
2045
- case 2:
2046
- if (!true) return [3 /*break*/, 5];
2047
- index_1.Helpers.clearConsole();
2048
- return [4 /*yield*/, index_1.Helpers.consoleGui.multiselect('Select extensions to install', menuItems, true, menuItems)];
2049
- case 3:
2050
- extensionsToInstall = _a.sent();
2051
- index_1.Helpers.info(extensionsToInstall.join(', '));
2052
- return [4 /*yield*/, index_1.Helpers.questionYesNo("Install extensions ?")];
2053
- case 4:
2054
- if (!(_a.sent())) {
2055
- return [3 /*break*/, 2];
2056
- }
2057
- return [3 /*break*/, 5];
2058
- case 5:
2059
- for (index = 0; index < extensionsToInstall.length; index++) {
2060
- extname = extensionsToInstall[index];
2061
- try {
2062
- index_1.Helpers.taskStarted("Installing: ".concat(extname));
2063
- index_1.Helpers.run("code --install-extension ".concat(extname)).sync();
2064
- index_1.Helpers.taskDone("Installed: ".concat(extname));
2065
- }
2066
- catch (error) {
2067
- index_1.Helpers.warn("Not able to install ".concat(extname));
2068
- index_1.Helpers.pressKeyOrWait('Press any key to continue...');
2069
- }
2070
- }
2071
- index_1.Helpers.info('Done installing');
2072
- this._exit();
2073
- return [2 /*return*/];
2074
- }
2075
- });
2076
- });
2077
- };
2078
- //#endregion
2079
- //#region proj db
2080
- BaseCommandLine.prototype.projdb = function () {
2081
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2082
- return tslib_1.__generator(this, function (_a) {
2083
- switch (_a.label) {
2084
- case 0: return [4 /*yield*/, this.cwdIsProject({ requireProjectWithGitRoot: false })];
2085
- case 1:
2086
- if (!(_a.sent())) {
2087
- return [2 /*return*/];
2088
- }
2089
- index_1.Helpers.info("Projects db location:\n ".concat(this.project.linkedProjects.projectsDbLocation, "\n\n opening in vscode...\n\n "));
2090
- index_1.Helpers.run("code ".concat(this.project.linkedProjects.projectsDbLocation)).sync();
2091
- this._exit();
2092
- return [2 /*return*/];
2093
- }
2094
- });
2095
- });
2096
- };
2097
- //#endregion
2098
- //#region filter all project branches by pattern
2099
- BaseCommandLine.prototype.__filterBranchesByPattern = function (branchPatternOrBranchName) {
2100
- var branches = index_1.Helpers.arrays.uniqArray(this.project.git.getBranchesNamesBy(branchPatternOrBranchName) ||
2101
- this.project.getMainBranches());
2102
- // console.log('branches', branches);
2103
- return branches;
2104
- };
2105
- //#endregion
2106
- //#region select branch from list of branches
2107
- BaseCommandLine.prototype.__selectBrach = function (branches, task) {
2108
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2109
- var childrenMsg;
2110
- return tslib_1.__generator(this, function (_a) {
2111
- switch (_a.label) {
2112
- case 0:
2113
- childrenMsg = this.project.children.length == 0
2114
- ? '(no children in project)'
2115
- : '(with children)';
2116
- return [4 /*yield*/, index_1.Helpers.autocompleteAsk("Choose branch to ".concat(task, " in this project ").concat(childrenMsg, ": "), branches.map(function (b) {
2117
- return { name: b, value: b };
2118
- }))];
2119
- case 1: return [2 /*return*/, _a.sent()];
2120
- }
2121
- });
2122
- });
2123
- };
2124
- //#endregion
2125
- //#region commands / clone
2126
- BaseCommandLine.prototype.clone = function () {
2127
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2128
- var url, originType;
2129
- return tslib_1.__generator(this, function (_a) {
2130
- url = this.firstArg;
2131
- originType = this.params['setOrigin'];
2132
- if (originType) {
2133
- if (originType === 'ssh') {
2134
- url = index_1.Helpers.git.originHttpToSsh(url);
2135
- }
2136
- if (originType === 'http') {
2137
- url = index_1.Helpers.git.originSshToHttp(url);
2138
- }
2139
- }
2140
- index_1.Helpers.git.clone({
2141
- url: url,
2142
- cwd: this.cwd,
2143
- });
2144
- this._exit();
2145
- return [2 /*return*/];
2146
- });
2147
- });
2148
- };
2149
- //#endregion
2150
- //#region commands / ghtemp
2151
- BaseCommandLine.prototype.ghSave = function () {
2152
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2153
- return tslib_1.__generator(this, function (_a) {
2154
- switch (_a.label) {
2155
- case 0: return [4 /*yield*/, new gh_temp_code_1.GhTempCode(this.cwd, this.project).init().save()];
2156
- case 1:
2157
- _a.sent();
2158
- this._exit();
2159
- return [2 /*return*/];
2160
- }
2161
- });
2162
- });
2163
- };
2164
- BaseCommandLine.prototype.ghRestore = function () {
2165
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2166
- return tslib_1.__generator(this, function (_a) {
2167
- switch (_a.label) {
2168
- case 0: return [4 /*yield*/, new gh_temp_code_1.GhTempCode(this.cwd, this.project).init().restore()];
2169
- case 1:
2170
- _a.sent();
2171
- this._exit();
2172
- return [2 /*return*/];
2173
- }
2174
- });
2175
- });
2176
- };
2177
- //#endregion
2178
- //#region commands / start cli service ports worker
2179
- BaseCommandLine.prototype.startCliServicePortsWorker = function () {
2180
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2181
- return tslib_1.__generator(this, function (_a) {
2182
- switch (_a.label) {
2183
- case 0: return [4 /*yield*/, this.ins.portsWorker.cliStartProcedure(this.params)];
2184
- case 1:
2185
- _a.sent();
2186
- return [2 /*return*/];
2187
- }
2188
- });
2189
- });
2190
- };
2191
- //#endregion
2192
- //#region commands / pause terminal
2193
- BaseCommandLine.prototype.pauseTerminal = function () {
2194
- index_1.Helpers.pressKeyAndContinue();
2195
- this._exit();
2196
- };
2197
- //#endregion
2198
- //#region commands / gh pages init
2199
- BaseCommandLine.prototype.ghPagesInit = function () {
2200
- return tslib_1.__awaiter(this, void 0, void 0, function () {
2201
- return tslib_1.__generator(this, function (_a) {
2202
- switch (_a.label) {
2203
- case 0: return [4 /*yield*/, this.project.init()];
2204
- case 1:
2205
- _a.sent();
2206
- return [4 /*yield*/, this.project.githubPages.init(this.params['provider'] || 'github', !!this.params['full'])];
2207
- case 2:
2208
- _a.sent();
2209
- index_1.Helpers.run('code .', {
2210
- cwd: this.project.githubPages.mainFolderAbsPath,
2211
- }).sync();
2212
- this._exit();
2213
- return [2 /*return*/];
2214
- }
2215
- });
2216
- });
2217
- };
2218
- return BaseCommandLine;
2219
- }(command_line_feature_backend_1.CommandLineFeature));
2220
- exports.BaseCommandLine = BaseCommandLine;
2221
- //# sourceMappingURL=base-command-line.backend.js.map