tnp-helpers 16.444.16 → 16.444.18

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 (98) 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/base-git.mjs +613 -0
  4. package/browser/esm2022/lib/base/base-library-build.mjs +383 -0
  5. package/browser/esm2022/lib/base/base-linked-projects.mjs +291 -0
  6. package/browser/esm2022/lib/base/base-npm-helpers.mjs +317 -0
  7. package/browser/esm2022/lib/base/base-project-resolver.mjs +56 -2
  8. package/browser/esm2022/lib/base/base-project.mjs +180 -1482
  9. package/browser/esm2022/lib/base/core-project.mjs +5 -3
  10. package/browser/esm2022/lib/base/index.mjs +5 -1
  11. package/browser/esm2022/lib/models.mjs +2 -1
  12. package/browser/fesm2022/tnp-helpers.mjs +1098 -748
  13. package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
  14. package/browser/lib/base/base-git.d.ts +114 -0
  15. package/browser/lib/base/base-library-build.d.ts +22 -0
  16. package/browser/lib/base/base-linked-projects.d.ts +23 -0
  17. package/browser/lib/base/base-npm-helpers.d.ts +80 -0
  18. package/browser/lib/base/base-project-resolver.d.ts +2 -1
  19. package/browser/lib/base/base-project.d.ts +9 -205
  20. package/browser/lib/base/index.d.ts +4 -0
  21. package/browser/lib/models.d.ts +17 -4
  22. package/client/README.md +24 -24
  23. package/client/esm2022/lib/base/base-git.mjs +613 -0
  24. package/client/esm2022/lib/base/base-library-build.mjs +383 -0
  25. package/client/esm2022/lib/base/base-linked-projects.mjs +291 -0
  26. package/client/esm2022/lib/base/base-npm-helpers.mjs +317 -0
  27. package/client/esm2022/lib/base/base-project-resolver.mjs +56 -2
  28. package/client/esm2022/lib/base/base-project.mjs +180 -1482
  29. package/client/esm2022/lib/base/core-project.mjs +5 -3
  30. package/client/esm2022/lib/base/index.mjs +5 -1
  31. package/client/esm2022/lib/models.mjs +2 -1
  32. package/client/fesm2022/tnp-helpers.mjs +1098 -748
  33. package/client/fesm2022/tnp-helpers.mjs.map +1 -1
  34. package/client/lib/base/base-git.d.ts +114 -0
  35. package/client/lib/base/base-library-build.d.ts +22 -0
  36. package/client/lib/base/base-linked-projects.d.ts +23 -0
  37. package/client/lib/base/base-npm-helpers.d.ts +80 -0
  38. package/client/lib/base/base-project-resolver.d.ts +2 -1
  39. package/client/lib/base/base-project.d.ts +9 -205
  40. package/client/lib/base/index.d.ts +4 -0
  41. package/client/lib/models.d.ts +17 -4
  42. package/client/package.json +9 -9
  43. package/firedev.jsonc +61 -61
  44. package/lib/base/base-command-line.backend.d.ts +1 -0
  45. package/lib/base/base-command-line.backend.js +26 -13
  46. package/lib/base/base-command-line.backend.js.map +1 -1
  47. package/lib/base/base-git.d.ts +120 -0
  48. package/lib/base/base-git.js +856 -0
  49. package/lib/base/base-git.js.map +1 -0
  50. package/lib/base/base-library-build.d.ts +26 -0
  51. package/lib/base/base-library-build.js +450 -0
  52. package/lib/base/base-library-build.js.map +1 -0
  53. package/lib/base/base-linked-projects.d.ts +23 -0
  54. package/lib/base/base-linked-projects.js +391 -0
  55. package/lib/base/base-linked-projects.js.map +1 -0
  56. package/lib/base/base-npm-helpers.d.ts +79 -0
  57. package/lib/base/base-npm-helpers.js +399 -0
  58. package/lib/base/base-npm-helpers.js.map +1 -0
  59. package/lib/base/base-project-resolver.d.ts +2 -1
  60. package/lib/base/base-project-resolver.js +39 -4
  61. package/lib/base/base-project-resolver.js.map +1 -1
  62. package/lib/base/base-project.d.ts +11 -214
  63. package/lib/base/base-project.js +103 -1739
  64. package/lib/base/base-project.js.map +1 -1
  65. package/lib/base/core-project.js +8 -4
  66. package/lib/base/core-project.js.map +1 -1
  67. package/lib/base/index.d.ts +4 -0
  68. package/lib/base/index.js +4 -0
  69. package/lib/base/index.js.map +1 -1
  70. package/lib/helpers/for-backend/helpers-git.backend.d.ts +1 -1
  71. package/lib/helpers/for-backend/helpers-git.backend.js +2 -2
  72. package/lib/helpers/for-browser/angular.helper.js +3 -3
  73. package/lib/models.d.ts +17 -4
  74. package/lib/old/base-component.js +3 -3
  75. package/lib/old/base-formly-component.js +3 -3
  76. package/lib/old/dual-component-ctrl.js +3 -3
  77. package/package.json +4 -4
  78. package/tmp-environment.json +13 -13
  79. package/websql/README.md +24 -24
  80. package/websql/esm2022/lib/base/base-git.mjs +613 -0
  81. package/websql/esm2022/lib/base/base-library-build.mjs +383 -0
  82. package/websql/esm2022/lib/base/base-linked-projects.mjs +291 -0
  83. package/websql/esm2022/lib/base/base-npm-helpers.mjs +317 -0
  84. package/websql/esm2022/lib/base/base-project-resolver.mjs +50 -2
  85. package/websql/esm2022/lib/base/base-project.mjs +235 -1537
  86. package/websql/esm2022/lib/base/core-project.mjs +5 -3
  87. package/websql/esm2022/lib/base/index.mjs +5 -1
  88. package/websql/esm2022/lib/models.mjs +2 -1
  89. package/websql/fesm2022/tnp-helpers.mjs +1106 -761
  90. package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
  91. package/websql/lib/base/base-git.d.ts +114 -0
  92. package/websql/lib/base/base-library-build.d.ts +22 -0
  93. package/websql/lib/base/base-linked-projects.d.ts +23 -0
  94. package/websql/lib/base/base-npm-helpers.d.ts +80 -0
  95. package/websql/lib/base/base-project-resolver.d.ts +2 -1
  96. package/websql/lib/base/base-project.d.ts +12 -205
  97. package/websql/lib/base/index.d.ts +4 -0
  98. package/websql/lib/models.d.ts +17 -4
@@ -0,0 +1,856 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseGit = void 0;
4
+ var tslib_1 = require("tslib");
5
+ //#region imports
6
+ //#region @backend
7
+ var tnp_core_1 = require("tnp-core");
8
+ var translate_1 = require("./translate");
9
+ //#endregion
10
+ var base_feature_for_project_1 = require("./base-feature-for-project");
11
+ var index_1 = require("../index");
12
+ var tnp_core_2 = require("tnp-core");
13
+ //#endregion
14
+ var BaseGit = /** @class */ (function (_super) {
15
+ tslib_1.__extends(BaseGit, _super);
16
+ function BaseGit() {
17
+ return _super !== null && _super.apply(this, arguments) || this;
18
+ }
19
+ //#region methods & getters / unstage all files
20
+ BaseGit.prototype.unstageAllFiles = function () {
21
+ //#region @backendFunc
22
+ index_1.Helpers.git.unstageAllFiles(this.project.location);
23
+ //#endregion
24
+ };
25
+ //#endregion
26
+ //#region methods & getters / revert file changes
27
+ BaseGit.prototype.revertFileChanges = function (fileReletivePath) {
28
+ //#region @backendFunc
29
+ index_1.Helpers.git.revertFileChanges(this.project.location, fileReletivePath);
30
+ //#endregion
31
+ };
32
+ //#region methods & getters /
33
+ //#region methods & getters / clone
34
+ BaseGit.prototype.clone = function (url, destinationFolderName, branchName) {
35
+ if (destinationFolderName === void 0) { destinationFolderName = ''; }
36
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
37
+ var clondeFolderpath, error_1;
38
+ return tslib_1.__generator(this, function (_a) {
39
+ switch (_a.label) {
40
+ case 0:
41
+ clondeFolderpath = index_1.Helpers.git.clone({
42
+ cwd: this.project.location,
43
+ url: url,
44
+ destinationFolderName: destinationFolderName,
45
+ });
46
+ if (!branchName) return [3 /*break*/, 4];
47
+ _a.label = 1;
48
+ case 1:
49
+ _a.trys.push([1, 3, , 4]);
50
+ index_1.Helpers.git.checkout(clondeFolderpath, branchName);
51
+ return [4 /*yield*/, index_1.Helpers.git.pullCurrentBranch(clondeFolderpath, {
52
+ askToRetry: true,
53
+ })];
54
+ case 2:
55
+ _a.sent();
56
+ return [3 /*break*/, 4];
57
+ case 3:
58
+ error_1 = _a.sent();
59
+ return [3 /*break*/, 4];
60
+ case 4: return [2 /*return*/, (0, tnp_core_2.crossPlatformPath)([
61
+ clondeFolderpath,
62
+ destinationFolderName || '',
63
+ ]).replace(/\/$/g, '')];
64
+ }
65
+ });
66
+ });
67
+ };
68
+ //#endregion
69
+ //#region methods & getters / restore last version
70
+ BaseGit.prototype.restoreLastVersion = function (localFilePath) {
71
+ //#region @backendFunc
72
+ return index_1.Helpers.git.restoreLastVersion(this.project.location, localFilePath);
73
+ //#endregion
74
+ };
75
+ //#endregion
76
+ //#region methods & getters / stage all files
77
+ BaseGit.prototype.stageAllFiles = function () {
78
+ //#region @backendFunc
79
+ index_1.Helpers.git.stageAllFiles(this.project.location);
80
+ //#endregion
81
+ };
82
+ //#endregion
83
+ //#region methods & getters / stash
84
+ BaseGit.prototype.stash = function (optinos) {
85
+ //#region @backendFunc
86
+ index_1.Helpers.git.stash(this.project.location, optinos);
87
+ //#endregion
88
+ };
89
+ //#endregion
90
+ //#region methods & getters / stash apply
91
+ BaseGit.prototype.stashApply = function () {
92
+ //#region @backendFunc
93
+ index_1.Helpers.git.stashApply(this.project.location);
94
+ //#endregion
95
+ };
96
+ //#endregion
97
+ //#region methods & getters / fetch
98
+ BaseGit.prototype.fetch = function () {
99
+ //#region @backendFunc
100
+ index_1.Helpers.git.fetch(this.project.location);
101
+ //#endregion
102
+ };
103
+ //#endregion
104
+ //#region methods & getters / reset files
105
+ BaseGit.prototype.resetFiles = function () {
106
+ var _a;
107
+ var relativePathes = [];
108
+ for (var _i = 0; _i < arguments.length; _i++) {
109
+ relativePathes[_i] = arguments[_i];
110
+ }
111
+ //#region @backendFunc
112
+ return (_a = index_1.Helpers.git).resetFiles.apply(_a, tslib_1.__spreadArray([this.project.location], tslib_1.__read(relativePathes), false));
113
+ //#endregion
114
+ };
115
+ Object.defineProperty(BaseGit.prototype, "isInsideGitRepo", {
116
+ //#endregion
117
+ //#region methods & getters / is inside git repo
118
+ get: function () {
119
+ //#region @backendFunc
120
+ return index_1.Helpers.git.isInsideGitRepo(this.project.location);
121
+ //#endregion
122
+ },
123
+ enumerable: false,
124
+ configurable: true
125
+ });
126
+ Object.defineProperty(BaseGit.prototype, "isWithoutGitRepository", {
127
+ //#endregion
128
+ //#region methods & getters / is without git repository
129
+ get: function () {
130
+ //#region @backendFunc
131
+ return !tnp_core_1.fse.existsSync(tnp_core_2.path.join(this.project.location, '.git'));
132
+ //#endregion
133
+ },
134
+ enumerable: false,
135
+ configurable: true
136
+ });
137
+ Object.defineProperty(BaseGit.prototype, "isGitRoot", {
138
+ //#endregion
139
+ //#region methods & getters / is git root
140
+ get: function () {
141
+ //#region @backendFunc
142
+ return index_1.Helpers.git.isGitRoot(this.project.location);
143
+ //#endregion
144
+ },
145
+ enumerable: false,
146
+ configurable: true
147
+ });
148
+ Object.defineProperty(BaseGit.prototype, "originURL", {
149
+ //#endregion
150
+ //#region methods & getters / origin url
151
+ get: function () {
152
+ //#region @backendFunc
153
+ return index_1.Helpers.git.getOriginURL(this.project.location);
154
+ //#endregion
155
+ },
156
+ enumerable: false,
157
+ configurable: true
158
+ });
159
+ //#endregion
160
+ //#region methods & getters / commit
161
+ BaseGit.prototype.commit = function (commitMessage) {
162
+ //#region @backendFunc
163
+ return index_1.Helpers.git.commit(this.project.location, commitMessage);
164
+ //#endregion
165
+ };
166
+ //#endregion
167
+ //#region methods & getters / add and commit
168
+ /**
169
+ * alias to stage all and commit
170
+ */
171
+ BaseGit.prototype.addAndCommit = function (commitMessage) {
172
+ //#region @backendFunc
173
+ return index_1.Helpers.git.stageAllAndCommit(this.project.location, commitMessage);
174
+ //#endregion
175
+ };
176
+ //#endregion
177
+ //#region methods & getters / stage all and commit
178
+ BaseGit.prototype.stageAllAndCommit = function (commitMessage) {
179
+ //#region @backendFunc
180
+ return index_1.Helpers.git.stageAllAndCommit(this.project.location, commitMessage);
181
+ //#endregion
182
+ };
183
+ //#endregion
184
+ //#region methods & getters / push current branch
185
+ BaseGit.prototype.pushCurrentBranch = function (options) {
186
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
187
+ return tslib_1.__generator(this, function (_a) {
188
+ switch (_a.label) {
189
+ case 0: return [4 /*yield*/, index_1.Helpers.git.pushCurrentBranch(this.project.location, options)];
190
+ case 1:
191
+ //#region @backendFunc
192
+ return [2 /*return*/, _a.sent()];
193
+ }
194
+ });
195
+ });
196
+ };
197
+ Object.defineProperty(BaseGit.prototype, "allOrigins", {
198
+ //#endregion
199
+ //#region methods & getters / all origins
200
+ get: function () {
201
+ //#region @backendFunc
202
+ return index_1.Helpers.git.allOrigins(this.project.location);
203
+ //#endregion
204
+ },
205
+ enumerable: false,
206
+ configurable: true
207
+ });
208
+ Object.defineProperty(BaseGit.prototype, "uncommitedFiles", {
209
+ //#endregion
210
+ //#region methods & getters / uncommited files
211
+ get: function () {
212
+ //#region @backendFunc
213
+ return index_1.Helpers.git.uncommitedFiles(this.project.location);
214
+ //#endregion
215
+ },
216
+ enumerable: false,
217
+ configurable: true
218
+ });
219
+ Object.defineProperty(BaseGit.prototype, "thereAreSomeUncommitedChange", {
220
+ //#endregion
221
+ //#region methods & getters / there are some uncommited change
222
+ get: function () {
223
+ //#region @backendFunc
224
+ return index_1.Helpers.git.checkIfthereAreSomeUncommitedChange(this.project.location);
225
+ //#endregion
226
+ },
227
+ enumerable: false,
228
+ configurable: true
229
+ });
230
+ //#endregion
231
+ //#region methods & getters / there are some uncommited change except
232
+ BaseGit.prototype.thereAreSomeUncommitedChangeExcept = function (filesList) {
233
+ if (filesList === void 0) { filesList = []; }
234
+ //#region @backendFunc
235
+ return index_1.Helpers.git.thereAreSomeUncommitedChangeExcept(filesList, this.project.location);
236
+ //#endregion
237
+ };
238
+ //#endregion
239
+ //#region methods & getters / melt action commits
240
+ BaseGit.prototype.meltActionCommits = function (soft) {
241
+ if (soft === void 0) { soft = false; }
242
+ //#region @backend
243
+ return index_1.Helpers.git.meltActionCommits(this.project.location, soft);
244
+ //#endregion
245
+ };
246
+ //#endregion
247
+ //#region methods & getters / pull current branch
248
+ BaseGit.prototype.pullCurrentBranch = function (options) {
249
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
250
+ return tslib_1.__generator(this, function (_a) {
251
+ switch (_a.label) {
252
+ case 0:
253
+ //#region @backendFunc
254
+ return [4 /*yield*/, index_1.Helpers.git.pullCurrentBranch(this.project.location, tslib_1.__assign({}, options))];
255
+ case 1:
256
+ //#region @backendFunc
257
+ _a.sent();
258
+ return [2 /*return*/];
259
+ }
260
+ });
261
+ });
262
+ };
263
+ Object.defineProperty(BaseGit.prototype, "currentBranchName", {
264
+ //#endregion
265
+ //#region methods & getters / current branch name
266
+ get: function () {
267
+ //#region @backendFunc
268
+ return index_1.Helpers.git.currentBranchName(this.project.location);
269
+ //#endregion
270
+ },
271
+ enumerable: false,
272
+ configurable: true
273
+ });
274
+ Object.defineProperty(BaseGit.prototype, "listOfCurrentGitChanges", {
275
+ //#endregion
276
+ //#region methods & getters / list of current git changes
277
+ get: function () {
278
+ //#region @backendFunc
279
+ return index_1.Helpers.git.getListOfCurrentGitChanges(this.project.location);
280
+ //#endregion
281
+ },
282
+ enumerable: false,
283
+ configurable: true
284
+ });
285
+ //#endregion
286
+ //#region methods & getters / get branches names by
287
+ BaseGit.prototype.getBranchesNamesBy = function (pattern) {
288
+ //#region @backendFunc
289
+ return index_1.Helpers.git.getBranchesNames(this.project.location, pattern);
290
+ //#endregion
291
+ };
292
+ //#endregion
293
+ //#region methods & getters / reset soft HEAD
294
+ BaseGit.prototype.resetSoftHEAD = function (HEAD) {
295
+ if (HEAD === void 0) { HEAD = 1; }
296
+ //#region @backendFunc
297
+ index_1.Helpers.git.resetSoftHEAD(this.project.location, HEAD);
298
+ //#endregion
299
+ };
300
+ //#endregion
301
+ //#region methods & getters / reset hard
302
+ BaseGit.prototype.resetHard = function (options) {
303
+ //#region @backendFunc
304
+ index_1.Helpers.git.resetHard(this.project.location, options);
305
+ //#endregion
306
+ };
307
+ //#endregion
308
+ //#region methods & getters / count commits
309
+ BaseGit.prototype.countComits = function () {
310
+ //#region @backendFunc
311
+ return index_1.Helpers.git.countCommits(this.project.location);
312
+ //#endregion
313
+ };
314
+ //#endregion
315
+ //#region methods & getters / has any commits
316
+ BaseGit.prototype.hasAnyCommits = function () {
317
+ //#region @backendFunc
318
+ return index_1.Helpers.git.hasAnyCommits(this.project.location);
319
+ //#endregion
320
+ };
321
+ Object.defineProperty(BaseGit.prototype, "isInMergeProcess", {
322
+ //#endregion
323
+ //#region methods & getters / is in merge process
324
+ get: function () {
325
+ //#region @backendFunc
326
+ return index_1.Helpers.git.isInMergeProcess(this.project.location);
327
+ //#endregion
328
+ },
329
+ enumerable: false,
330
+ configurable: true
331
+ });
332
+ //#endregion
333
+ //#region methods & getters / last commit date
334
+ BaseGit.prototype.lastCommitDate = function () {
335
+ //#region @backendFunc
336
+ return index_1.Helpers.git.lastCommitDate(this.project.location);
337
+ //#endregion
338
+ };
339
+ //#endregion
340
+ //#region methods & getters / last commit hash
341
+ BaseGit.prototype.lastCommitHash = function () {
342
+ //#region @backendFunc
343
+ return index_1.Helpers.git.lastCommitHash(this.project.location);
344
+ //#endregion
345
+ };
346
+ //#endregion
347
+ //#region methods & getters / last commit message
348
+ BaseGit.prototype.lastCommitMessage = function () {
349
+ //#region @backendFunc
350
+ return index_1.Helpers.git.lastCommitMessage(this.project.location);
351
+ //#endregion
352
+ };
353
+ //#endregion
354
+ //#region methods & getters / penultimate commit hash
355
+ BaseGit.prototype.penultimateCommitHash = function () {
356
+ //#region @backendFunc
357
+ return index_1.Helpers.git.penultimateCommitHash(this.project.location);
358
+ //#endregion
359
+ };
360
+ //#endregion
361
+ //#region methods & getters / check tag exists
362
+ BaseGit.prototype.checkTagExists = function (tag) {
363
+ //#region @backendFunc
364
+ return index_1.Helpers.git.checkTagExists(tag, this.project.location);
365
+ //#endregion
366
+ };
367
+ //#endregion
368
+ //#region methods & getters / checkout
369
+ BaseGit.prototype.checkout = function (branchName, options) {
370
+ //#region @backendFunc
371
+ return index_1.Helpers.git.checkout(this.project.location, branchName, options);
372
+ //#endregion
373
+ };
374
+ //#endregion
375
+ //#region methods & getters / checkout from to
376
+ BaseGit.prototype.checkoutFromTo = function (checkoutFromBranch, branch, origin) {
377
+ if (origin === void 0) { origin = 'origin'; }
378
+ //#region @backendFunc
379
+ return index_1.Helpers.git.checkoutFromTo(checkoutFromBranch, branch, origin, this.project.location);
380
+ //#endregion
381
+ };
382
+ //#endregion
383
+ //#region methods & getters / last tag name for major version
384
+ /**
385
+ *
386
+ * @param majorVersion example: v1, v2 etc.
387
+ * @returns tag name
388
+ */
389
+ BaseGit.prototype.lastTagNameForMajorVersion = function (majorVersion) {
390
+ //#region @backendFunc
391
+ return index_1.Helpers.git.lastTagNameForMajorVersion(this.project.location, majorVersion);
392
+ //#endregion
393
+ };
394
+ //#endregion
395
+ //#region methods & getters / last tag hash
396
+ BaseGit.prototype.lastTagHash = function () {
397
+ //#region @backendFunc
398
+ return index_1.Helpers.git.lastTagHash(this.project.location);
399
+ //#endregion
400
+ };
401
+ Object.defineProperty(BaseGit.prototype, "remoteOriginUrl", {
402
+ //#endregion
403
+ //#region methods & getters / remote origin url
404
+ get: function () {
405
+ //#region @backendFunc
406
+ return index_1.Helpers.git.getOriginURL(this.project.location);
407
+ //#endregion
408
+ },
409
+ enumerable: false,
410
+ configurable: true
411
+ });
412
+ Object.defineProperty(BaseGit.prototype, "lastTagVersionName", {
413
+ //#endregion
414
+ //#region methods & getters / last tag version name
415
+ get: function () {
416
+ //#region @backendFunc
417
+ return index_1.Helpers.git.lastTagVersionName(this.project.location) || '';
418
+ //#endregion
419
+ },
420
+ enumerable: false,
421
+ configurable: true
422
+ });
423
+ Object.defineProperty(BaseGit.prototype, "stagedFiles", {
424
+ //#endregion
425
+ //#region methods & getters / staged files
426
+ get: function () {
427
+ //#region @backendFunc
428
+ return index_1.Helpers.git.stagedFiles(this.project.location);
429
+ //#endregion
430
+ },
431
+ enumerable: false,
432
+ configurable: true
433
+ });
434
+ //#endregion
435
+ //#region methods & getters / rename origin
436
+ /**
437
+ * TODO does this make any sense
438
+ */
439
+ BaseGit.prototype.renameOrigin = function (newNameOrUlr) {
440
+ //#region @backendFunc
441
+ if (!newNameOrUlr.endsWith('.git')) {
442
+ newNameOrUlr = newNameOrUlr + '.git';
443
+ }
444
+ var oldOrigin = this.project.git.originURL;
445
+ if (!newNameOrUlr.startsWith('git@') &&
446
+ !newNameOrUlr.startsWith('https://')) {
447
+ newNameOrUlr = oldOrigin.replace(tnp_core_2.path.basename(oldOrigin), newNameOrUlr);
448
+ }
449
+ try {
450
+ this.project.run("git remote rm origin").sync();
451
+ }
452
+ catch (error) { }
453
+ try {
454
+ this.project.run("git remote add origin ".concat(newNameOrUlr)).sync();
455
+ index_1.Helpers.info("Origin changed:\n from: ".concat(oldOrigin, "\n to: ").concat(newNameOrUlr, "\n"));
456
+ }
457
+ catch (e) {
458
+ index_1.Helpers.error("Not able to change origin.. reverting to old", true, true);
459
+ this.project.run("git remote add origin ".concat(oldOrigin)).sync();
460
+ }
461
+ //#endregion
462
+ };
463
+ //#endregion
464
+ //#region getters & methods / translate git commit from args
465
+ /**
466
+ * By default no translation of commit
467
+ */
468
+ BaseGit.prototype.transalteGitCommitFromArgs = function () {
469
+ return { from: void 0, to: void 0 };
470
+ };
471
+ //#endregion
472
+ //#region getters & methods / us git branches when commiting and pushing
473
+ /**
474
+ * By defult true.. when commit branches will not function.
475
+ * (false is better for simple projects)
476
+ */
477
+ BaseGit.prototype.useGitBranchesWhenCommitingAndPushing = function () {
478
+ return true;
479
+ };
480
+ //#endregion
481
+ //#region getters & methods / automatically add all changes when pushing to git
482
+ /**
483
+ * usefull when pushing in project with childrens as git repos
484
+ */
485
+ BaseGit.prototype.automaticallyAddAllChnagesWhenPushingToGit = function () {
486
+ return false;
487
+ };
488
+ //#endregion
489
+ //#region getters & methods / use git branches as metadata for commits
490
+ /**
491
+ * usefull when pushing in project with childrens as git repos
492
+ */
493
+ BaseGit.prototype.useGitBranchesAsMetadataForCommits = function () {
494
+ return true;
495
+ };
496
+ //#endregion
497
+ //#region getters & methods / clone to
498
+ BaseGit.prototype.cloneTo = function (cwd, newProjectName) {
499
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
500
+ var dest, res;
501
+ return tslib_1.__generator(this, function (_a) {
502
+ switch (_a.label) {
503
+ case 0:
504
+ //#region @backendFunc
505
+ if (!newProjectName) {
506
+ newProjectName = tnp_core_2.path.basename(this.project.location);
507
+ }
508
+ dest = (0, tnp_core_2.crossPlatformPath)([newProjectName, newProjectName]);
509
+ if (!tnp_core_1.fse.existsSync(dest)) return [3 /*break*/, 2];
510
+ return [4 /*yield*/, index_1.Helpers.questionYesNo("Folder ".concat(newProjectName, " alredy exist, delete it ?"))];
511
+ case 1:
512
+ res = _a.sent();
513
+ if (res) {
514
+ index_1.Helpers.tryRemoveDir(dest);
515
+ }
516
+ else {
517
+ index_1.Helpers.pressKeyAndContinue('Operation not completed... press any key');
518
+ return [2 /*return*/, false];
519
+ }
520
+ _a.label = 2;
521
+ case 2:
522
+ index_1.Helpers.info("Cloning ".concat(this.project.name, "..."));
523
+ // @LAST copy instead cloning
524
+ index_1.Helpers.git.clone({
525
+ cwd: cwd,
526
+ url: this.project.git.remoteOriginUrl,
527
+ destinationFolderName: newProjectName,
528
+ });
529
+ index_1.Helpers.info("Clone success");
530
+ return [2 /*return*/, true];
531
+ }
532
+ });
533
+ });
534
+ };
535
+ //#endregion
536
+ //#region methods & getters / push process
537
+ BaseGit.prototype.pullProcess = function (cloneChildren) {
538
+ if (cloneChildren === void 0) { cloneChildren = false; }
539
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
540
+ var uncommitedChanges, location, childrenRepos, childrenRepos_1, childrenRepos_1_1, child, e_1_1;
541
+ var e_1, _a;
542
+ return tslib_1.__generator(this, function (_b) {
543
+ switch (_b.label) {
544
+ case 0:
545
+ //#region @backendFunc
546
+ return [4 /*yield*/, this._beforePullProcessAction(cloneChildren)];
547
+ case 1:
548
+ //#region @backendFunc
549
+ _b.sent();
550
+ uncommitedChanges = this.project.git.thereAreSomeUncommitedChange;
551
+ if (uncommitedChanges) {
552
+ index_1.Helpers.warn("Stashing uncommit changes... in ".concat(this.project.genericName));
553
+ try {
554
+ this.project.git.stageAllFiles();
555
+ }
556
+ catch (error) { }
557
+ try {
558
+ this.project.git.stash();
559
+ }
560
+ catch (error) { }
561
+ }
562
+ return [4 /*yield*/, this.project.git.pullCurrentBranch({ askToRetry: true })];
563
+ case 2:
564
+ _b.sent();
565
+ location = this.project.location;
566
+ this.project.ins.unload(this);
567
+ this.project.ins.add(this.project.ins.From(location));
568
+ return [4 /*yield*/, this.project.linkedProjects.saveLocationToDB()];
569
+ case 3:
570
+ _b.sent();
571
+ if (!(this.automaticallyAddAllChnagesWhenPushingToGit() || cloneChildren)) return [3 /*break*/, 11];
572
+ childrenRepos = this.project.children.filter(function (f) { return f.git.isInsideGitRepo && f.git.isGitRoot; });
573
+ _b.label = 4;
574
+ case 4:
575
+ _b.trys.push([4, 9, 10, 11]);
576
+ childrenRepos_1 = tslib_1.__values(childrenRepos), childrenRepos_1_1 = childrenRepos_1.next();
577
+ _b.label = 5;
578
+ case 5:
579
+ if (!!childrenRepos_1_1.done) return [3 /*break*/, 8];
580
+ child = childrenRepos_1_1.value;
581
+ return [4 /*yield*/, child.pullProcess()];
582
+ case 6:
583
+ _b.sent();
584
+ _b.label = 7;
585
+ case 7:
586
+ childrenRepos_1_1 = childrenRepos_1.next();
587
+ return [3 /*break*/, 5];
588
+ case 8: return [3 /*break*/, 11];
589
+ case 9:
590
+ e_1_1 = _b.sent();
591
+ e_1 = { error: e_1_1 };
592
+ return [3 /*break*/, 11];
593
+ case 10:
594
+ try {
595
+ if (childrenRepos_1_1 && !childrenRepos_1_1.done && (_a = childrenRepos_1.return)) _a.call(childrenRepos_1);
596
+ }
597
+ finally { if (e_1) throw e_1.error; }
598
+ return [7 /*endfinally*/];
599
+ case 11: return [4 /*yield*/, this.project.linkedProjects.saveAllLinkedProjectsToDB()];
600
+ case 12:
601
+ _b.sent();
602
+ return [2 /*return*/];
603
+ }
604
+ });
605
+ });
606
+ };
607
+ //#endregion
608
+ //#region methods & getters / push process
609
+ BaseGit.prototype.pushProcess = function (options) {
610
+ var _a, _b;
611
+ if (options === void 0) { options = {}; }
612
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
613
+ var _c, force, typeofCommit, forcePushNoQuestion, _d, origin, exitCallBack, _e, args, commitMessageRequired, skipChildren, commitData, error_2, childrenRepos, childrenRepos_2, childrenRepos_2_1, child, e_2_1;
614
+ var e_2, _f;
615
+ var _this = this;
616
+ return tslib_1.__generator(this, function (_g) {
617
+ switch (_g.label) {
618
+ case 0:
619
+ _c = options.force, force = _c === void 0 ? false : _c, typeofCommit = options.typeofCommit, forcePushNoQuestion = options.forcePushNoQuestion, _d = options.origin, origin = _d === void 0 ? 'origin' : _d, exitCallBack = options.exitCallBack, _e = options.args, args = _e === void 0 ? [] : _e, commitMessageRequired = options.commitMessageRequired, skipChildren = options.skipChildren;
620
+ return [4 /*yield*/, this._beforePushProcessAction()];
621
+ case 1:
622
+ _g.sent();
623
+ return [4 /*yield*/, this.project.linkedProjects.saveLocationToDB()];
624
+ case 2:
625
+ _g.sent();
626
+ return [4 /*yield*/, this._getCommitMessage(typeofCommit, args, commitMessageRequired)];
627
+ case 3:
628
+ commitData = _g.sent();
629
+ if (!this.automaticallyAddAllChnagesWhenPushingToGit()) {
630
+ if ((_a = commitData.commitMessage) === null || _a === void 0 ? void 0 : _a.split(':').map(function (p) { return p.trim(); }).every(function (p) { return p === _this.project.git.currentBranchName; })) {
631
+ // QUICK_FIX
632
+ index_1.Helpers.error("\n\n Please provide more specific commit message than branch name\n\n\n ", false, true);
633
+ }
634
+ }
635
+ _g.label = 4;
636
+ case 4:
637
+ if (!true) return [3 /*break*/, 10];
638
+ _g.label = 5;
639
+ case 5:
640
+ _g.trys.push([5, 7, , 9]);
641
+ return [4 /*yield*/, this.project.lint()];
642
+ case 6:
643
+ _g.sent();
644
+ return [3 /*break*/, 10];
645
+ case 7:
646
+ error_2 = _g.sent();
647
+ index_1.Helpers.warn('Fix your code...');
648
+ return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Try again lint before commit ?')];
649
+ case 8:
650
+ if (!(_g.sent())) {
651
+ return [3 /*break*/, 10];
652
+ }
653
+ return [3 /*break*/, 9];
654
+ case 9: return [3 /*break*/, 4];
655
+ case 10:
656
+ if (!!commitData.isActionCommit) return [3 /*break*/, 14];
657
+ index_1.Helpers.info("\n\n PROJECT: ".concat(this.project.genericName, "\n\n Current commit:\n - message to include {").concat(commitData.commitMessage, "}\n ").concat(this.useGitBranchesAsMetadataForCommits()
658
+ ? "- branch to checkout ".concat(commitData.branchName)
659
+ : '- using current branch', "\n "));
660
+ if (!(this.project.git.lastCommitMessage() === commitData.commitMessage)) return [3 /*break*/, 12];
661
+ return [4 /*yield*/, index_1.Helpers.questionYesNo('Soft reset last commit with same message ?')];
662
+ case 11:
663
+ if (_g.sent()) {
664
+ this.project.git.resetSoftHEAD(1);
665
+ }
666
+ _g.label = 12;
667
+ case 12: return [4 /*yield*/, index_1.Helpers.questionYesNo('Commit and push this ?')];
668
+ case 13:
669
+ if (!(_g.sent())) {
670
+ exitCallBack();
671
+ }
672
+ _g.label = 14;
673
+ case 14:
674
+ if (this.automaticallyAddAllChnagesWhenPushingToGit()) {
675
+ // my project
676
+ this.project.git.stageAllFiles();
677
+ }
678
+ if (this.useGitBranchesAsMetadataForCommits()) {
679
+ index_1.Helpers.info('Checkingout branches (if needed)...');
680
+ if (((_b = this.project.git.currentBranchName) === null || _b === void 0 ? void 0 : _b.trim()) !== commitData.branchName) {
681
+ try {
682
+ this.project.git.checkout(commitData.branchName, {
683
+ createBranchIfNotExists: true,
684
+ });
685
+ }
686
+ catch (error) {
687
+ index_1.Helpers.error('Please modyfiy you commit message or delete branch,');
688
+ }
689
+ }
690
+ }
691
+ try {
692
+ this.project.git.commit(commitData.commitMessage);
693
+ }
694
+ catch (error) {
695
+ index_1.Helpers.warn("Not commiting anything... ");
696
+ }
697
+ return [4 /*yield*/, this.project.git.pushCurrentBranch({
698
+ force: force,
699
+ origin: origin,
700
+ forcePushNoQuestion: forcePushNoQuestion,
701
+ askToRetry: true,
702
+ })];
703
+ case 15:
704
+ _g.sent();
705
+ if (!(this.automaticallyAddAllChnagesWhenPushingToGit() && !skipChildren)) return [3 /*break*/, 23];
706
+ if (this.project.linkedProjects.getLinkedProjectsConfig().skipRecrusivePush) {
707
+ index_1.Helpers.warn("Skipping recrusive (children) push for ".concat(this.project.genericName));
708
+ return [2 /*return*/];
709
+ }
710
+ childrenRepos = this.project.children.filter(function (f) { return f.git.isInsideGitRepo && f.git.isGitRoot; });
711
+ _g.label = 16;
712
+ case 16:
713
+ _g.trys.push([16, 21, 22, 23]);
714
+ childrenRepos_2 = tslib_1.__values(childrenRepos), childrenRepos_2_1 = childrenRepos_2.next();
715
+ _g.label = 17;
716
+ case 17:
717
+ if (!!childrenRepos_2_1.done) return [3 /*break*/, 20];
718
+ child = childrenRepos_2_1.value;
719
+ return [4 /*yield*/, child.git.pushProcess(options)];
720
+ case 18:
721
+ _g.sent();
722
+ _g.label = 19;
723
+ case 19:
724
+ childrenRepos_2_1 = childrenRepos_2.next();
725
+ return [3 /*break*/, 17];
726
+ case 20: return [3 /*break*/, 23];
727
+ case 21:
728
+ e_2_1 = _g.sent();
729
+ e_2 = { error: e_2_1 };
730
+ return [3 /*break*/, 23];
731
+ case 22:
732
+ try {
733
+ if (childrenRepos_2_1 && !childrenRepos_2_1.done && (_f = childrenRepos_2.return)) _f.call(childrenRepos_2);
734
+ }
735
+ finally { if (e_2) throw e_2.error; }
736
+ return [7 /*endfinally*/];
737
+ case 23: return [4 /*yield*/, this.project.linkedProjects.saveAllLinkedProjectsToDB()];
738
+ case 24:
739
+ _g.sent();
740
+ return [2 /*return*/];
741
+ }
742
+ });
743
+ });
744
+ };
745
+ //#endregion
746
+ //#region methods & getters / before any action on git root
747
+ BaseGit.prototype._beforeAnyActionOnGitRoot = function () {
748
+ //#region @backendFunc
749
+ if (!this.project.git.isInsideGitRepo) {
750
+ index_1.Helpers.error("Project ".concat(tnp_core_1.chalk.bold(this.project.name), " is not a git repository\n locaiton: ").concat(this.project.location), false, true);
751
+ }
752
+ if (!this.project.git.isGitRoot) {
753
+ index_1.Helpers.error("Project ".concat(tnp_core_1.chalk.bold(this.project.name), " is not a git root\n locaiton: ").concat(this.project.location), false, true);
754
+ }
755
+ //#endregion
756
+ };
757
+ //#endregion
758
+ //#region methods & getters / before push action
759
+ BaseGit.prototype._beforePushProcessAction = function () {
760
+ var _a;
761
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
762
+ return tslib_1.__generator(this, function (_b) {
763
+ switch (_b.label) {
764
+ case 0:
765
+ //#region @backendFunc
766
+ this._beforeAnyActionOnGitRoot();
767
+ if (!(this.project.git.isInsideGitRepo &&
768
+ this.project.git.isGitRoot &&
769
+ !((_a = this.project.git.currentBranchName) === null || _a === void 0 ? void 0 : _a.trim()))) return [3 /*break*/, 2];
770
+ return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Repository is empty...Commit "master" branch and commit all as "first commit" ?')];
771
+ case 1:
772
+ if (_b.sent()) {
773
+ this.project.git.checkout('master');
774
+ this.project.git.stageAllFiles();
775
+ this.project.git.commit('first commit ');
776
+ }
777
+ _b.label = 2;
778
+ case 2: return [4 /*yield*/, this.project.linkedProjects.cloneUnexistedLinkedProjects('push')];
779
+ case 3:
780
+ _b.sent();
781
+ return [2 /*return*/];
782
+ }
783
+ });
784
+ });
785
+ };
786
+ //#endregion
787
+ //#region methods & getters / before push action
788
+ BaseGit.prototype._beforePullProcessAction = function (cloneChildren) {
789
+ if (cloneChildren === void 0) { cloneChildren = false; }
790
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
791
+ return tslib_1.__generator(this, function (_a) {
792
+ switch (_a.label) {
793
+ case 0:
794
+ //#region @backendFunc
795
+ this._beforeAnyActionOnGitRoot();
796
+ return [4 /*yield*/, this.project.linkedProjects.cloneUnexistedLinkedProjects('pull', cloneChildren)];
797
+ case 1:
798
+ _a.sent();
799
+ return [2 /*return*/];
800
+ }
801
+ });
802
+ });
803
+ };
804
+ //#endregion
805
+ //#region methods & getters / resovle commit message
806
+ BaseGit.prototype._getCommitMessage = function (typeofCommit, args, commitMessageRequired) {
807
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
808
+ var commitData, argsCommitData, commitDataBranch, argsCommitData, _a, from, to, _b, _c, _d;
809
+ return tslib_1.__generator(this, function (_e) {
810
+ switch (_e.label) {
811
+ case 0:
812
+ if (!this.useGitBranchesWhenCommitingAndPushing()) return [3 /*break*/, 5];
813
+ return [4 /*yield*/, index_1.CommitData.getFromArgs(args, typeofCommit)];
814
+ case 1:
815
+ argsCommitData = _e.sent();
816
+ if (!argsCommitData.message) return [3 /*break*/, 2];
817
+ commitData = argsCommitData;
818
+ return [3 /*break*/, 4];
819
+ case 2: return [4 /*yield*/, index_1.CommitData.getFromBranch(this.project.git.currentBranchName)];
820
+ case 3:
821
+ commitDataBranch = _e.sent();
822
+ commitData = commitDataBranch;
823
+ _e.label = 4;
824
+ case 4: return [3 /*break*/, 7];
825
+ case 5: return [4 /*yield*/, index_1.CommitData.getFromArgs(args, typeofCommit)];
826
+ case 6:
827
+ argsCommitData = _e.sent();
828
+ // console.log({ argsCommitData })
829
+ // console.log(argsCommitData)
830
+ if (!argsCommitData.message && commitMessageRequired) {
831
+ index_1.Helpers.error('Please provide message in argument', false, true);
832
+ }
833
+ if (!argsCommitData.message) {
834
+ argsCommitData.message = index_1.Helpers.git.ACTION_MSG_RESET_GIT_HARD_COMMIT;
835
+ }
836
+ commitData = argsCommitData;
837
+ _e.label = 7;
838
+ case 7:
839
+ if (!(commitData.message !== index_1.Helpers.git.ACTION_MSG_RESET_GIT_HARD_COMMIT)) return [3 /*break*/, 9];
840
+ _a = this.transalteGitCommitFromArgs(), from = _a.from, to = _a.to;
841
+ if (!(from && to)) return [3 /*break*/, 9];
842
+ _b = commitData;
843
+ _d = (_c = tnp_core_2._).kebabCase;
844
+ return [4 /*yield*/, (0, translate_1.translate)(commitData.message, { from: from, to: to })];
845
+ case 8:
846
+ _b.message = _d.apply(_c, [_e.sent()]);
847
+ _e.label = 9;
848
+ case 9: return [2 /*return*/, commitData];
849
+ }
850
+ });
851
+ });
852
+ };
853
+ return BaseGit;
854
+ }(base_feature_for_project_1.BaseFeatureForProject));
855
+ exports.BaseGit = BaseGit;
856
+ //# sourceMappingURL=base-git.js.map