tnp-helpers 19.0.76 → 21.0.2

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 (97) hide show
  1. package/browser/fesm2022/tnp-helpers.mjs +294 -102
  2. package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
  3. package/browser/lib/base/classes/base-db.d.ts +1 -1
  4. package/browser/lib/base/classes/base-global-command-line.d.ts +2 -0
  5. package/browser/lib/build-info._auto-generated_.d.ts +1 -1
  6. package/browser/lib/utils.d.ts +28 -4
  7. package/browser/package.json +1 -1
  8. package/lib/base/classes/base-cli-worker/base-cli-worker-database-config.js +1 -1
  9. package/lib/base/classes/base-cli-worker/base-cli-worker-database-config.js.map +1 -1
  10. package/lib/base/classes/base-cli-worker/base-cli-worker.utils.js +1 -1
  11. package/lib/base/classes/base-cli-worker/base-cli-worker.utils.js.map +1 -1
  12. package/lib/base/classes/base-db.d.ts +2 -2
  13. package/lib/base/classes/base-db.js +5 -3
  14. package/lib/base/classes/base-db.js.map +1 -1
  15. package/lib/base/classes/base-global-command-line.backend.d.ts +13 -1
  16. package/lib/base/classes/base-global-command-line.backend.js +416 -11
  17. package/lib/base/classes/base-global-command-line.backend.js.map +1 -1
  18. package/lib/base/classes/base-global-command-line.d.ts +2 -0
  19. package/lib/base/classes/base-global-command-line.js +182 -141
  20. package/lib/base/classes/base-global-command-line.js.map +1 -1
  21. package/lib/base/classes/base-process/base-process-api.service.d.ts +7 -0
  22. package/lib/base/classes/base-process/base-process.context.d.ts +19 -0
  23. package/lib/base/classes/base-process/base-process.context.js +22 -0
  24. package/lib/base/classes/base-process/base-process.context.js.map +1 -0
  25. package/lib/base/classes/base-process/base-process.controller.d.ts +17 -0
  26. package/lib/base/classes/base-process/base-process.controller.js +91 -0
  27. package/lib/base/classes/base-process/base-process.controller.js.map +1 -0
  28. package/lib/base/classes/base-process/base-process.d.ts +8 -0
  29. package/lib/base/classes/base-process/base-process.defaults-values.d.ts +2 -0
  30. package/lib/base/classes/base-process/base-process.defaults-values.js +9 -0
  31. package/lib/base/classes/base-process/base-process.defaults-values.js.map +1 -0
  32. package/lib/base/classes/base-process/base-process.js +62 -0
  33. package/lib/base/classes/base-process/base-process.js.map +1 -0
  34. package/lib/base/classes/base-process/base-process.models.d.ts +6 -0
  35. package/lib/base/classes/base-process/base-process.models.js +3 -0
  36. package/lib/base/classes/base-process/base-process.models.js.map +1 -0
  37. package/lib/base/classes/base-process/base-process.provider.d.ts +16 -0
  38. package/lib/base/classes/base-process/base-process.provider.js +69 -0
  39. package/lib/base/classes/base-process/base-process.provider.js.map +1 -0
  40. package/lib/base/classes/base-process/base-process.repository copy.d.ts +8 -0
  41. package/lib/base/classes/base-process/base-process.repository copy.js +32 -0
  42. package/lib/base/classes/base-process/base-process.repository copy.js.map +1 -0
  43. package/lib/base/classes/base-process/base-process.repository.d.ts +8 -0
  44. package/lib/base/classes/base-process/base-process.repository.js +32 -0
  45. package/lib/base/classes/base-process/base-process.repository.js.map +1 -0
  46. package/lib/base/classes/base-process/base-process.terminal-ui.d.ts +11 -0
  47. package/lib/base/classes/base-process/base-process.terminal-ui.js +54 -0
  48. package/lib/base/classes/base-process/base-process.terminal-ui.js.map +1 -0
  49. package/lib/base/classes/base-process/base-process.worker.d.ts +16 -0
  50. package/lib/base/classes/base-process/base-process.worker.js +29 -0
  51. package/lib/base/classes/base-process/base-process.worker.js.map +1 -0
  52. package/lib/base/classes/base-process/index.d.ts +1 -0
  53. package/lib/base/classes/base-process/index.js +22 -0
  54. package/lib/base/classes/base-process/index.js.map +1 -0
  55. package/lib/base/classes/base-process/processes.repository.d.ts +0 -0
  56. package/lib/base/classes/base-process/processes.repository.js +5 -0
  57. package/lib/base/classes/base-process/processes.repository.js.map +1 -0
  58. package/lib/base/classes/base-vscode.js +5 -1
  59. package/lib/base/classes/base-vscode.js.map +1 -1
  60. package/lib/base/gh-temp-code.js +6 -5
  61. package/lib/base/gh-temp-code.js.map +1 -1
  62. package/lib/base/tcp-udp-ports/not-assignable-port.entity.js +2 -2
  63. package/lib/base/tcp-udp-ports/ports.entity.d.ts +1 -1
  64. package/lib/base/tcp-udp-ports/tcp-udp-ports.context.d.ts +1 -19
  65. package/lib/build-info._auto-generated_.d.ts +1 -1
  66. package/lib/build-info._auto-generated_.js +1 -1
  67. package/lib/build-info._auto-generated_.js.map +1 -1
  68. package/lib/env-backend._auto-generated_.d.ts +34 -0
  69. package/lib/env-backend._auto-generated_.js +38 -0
  70. package/lib/env-backend._auto-generated_.js.map +1 -0
  71. package/lib/env-browser._auto-generated_.d.ts +34 -0
  72. package/lib/env-browser._auto-generated_.js +38 -0
  73. package/lib/env-browser._auto-generated_.js.map +1 -0
  74. package/lib/env.backend.d.ts +34 -0
  75. package/lib/env.backend.js +40 -0
  76. package/lib/env.backend.js.map +1 -0
  77. package/lib/env.browser.d.ts +34 -0
  78. package/lib/helpers/for-backend/helpers-dependencies.backend.d.ts +0 -1
  79. package/lib/helpers/for-backend/helpers-dependencies.backend.js +0 -27
  80. package/lib/helpers/for-backend/helpers-dependencies.backend.js.map +1 -1
  81. package/lib/helpers/for-browser/angular.helper.js +2 -2
  82. package/lib/old/base-component.js +2 -2
  83. package/lib/old/base-formly-component.js +2 -2
  84. package/lib/old/dual-component-ctrl.js +2 -2
  85. package/lib/utils.d.ts +28 -4
  86. package/lib/utils.js +167 -26
  87. package/lib/utils.js.map +1 -1
  88. package/lib/validators/validators-git.js.map +1 -1
  89. package/package.json +5 -5
  90. package/tmp-environment.json +7 -11
  91. package/websql/fesm2022/tnp-helpers.mjs +294 -102
  92. package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
  93. package/websql/lib/base/classes/base-db.d.ts +1 -1
  94. package/websql/lib/base/classes/base-global-command-line.d.ts +2 -0
  95. package/websql/lib/build-info._auto-generated_.d.ts +1 -1
  96. package/websql/lib/utils.d.ts +28 -4
  97. package/websql/package.json +1 -1
@@ -24,6 +24,7 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
24
24
  * TODO return argument not need for now
25
25
  */
26
26
  async cwdIsProject(options) {
27
+ //#region @backendFunc
27
28
  const { requireProjectWithGitRoot } = options || {};
28
29
  if (!!this.project && !requireProjectWithGitRoot) {
29
30
  return true;
@@ -53,22 +54,28 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
53
54
  }
54
55
  }
55
56
  return true;
57
+ //#endregion
56
58
  }
57
59
  //#endregion
58
60
  //#region commands / hosts
59
61
  hosts() {
62
+ //#region @backendFunc
60
63
  index_1.Helpers.run(`code ${(0, lib_3.crossPlatformPath)(lib_5.UtilsNetwork.getEtcHostsPath())}`).sync();
61
64
  process.exit(0);
65
+ //#endregion
62
66
  }
63
67
  //#endregion
64
68
  //#region commands / count commits
65
69
  countCommits() {
70
+ //#region @backendFunc
66
71
  console.log(index_1.Helpers.git.countCommits(this.cwd));
67
72
  this._exit();
73
+ //#endregion
68
74
  }
69
75
  //#endregion
70
76
  //#region commands / remove submodules
71
77
  removeSubmodules() {
78
+ //#region @backendFunc
72
79
  index_1.Helpers.taskStarted('Removing submodules...');
73
80
  for (const folderAbsPath of index_1.Helpers.foldersFrom(this.cwd, {
74
81
  recursive: false,
@@ -82,8 +89,10 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
82
89
  }
83
90
  index_1.Helpers.taskDone('Done');
84
91
  this._exit();
92
+ //#endregion
85
93
  }
86
94
  removeSubmodule() {
95
+ //#region @backendFunc
87
96
  index_1.Helpers.taskStarted(`Removing submodules.. ${this.firstArg}`);
88
97
  if (index_1.Helpers.exists((0, lib_3.crossPlatformPath)([this.cwd, this.firstArg || '', '.git']))) {
89
98
  try {
@@ -93,22 +102,30 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
93
102
  }
94
103
  index_1.Helpers.taskDone('Done');
95
104
  this._exit();
105
+ //#endregion
96
106
  }
97
107
  //#endregion
98
108
  //#region commands / set editor
99
109
  async setEditor() {
110
+ //#region @backendFunc
100
111
  await this.ins.configDb.selectCodeEditor();
101
112
  this._exit();
113
+ //#endregion
102
114
  }
103
115
  //#endregion
104
116
  //#region commands / api update
105
117
  async upapi() {
118
+ //#region @backendFunc
106
119
  await this.apiUpdate();
120
+ //#endregion
107
121
  }
108
122
  async apiup() {
123
+ //#region @backendFunc
109
124
  await this.apiUpdate();
125
+ //#endregion
110
126
  }
111
127
  async apiUpdate() {
128
+ //#region @backendFunc
112
129
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
113
130
  return;
114
131
  }
@@ -123,19 +140,26 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
123
140
  });
124
141
  index_1.Helpers.info('Done');
125
142
  this._exit();
143
+ //#endregion
126
144
  }
127
145
  //#endregion
128
146
  //#region commands / chore update
129
147
  async cu() {
148
+ //#region @backendFunc
130
149
  await this.update();
150
+ //#endregion
131
151
  }
132
152
  async choreUpdate() {
153
+ //#region @backendFunc
133
154
  await this.update();
155
+ //#endregion
134
156
  }
135
157
  //#endregion
136
158
  //#region commands / color vscode
137
159
  colorvscode() {
160
+ //#region @backendFunc
138
161
  this.settingsVscode();
162
+ //#endregion
139
163
  }
140
164
  //#endregion
141
165
  //#region commands / settings vscode
@@ -143,14 +167,20 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
143
167
  * Generate or update .vscode/settings.json file color settings
144
168
  */
145
169
  settingsVscode() {
170
+ //#region @backendFunc
146
171
  this.refreshVscodeColors();
172
+ //#endregion
147
173
  }
148
174
  refreshVscodeColors() {
175
+ //#region @backendFunc
149
176
  this._regenerateVscodeSettingsColors();
150
177
  this._exit();
178
+ //#endregion
151
179
  }
152
180
  _regenerateVscodeSettingsColors(overideBottomColor) {
181
+ //#region @backendFunc
153
182
  index_1.UtilsVSCode.regenerateVsCodeSettingsColors(this.cwd, overideBottomColor);
183
+ //#endregion
154
184
  }
155
185
  //#endregion
156
186
  //#region commands / quick git update
@@ -158,6 +188,7 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
158
188
  * quick git update push
159
189
  */
160
190
  async update() {
191
+ //#region @backendFunc
161
192
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
162
193
  return;
163
194
  }
@@ -172,8 +203,10 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
172
203
  });
173
204
  index_1.Helpers.info('Done');
174
205
  this._exit();
206
+ //#endregion
175
207
  }
176
208
  async updateProject(project, force = false) {
209
+ //#region @backendFunc
177
210
  try {
178
211
  await project.packageJson.bumpPatchVersion();
179
212
  }
@@ -194,14 +227,20 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
194
227
  }
195
228
  }
196
229
  }
230
+ //#endregion
197
231
  }
198
232
  async deepUp(noExit = false) {
233
+ //#region @backendFunc
199
234
  await this.deepUpdate(noExit);
235
+ //#endregion
200
236
  }
201
237
  async deepUpForce(noExit = false) {
238
+ //#region @backendFunc
202
239
  await this.deepUpdateForce(noExit);
240
+ //#endregion
203
241
  }
204
242
  async deepUpdateForce(noExit = false) {
243
+ //#region @backendFunc
205
244
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
206
245
  return;
207
246
  }
@@ -209,8 +248,10 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
209
248
  await this.updateProject(this.project, true);
210
249
  index_1.Helpers.info('Done');
211
250
  this._exit();
251
+ //#endregion
212
252
  }
213
253
  async deepUpdate(noExit = false) {
254
+ //#region @backendFunc
214
255
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
215
256
  return;
216
257
  }
@@ -218,22 +259,28 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
218
259
  await this.updateProject(this.project);
219
260
  index_1.Helpers.info('Done');
220
261
  this._exit();
262
+ //#endregion
221
263
  }
222
264
  /**
223
265
  * Push update
224
266
  */
225
267
  async up() {
268
+ //#region @backendFunc
226
269
  await this.update();
270
+ //#endregion
227
271
  }
228
272
  /**
229
273
  * Push update
230
274
  */
231
275
  async pu() {
276
+ //#region @backendFunc
232
277
  await this.update();
278
+ //#endregion
233
279
  }
234
280
  //#endregion
235
281
  //#region commands / develop
236
282
  async develop() {
283
+ //#region @backendFunc
237
284
  // Helpers.clearConsole();
238
285
  index_1.Helpers.taskStarted(`getting all projects...`);
239
286
  const founded = ((await this.ins.projectsDb.getAllProjectsFromDB()) || [])
@@ -297,28 +344,38 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
297
344
  await openInEditor(this.ins.From(res));
298
345
  }
299
346
  this._exit();
347
+ //#endregion
300
348
  }
301
349
  async dev() {
350
+ //#region @backendFunc
302
351
  return await this.develop();
352
+ //#endregion
303
353
  }
304
354
  //#endregion
305
355
  //#region commands / repulll
306
356
  async repul() {
357
+ //#region @backendFunc
307
358
  await this.repull();
359
+ //#endregion
308
360
  }
309
361
  async repull() {
362
+ //#region @backendFunc
310
363
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
311
364
  return;
312
365
  }
313
366
  await this.project.git.resetHard({ HEAD: 10 });
314
367
  await this.pull();
368
+ //#endregion
315
369
  }
316
370
  //#endregion
317
371
  //#region commands / pull
318
372
  async pul() {
373
+ //#region @backendFunc
319
374
  await this.pull();
375
+ //#endregion
320
376
  }
321
377
  async pull() {
378
+ //#region @backendFunc
322
379
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
323
380
  return;
324
381
  }
@@ -326,10 +383,12 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
326
383
  setOrigin: this.params['setOrigin'],
327
384
  });
328
385
  this._exit();
386
+ //#endregion
329
387
  }
330
388
  //#endregion
331
389
  //#region commands / pull all
332
390
  async pullAll() {
391
+ //#region @backendFunc
333
392
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
334
393
  return;
335
394
  }
@@ -337,20 +396,24 @@ class BaseGlobalCommandLine extends base_command_line_feature_1.BaseCommandLineF
337
396
  setOrigin: this.params['setOrigin'],
338
397
  });
339
398
  this._exit();
399
+ //#endregion
340
400
  }
341
401
  //#endregion
342
402
  //#region commands / push and pull
343
403
  async pp() {
404
+ //#region @backendFunc
344
405
  const currentBranch = this.project.git.currentBranchName;
345
406
  this.project
346
407
  .run(`git push origin ${currentBranch} && git pull origin ${currentBranch}`)
347
408
  .sync();
348
409
  console.log('Done push and pull');
349
410
  this._exit();
411
+ //#endregion
350
412
  }
351
413
  //#endregion
352
414
  //#region commands / reset
353
415
  __resetInfo(branchToReset, withChildren) {
416
+ //#region @backendFunc
354
417
  index_1.Helpers.info(`
355
418
 
356
419
  YOU ARE RESETING ${withChildren ? 'EVERYTHING' : 'PROJECT'} ` +
@@ -365,15 +428,19 @@ ${withChildren &&
365
428
  .join('\n')}`
366
429
  : ''}
367
430
  `);
431
+ //#endregion
368
432
  }
369
433
  async fetch() {
434
+ //#region @backendFunc
370
435
  try {
371
436
  this.project?.git?.fetch();
372
437
  }
373
438
  catch (error) { }
374
439
  this._exit();
440
+ //#endregion
375
441
  }
376
442
  async reset() {
443
+ //#region @backendFunc
377
444
  // Helpers.clearConsole();
378
445
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
379
446
  return;
@@ -432,10 +499,12 @@ ${withChildren &&
432
499
  await resetProject.resetProcess(overrideBranchToReset);
433
500
  }
434
501
  this._exit();
502
+ //#endregion
435
503
  }
436
504
  //#endregion
437
505
  //#region commands / soft
438
506
  async soft() {
507
+ //#region @backendFunc
439
508
  // TODO when aciton commit
440
509
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
441
510
  return;
@@ -446,10 +515,12 @@ ${withChildren &&
446
515
  this.project.git.resetSoftHEAD(1);
447
516
  });
448
517
  this._exit();
518
+ //#endregion
449
519
  }
450
520
  //#endregion
451
521
  //#region commands / rebase
452
522
  async rebase() {
523
+ //#region @backendFunc
453
524
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
454
525
  return;
455
526
  }
@@ -509,6 +580,7 @@ ${withChildren &&
509
580
  index_1.Helpers.error('Not able to rebase', true, true);
510
581
  }
511
582
  this._exit();
583
+ //#endregion
512
584
  }
513
585
  //#endregion
514
586
  //#region commands / stash
@@ -516,12 +588,14 @@ ${withChildren &&
516
588
  * stash only staged files
517
589
  */
518
590
  async stash() {
591
+ //#region @backendFunc
519
592
  index_1.Helpers.info(`Stashing only staged files...`);
520
593
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
521
594
  return;
522
595
  }
523
596
  this.project.git.stash({ onlyStaged: true });
524
597
  this._exit();
598
+ //#endregion
525
599
  }
526
600
  //#endregion
527
601
  //#region commands / stash all
@@ -529,12 +603,14 @@ ${withChildren &&
529
603
  * stash all files
530
604
  */
531
605
  async stashAll() {
606
+ //#region @backendFunc
532
607
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
533
608
  return;
534
609
  }
535
610
  this.project.git.stageAllFiles();
536
611
  this.project.git.stash();
537
612
  this._exit();
613
+ //#endregion
538
614
  }
539
615
  //#endregion
540
616
  //#region commands / push all origins
@@ -542,24 +618,33 @@ ${withChildren &&
542
618
  * push force to all orgins
543
619
  */
544
620
  async pushAllForce() {
621
+ //#region @backendFunc
545
622
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
546
623
  return;
547
624
  }
548
625
  await this.pushAll(true);
626
+ //#endregion
549
627
  }
550
628
  async pAllForce() {
629
+ //#region @backendFunc
551
630
  await this.pushAllForce();
631
+ //#endregion
552
632
  }
553
633
  async pAllf() {
634
+ //#region @backendFunc
554
635
  await this.pushAllForce();
636
+ //#endregion
555
637
  }
556
638
  async pAll() {
639
+ //#region @backendFunc
557
640
  await this.pushAll();
641
+ //#endregion
558
642
  }
559
643
  /**
560
644
  * push to all origins
561
645
  */
562
646
  async pushAll(force = false) {
647
+ //#region @backendFunc
563
648
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
564
649
  return;
565
650
  }
@@ -578,14 +663,19 @@ ${remotes.map((r, i) => `${i + 1}. ${r.origin} ${r.url}`).join('\n')}
578
663
  index_1.Helpers.taskDone(`Pushed to ${origin}`);
579
664
  }
580
665
  this._exit();
666
+ //#endregion
581
667
  }
582
668
  //#endregion
583
669
  //#region commands / push force
584
670
  async forcePush() {
671
+ //#region @backendFunc
585
672
  await this.push({ force: true, typeofCommit: 'feature' });
673
+ //#endregion
586
674
  }
587
675
  async pushForce() {
676
+ //#region @backendFunc
588
677
  await this.push({ force: true, typeofCommit: 'feature' });
678
+ //#endregion
589
679
  }
590
680
  //#endregion
591
681
  //#region commands / commit
@@ -593,6 +683,7 @@ ${remotes.map((r, i) => `${i + 1}. ${r.origin} ${r.url}`).join('\n')}
593
683
  * Commit and push this for single repo
594
684
  */
595
685
  async commit(options = {}) {
686
+ //#region @backendFunc
596
687
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
597
688
  return;
598
689
  }
@@ -613,10 +704,12 @@ ${remotes.map((r, i) => `${i + 1}. ${r.origin} ${r.url}`).join('\n')}
613
704
  return;
614
705
  }
615
706
  this._exit();
707
+ //#endregion
616
708
  }
617
709
  //#endregion
618
710
  //#region commands / push
619
711
  async _preventPushPullFromNotCorrectBranch() {
712
+ //#region @backendFunc
620
713
  while (true) {
621
714
  const devBranch = this.project.git.duringPushWarnIfProjectNotOnSpecyficDevBranch();
622
715
  if (!!devBranch && devBranch !== this.project.git.currentBranchName) {
@@ -654,17 +747,25 @@ ${remotes.map((r, i) => `${i + 1}. ${r.origin} ${r.url}`).join('\n')}
654
747
  }
655
748
  return;
656
749
  }
750
+ //#endregion
657
751
  }
658
752
  async qPush() {
753
+ //#region @backendFunc
659
754
  await this.quickPush();
755
+ //#endregion
660
756
  }
661
757
  async quickPush() {
758
+ //#region @backendFunc
662
759
  await this.push({ skipLint: true });
760
+ //#endregion
663
761
  }
664
762
  async repushauto() {
763
+ //#region @backendFunc
665
764
  await this.rePush(true);
765
+ //#endregion
666
766
  }
667
767
  async rePush(skipQuesion = false) {
768
+ //#region @backendFunc
668
769
  const lastCommitMessage = this.project.git.lastCommitMessage();
669
770
  this.project.git.resetSoftHEAD();
670
771
  this.project.git.stageAllFiles();
@@ -683,8 +784,10 @@ ${lastCommitMessage}
683
784
  force: true,
684
785
  });
685
786
  this._exit();
787
+ //#endregion
686
788
  }
687
789
  async push(options = {}) {
790
+ //#region @backendFunc
688
791
  // console.log('args', this.args);
689
792
  // console.log(`argsWithParams "${this.argsWithParams}"` );
690
793
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
@@ -717,19 +820,23 @@ ${lastCommitMessage}
717
820
  return;
718
821
  }
719
822
  this._exit();
823
+ //#endregion
720
824
  }
721
825
  //#endregion
722
826
  //#region commands / melt
723
827
  async melt() {
828
+ //#region @backendFunc
724
829
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
725
830
  return;
726
831
  }
727
832
  await this.meltUpdateCommits({ hideInfo: true });
728
833
  this._exit();
834
+ //#endregion
729
835
  }
730
836
  //#endregion
731
837
  //#region commands / melt
732
838
  async meltUp() {
839
+ //#region @backendFunc
733
840
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
734
841
  return;
735
842
  }
@@ -751,10 +858,12 @@ ${lastCommitMessage}
751
858
  await processProject(this.project);
752
859
  index_1.Helpers.info('All projects are up to date with remote');
753
860
  this._exit();
861
+ //#endregion
754
862
  }
755
863
  //#endregion
756
864
  //#region commands / melt
757
865
  async meltAll() {
866
+ //#region @backendFunc
758
867
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
759
868
  return;
760
869
  }
@@ -763,10 +872,12 @@ ${lastCommitMessage}
763
872
  await this.__meltCommitsFunc(child, { hideInfo: true });
764
873
  }
765
874
  this._exit();
875
+ //#endregion
766
876
  }
767
877
  //#endregion
768
878
  //#region commands / melt updat ecommits
769
879
  async __meltCommitsFunc(project, options) {
880
+ //#region @backendFunc
770
881
  options = options || {};
771
882
  const meltedCommits = project.git.meltActionCommits();
772
883
  if (meltedCommits > 0) {
@@ -775,22 +886,32 @@ ${lastCommitMessage}
775
886
  else {
776
887
  index_1.Helpers.logInfo(`No commits to melt for project ${project.genericName}`);
777
888
  }
889
+ //#endregion
778
890
  }
779
891
  async meltUpdateCommits(options) {
892
+ //#region @backendFunc
780
893
  await this.__meltCommitsFunc(this.project, options);
894
+ //#endregion
781
895
  }
782
896
  //#endregion
783
897
  //#region commands / push feature
784
898
  async pf() {
899
+ //#region @backendFunc
785
900
  await this.pushFeature();
901
+ //#endregion
786
902
  }
787
903
  async pRel() {
904
+ //#region @backendFunc
788
905
  await this.pushRelease();
906
+ //#endregion
789
907
  }
790
908
  async pRelease() {
909
+ //#region @backendFunc
791
910
  await this.pushRelease();
911
+ //#endregion
792
912
  }
793
913
  async pushRelease() {
914
+ //#region @backendFunc
794
915
  await this.meltUpdateCommits();
795
916
  await this.push({
796
917
  typeofCommit: 'release',
@@ -798,120 +919,174 @@ ${lastCommitMessage}
798
919
  overrideCommitMessage: `${lib_2._.first(this.project.releaseProcess.getReleaseWords())} ` +
799
920
  `version ${this.project.packageJson.version}`,
800
921
  });
922
+ //#endregion
801
923
  }
802
924
  async mPush() {
925
+ //#region @backendFunc
803
926
  await this.meltPush();
927
+ //#endregion
804
928
  }
805
929
  async fmPush() {
930
+ //#region @backendFunc
806
931
  await this.forceMeltPush();
932
+ //#endregion
807
933
  }
808
934
  async mfPush() {
935
+ //#region @backendFunc
809
936
  await this.forceMeltPush();
937
+ //#endregion
810
938
  }
811
939
  async mforcePush() {
940
+ //#region @backendFunc
812
941
  await this.forceMeltPush();
942
+ //#endregion
813
943
  }
814
944
  async meltforcePush() {
945
+ //#region @backendFunc
815
946
  await this.forceMeltPush();
947
+ //#endregion
816
948
  }
817
949
  async forceMeltPush() {
950
+ //#region @backendFunc
818
951
  await this.meltPush(true);
952
+ //#endregion
819
953
  }
820
954
  async meltPush(force = false) {
955
+ //#region @backendFunc
821
956
  await this.meltUpdateCommits();
822
957
  await this.push({
823
958
  mergeUpdateCommits: true,
824
959
  force,
825
960
  });
961
+ //#endregion
826
962
  }
827
963
  async pushFeature() {
964
+ //#region @backendFunc
828
965
  await this.meltUpdateCommits();
829
966
  await this.push({ typeofCommit: 'feature', commitMessageRequired: true });
967
+ //#endregion
830
968
  }
831
969
  //#endregion
832
970
  //#region commands / push fix
833
971
  async pushFix() {
972
+ //#region @backendFunc
834
973
  await this.meltUpdateCommits();
835
974
  await this.push({ typeofCommit: 'bugfix', commitMessageRequired: true });
975
+ //#endregion
836
976
  }
837
977
  pfix() {
978
+ //#region @backendFunc
838
979
  this.pushFix();
980
+ //#endregion
839
981
  }
840
982
  //#endregion
841
983
  //#region commands / push chore
842
984
  async pushChore() {
985
+ //#region @backendFunc
843
986
  await this.meltUpdateCommits();
844
987
  await this.push({ typeofCommit: 'chore', commitMessageRequired: true });
988
+ //#endregion
845
989
  }
846
990
  async pc() {
991
+ //#region @backendFunc
847
992
  await this.pushChore();
993
+ //#endregion
848
994
  }
849
995
  //#endregion
850
996
  //#region commands / push refactor
851
997
  async pushRefactor() {
998
+ //#region @backendFunc
852
999
  await this.meltUpdateCommits();
853
1000
  await this.push({ typeofCommit: 'refactor', commitMessageRequired: true });
1001
+ //#endregion
854
1002
  }
855
1003
  async pushref() {
1004
+ //#region @backendFunc
856
1005
  await this.pushRefactor();
1006
+ //#endregion
857
1007
  }
858
1008
  async pref() {
1009
+ //#region @backendFunc
859
1010
  await this.pushRefactor();
1011
+ //#endregion
860
1012
  }
861
1013
  //#endregion
862
1014
  //#region commands / push style
863
1015
  async pushStyle() {
1016
+ //#region @backendFunc
864
1017
  await this.meltUpdateCommits();
865
1018
  await this.push({ typeofCommit: 'style', commitMessageRequired: true });
1019
+ //#endregion
866
1020
  }
867
1021
  async pstyl() {
1022
+ //#region @backendFunc
868
1023
  await this.pushStyle();
1024
+ //#endregion
869
1025
  }
870
1026
  async pstyle() {
1027
+ //#region @backendFunc
871
1028
  await this.pushStyle();
1029
+ //#endregion
872
1030
  }
873
1031
  //#endregion
874
1032
  //#region commands / push docs
875
1033
  async pushDocs() {
1034
+ //#region @backendFunc
876
1035
  await this.meltUpdateCommits();
877
1036
  await this.push({ typeofCommit: 'docs', commitMessageRequired: true });
1037
+ //#endregion
878
1038
  }
879
1039
  async pd() {
1040
+ //#region @backendFunc
880
1041
  await this.pushDocs();
1042
+ //#endregion
881
1043
  }
882
1044
  async pdocs() {
1045
+ //#region @backendFunc
883
1046
  await this.pushDocs();
1047
+ //#endregion
884
1048
  }
885
1049
  //#endregion
886
1050
  //#region commands / push test
887
1051
  async pushTest() {
1052
+ //#region @backendFunc
888
1053
  await this.meltUpdateCommits();
889
1054
  await this.push({ typeofCommit: 'test', commitMessageRequired: true });
1055
+ //#endregion
890
1056
  }
891
1057
  async pTest() {
1058
+ //#region @backendFunc
892
1059
  await this.pushTest();
1060
+ //#endregion
893
1061
  }
894
1062
  async pTests() {
1063
+ //#region @backendFunc
895
1064
  await this.pushTest();
1065
+ //#endregion
896
1066
  }
897
1067
  //#endregion
898
1068
  //#region commands / push perf
899
1069
  async pushPerf() {
1070
+ //#region @backendFunc
900
1071
  await this.meltUpdateCommits();
901
1072
  await this.push({
902
1073
  typeofCommit: 'performance',
903
1074
  commitMessageRequired: true,
904
1075
  });
1076
+ //#endregion
905
1077
  }
906
1078
  //#endregion
907
1079
  //#region commands / push ci
908
1080
  async pushCi() {
1081
+ //#region @backendFunc
909
1082
  await this.meltUpdateCommits();
910
1083
  await this.push({ typeofCommit: 'ci', commitMessageRequired: true });
1084
+ //#endregion
911
1085
  }
912
1086
  //#endregion
913
1087
  //#region commands / select branch
914
1088
  async branch() {
1089
+ //#region @backendFunc
915
1090
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
916
1091
  return;
917
1092
  }
@@ -935,16 +1110,20 @@ ${lastCommitMessage}
935
1110
  catch (error) { }
936
1111
  this.project.git.checkout(branchName);
937
1112
  this._exit();
1113
+ //#endregion
938
1114
  }
939
1115
  //#endregion
940
1116
  //#region commands / push build
941
1117
  async pushBuild() {
1118
+ //#region @backendFunc
942
1119
  await this.meltUpdateCommits();
943
1120
  await this.push({ typeofCommit: 'build', commitMessageRequired: true });
1121
+ //#endregion
944
1122
  }
945
1123
  //#endregion
946
1124
  //#region commands / set origin
947
1125
  async SET_ORIGIN() {
1126
+ //#region @backendFunc
948
1127
  let newOriginNameOrUrl = this.firstArg;
949
1128
  if (newOriginNameOrUrl === 'ssh') {
950
1129
  newOriginNameOrUrl = index_1.Helpers.git.originHttpToSsh(index_1.Helpers.git.getOriginURL(this.cwd));
@@ -963,10 +1142,12 @@ ${lastCommitMessage}
963
1142
  index_1.Helpers.error(`This folder is not a git repo... `, false, true);
964
1143
  }
965
1144
  this._exit();
1145
+ //#endregion
966
1146
  }
967
1147
  //#endregion
968
1148
  //#region commands / rename origin
969
1149
  async RENAME_ORIGIN() {
1150
+ //#region @backendFunc
970
1151
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
971
1152
  return;
972
1153
  }
@@ -979,19 +1160,23 @@ ${lastCommitMessage}
979
1160
  index_1.Helpers.error(`This folder is not a git repo... `, false, true);
980
1161
  }
981
1162
  this._exit();
1163
+ //#endregion
982
1164
  }
983
1165
  //#endregion
984
1166
  //#region commands / last hash tag
985
1167
  async LAST_TAG_HASH() {
1168
+ //#region @backendFunc
986
1169
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
987
1170
  return;
988
1171
  }
989
1172
  index_1.Helpers.info(this.project.git.lastTagHash());
990
1173
  this._exit();
1174
+ //#endregion
991
1175
  }
992
1176
  //#endregion
993
1177
  //#region commands / last tag
994
1178
  async LAST_TAG() {
1179
+ //#region @backendFunc
995
1180
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
996
1181
  return;
997
1182
  }
@@ -1003,12 +1188,15 @@ ${lastCommitMessage}
1003
1188
 
1004
1189
  `);
1005
1190
  this._exit();
1191
+ //#endregion
1006
1192
  }
1007
1193
  //#endregion
1008
1194
  //#region commands / check tag exists
1009
1195
  CHECK_TAG_EXISTS() {
1196
+ //#region @backendFunc
1010
1197
  index_1.Helpers.info(`tag "${this.firstArg}" exits = ${index_1.Helpers.git.checkTagExists(this.firstArg)} `);
1011
1198
  this._exit();
1199
+ //#endregion
1012
1200
  }
1013
1201
  //#endregion
1014
1202
  //#region commands / lint
@@ -1016,10 +1204,12 @@ ${lastCommitMessage}
1016
1204
  * TODO move somewhere
1017
1205
  */
1018
1206
  async lint() {
1207
+ //#region @backendFunc
1019
1208
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
1020
1209
  return;
1021
1210
  }
1022
1211
  await this.project.lint();
1212
+ //#endregion
1023
1213
  }
1024
1214
  //#endregion
1025
1215
  //#region commands / version
@@ -1027,11 +1217,13 @@ ${lastCommitMessage}
1027
1217
  * TODO move somewhere
1028
1218
  */
1029
1219
  async version() {
1220
+ //#region @backendFunc
1030
1221
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: false }))) {
1031
1222
  return;
1032
1223
  }
1033
1224
  console.log('Current project verison: ' + this.project.packageJson.version);
1034
1225
  this._exit();
1226
+ //#endregion
1035
1227
  }
1036
1228
  //#endregion
1037
1229
  //#region commands / init
@@ -1039,16 +1231,19 @@ ${lastCommitMessage}
1039
1231
  * TODO move somewhere
1040
1232
  */
1041
1233
  async init() {
1234
+ //#region @backendFunc
1042
1235
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: false }))) {
1043
1236
  return;
1044
1237
  }
1045
1238
  await this.project.init();
1046
1239
  this._exit();
1240
+ //#endregion
1047
1241
  }
1048
1242
  /**
1049
1243
  * init parent and first level children
1050
1244
  */
1051
1245
  async initAll() {
1246
+ //#region @backendFunc
1052
1247
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: false }))) {
1053
1248
  return;
1054
1249
  }
@@ -1057,6 +1252,7 @@ ${lastCommitMessage}
1057
1252
  await child.init();
1058
1253
  }
1059
1254
  this._exit();
1255
+ //#endregion
1060
1256
  }
1061
1257
  //#endregion
1062
1258
  //#region commands / struct
@@ -1064,11 +1260,13 @@ ${lastCommitMessage}
1064
1260
  * TODO move somewhere
1065
1261
  */
1066
1262
  async struct() {
1263
+ //#region @backendFunc
1067
1264
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: false }))) {
1068
1265
  return;
1069
1266
  }
1070
1267
  await this.project.struct();
1071
1268
  this._exit();
1269
+ //#endregion
1072
1270
  }
1073
1271
  //#endregion
1074
1272
  //#region commands / info
@@ -1076,6 +1274,7 @@ ${lastCommitMessage}
1076
1274
  * TODO move somewhere
1077
1275
  */
1078
1276
  async info() {
1277
+ //#region @backendFunc
1079
1278
  if (!(await this.cwdIsProject({
1080
1279
  requireProjectWithGitRoot: false,
1081
1280
  }))) {
@@ -1085,10 +1284,12 @@ ${lastCommitMessage}
1085
1284
  index_1.Helpers.info(await this.project.info());
1086
1285
  await this.project.linkedProjects.saveAllLinkedProjectsToDB();
1087
1286
  this._exit();
1287
+ //#endregion
1088
1288
  }
1089
1289
  //#endregion
1090
1290
  //#region commands / info
1091
1291
  async modified() {
1292
+ //#region @backendFunc
1092
1293
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
1093
1294
  return;
1094
1295
  }
@@ -1106,38 +1307,46 @@ ${lastCommitMessage}
1106
1307
  .join('\n')
1107
1308
  : 'Nothing modifed');
1108
1309
  this._exit();
1310
+ //#endregion
1109
1311
  }
1110
1312
  //#endregion
1111
1313
  //#region commands / update
1112
1314
  async refresh() {
1315
+ //#region @backendFunc
1113
1316
  await this.project.refreshChildrenProjects({
1114
1317
  askUserAboutUpdate: true,
1115
1318
  });
1116
1319
  this._exit(0);
1320
+ //#endregion
1117
1321
  }
1118
1322
  //#endregion
1119
1323
  //#region commands / changes
1120
1324
  async changes() {
1325
+ //#region @backendFunc
1121
1326
  index_1.Helpers.info(await this.project.git.changesSummary());
1122
1327
  index_1.Helpers.terminalLine();
1123
1328
  for (const chil of this.project.children) {
1124
1329
  index_1.Helpers.info(await chil.git.changesSummary());
1125
1330
  }
1126
1331
  this._exit();
1332
+ //#endregion
1127
1333
  }
1128
1334
  //#endregion
1129
1335
  //#region commands / all tags
1130
1336
  async allTags() {
1337
+ //#region @backendFunc
1131
1338
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: true }))) {
1132
1339
  return;
1133
1340
  }
1134
1341
  const allTags = await index_1.Helpers.git.getAllTags(this.cwd);
1135
1342
  console.log(allTags);
1136
1343
  this._exit();
1344
+ //#endregion
1137
1345
  }
1138
1346
  //#endregion
1139
1347
  //#region commands / remove tag
1140
1348
  async removeTag() {
1349
+ //#region @backendFunc
1141
1350
  let tagToRemove = this.firstArg;
1142
1351
  if (!tagToRemove) {
1143
1352
  const allTags = await index_1.Helpers.git.getAllTags(this.cwd);
@@ -1151,94 +1360,128 @@ ${lastCommitMessage}
1151
1360
  }
1152
1361
  index_1.Helpers.git.removeTag(this.cwd, tagToRemove);
1153
1362
  this._exit();
1363
+ //#endregion
1154
1364
  }
1155
1365
  //#endregion
1156
1366
  //#region commands / branch name
1157
1367
  BRANCH_NAME() {
1368
+ //#region @backendFunc
1158
1369
  console.log(`current branch name: "${index_1.Helpers.git.currentBranchName(process.cwd())}"`);
1159
1370
  this._exit();
1371
+ //#endregion
1160
1372
  }
1161
1373
  //#endregion
1162
1374
  //#region commands / remotes
1163
1375
  REMOTES() {
1376
+ //#region @backendFunc
1164
1377
  console.log(index_1.Helpers.git.allOrigins(this.cwd));
1165
1378
  this._exit();
1379
+ //#endregion
1166
1380
  }
1167
1381
  async SET_REMOTE_SSH() {
1382
+ //#region @backendFunc
1168
1383
  await index_1.Helpers.git.changeRemoteFromHttpsToSSh(this.cwd);
1169
1384
  this._exit();
1385
+ //#endregion
1170
1386
  }
1171
1387
  async SET_REMOTE_http() {
1388
+ //#region @backendFunc
1172
1389
  await index_1.Helpers.git.changeRemoveFromSshToHttps(this.cwd);
1173
1390
  this._exit();
1391
+ //#endregion
1174
1392
  }
1175
1393
  async SET_REMOTE_https() {
1394
+ //#region @backendFunc
1176
1395
  await this.SET_REMOTE_http();
1396
+ //#endregion
1177
1397
  }
1178
1398
  _resolveChildFromArg() {
1399
+ //#region @backendFunc
1179
1400
  const { resolved: projFromArg, clearedCommand } = index_1.Helpers.cliTool.resolveItemFromArgsBegin(this.args, arg => this.ins.From([this.cwd, arg]));
1180
1401
  if (!!projFromArg) {
1181
1402
  this.args = clearedCommand.split(' ');
1182
1403
  this.cwd = projFromArg.location;
1183
1404
  this.project = projFromArg;
1184
1405
  }
1406
+ //#endregion
1185
1407
  }
1186
1408
  origin() {
1409
+ //#region @backendFunc
1187
1410
  this._resolveChildFromArg();
1188
1411
  console.log(index_1.Helpers.git.getOriginURL(this.cwd));
1189
1412
  this._exit();
1413
+ //#endregion
1190
1414
  }
1191
1415
  remote() {
1416
+ //#region @backendFunc
1192
1417
  console.log(index_1.Helpers.git.getOriginURL(this.cwd));
1193
1418
  this._exit();
1419
+ //#endregion
1194
1420
  }
1195
1421
  originHttp() {
1422
+ //#region @backendFunc
1196
1423
  console.log(index_1.Helpers.git.originSshToHttp(index_1.Helpers.git.getOriginURL(this.cwd)));
1197
1424
  this._exit();
1425
+ //#endregion
1198
1426
  }
1199
1427
  originHttps() {
1428
+ //#region @backendFunc
1200
1429
  console.log(index_1.Helpers.git.originSshToHttp(index_1.Helpers.git.getOriginURL(this.cwd)));
1201
1430
  this._exit();
1431
+ //#endregion
1202
1432
  }
1203
1433
  originssh() {
1434
+ //#region @backendFunc
1204
1435
  console.log(index_1.Helpers.git.originHttpToSsh(index_1.Helpers.git.getOriginURL(this.cwd)));
1205
1436
  this._exit();
1437
+ //#endregion
1206
1438
  }
1207
1439
  origins() {
1440
+ //#region @backendFunc
1208
1441
  this.REMOTES();
1442
+ //#endregion
1209
1443
  }
1210
1444
  //#endregion
1211
1445
  //#region commands / git config
1212
1446
  gitConfig() {
1447
+ //#region @backendFunc
1213
1448
  const root = index_1.Helpers.git.findGitRoot(this.cwd);
1214
1449
  index_1.Helpers.run(`code ${(0, lib_3.crossPlatformPath)([root, '.git', 'config'])}`).sync();
1215
1450
  this._exit();
1451
+ //#endregion
1216
1452
  }
1217
1453
  //#endregion
1218
1454
  //#region commands / lastCommitHash
1219
1455
  LAST_COMMIT_HASH() {
1456
+ //#region @backendFunc
1220
1457
  console.log(index_1.Helpers.git.lastCommitHash(this.cwd));
1221
1458
  this._exit();
1459
+ //#endregion
1222
1460
  }
1223
1461
  //#endregion
1224
1462
  //#region commands / commit message by hash
1225
1463
  async COMMIT_MESSAGE_BY_HASH() {
1464
+ //#region @backendFunc
1226
1465
  const hash = this.firstArg;
1227
1466
  console.log(await this.project.git.getCommitMessageByHash(hash));
1228
1467
  this._exit();
1468
+ //#endregion
1229
1469
  }
1230
1470
  //#endregion
1231
1471
  //#region commands / last 5 commit hashes
1232
1472
  async LAST_5_COMMITS() {
1473
+ //#region @backendFunc
1233
1474
  for (let index = 0; index < 5; index++) {
1234
1475
  const hash = await this.project.git.getCommitHashByIndex(index);
1235
1476
  console.log(hash);
1236
1477
  }
1237
1478
  this._exit();
1479
+ //#endregion
1238
1480
  }
1239
1481
  //#endregion
1240
1482
  //#region commands / update deps from
1241
1483
  async updateDepsFrom() {
1484
+ //#region @backendFunc
1242
1485
  let locations = this.args.join(' ').trim() === '' ? [] : this.args;
1243
1486
  if (lib_2._.isArray(locations)) {
1244
1487
  locations = locations.map(l => {
@@ -1250,37 +1493,51 @@ ${lastCommitMessage}
1250
1493
  }
1251
1494
  this.project.packageJson.updateDepsFrom(locations);
1252
1495
  this._exit();
1496
+ //#endregion
1253
1497
  }
1254
1498
  //#endregion
1255
1499
  //#region is terminal supported
1256
1500
  isSupportedTaonTerminal() {
1501
+ //#region @backendFunc
1257
1502
  console.log(`Terminal is supported: ${index_1.Helpers.isSupportedTaonTerminal}`);
1258
1503
  this._exit();
1504
+ //#endregion
1259
1505
  }
1260
1506
  //#endregion
1261
1507
  //#region is terminal running inside cmd
1262
1508
  isRunningInWindowsCmd() {
1509
+ //#region @backendFunc
1263
1510
  console.log(`Is terminal running insdie cmd.exe: ${lib_2.UtilsOs.isRunningInWindowsCmd()}`);
1264
1511
  this._exit();
1512
+ //#endregion
1265
1513
  }
1266
1514
  //#endregion
1267
1515
  //#region is running inside powershell
1268
1516
  isRunningInWindowsPowerShell() {
1517
+ //#region @backendFunc
1269
1518
  console.log(`Is terminal running insdie powershell: ${lib_2.UtilsOs.isRunningInWindowsPowerShell()}`);
1270
1519
  this._exit();
1520
+ //#endregion
1271
1521
  }
1272
1522
  //#endregion
1273
1523
  //#region prox ext
1274
1524
  async INSTALL_PROJECT_EXTENSIONS() {
1525
+ //#region @backendFunc
1275
1526
  await this.INSTALL_PROJ_EXT();
1527
+ //#endregion
1276
1528
  }
1277
1529
  async INSTALL_PROJECT_EXT() {
1530
+ //#region @backendFunc
1278
1531
  await this.INSTALL_PROJ_EXT();
1532
+ //#endregion
1279
1533
  }
1280
1534
  async INS_PROJ_EXT() {
1535
+ //#region @backendFunc
1281
1536
  await this.INSTALL_PROJ_EXT();
1537
+ //#endregion
1282
1538
  }
1283
1539
  async INSTALL_PROJ_EXT() {
1540
+ //#region @backendFunc
1284
1541
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: false }))) {
1285
1542
  return;
1286
1543
  }
@@ -1290,10 +1547,12 @@ ${lastCommitMessage}
1290
1547
  index_1.Helpers.clearConsole();
1291
1548
  await this.project.vsCodeHelpers.installExtensions(extensions.recommendations, true);
1292
1549
  this._exit();
1550
+ //#endregion
1293
1551
  }
1294
1552
  //#endregion
1295
1553
  //#region proj db
1296
1554
  async projdb() {
1555
+ //#region @backendFunc
1297
1556
  if (!(await this.cwdIsProject({ requireProjectWithGitRoot: false }))) {
1298
1557
  return;
1299
1558
  }
@@ -1305,18 +1564,22 @@ ${lastCommitMessage}
1305
1564
  `);
1306
1565
  index_1.Helpers.run(`code ${this.project.linkedProjects.projectsDbLocation}`).sync();
1307
1566
  this._exit();
1567
+ //#endregion
1308
1568
  }
1309
1569
  //#endregion
1310
1570
  //#region filter all project branches by pattern
1311
1571
  __filterBranchesByPattern(branchPatternOrBranchName) {
1572
+ //#region @backendFunc
1312
1573
  const branches = index_1.Helpers.arrays.uniqArray(this.project.git.getBranchesNamesBy(branchPatternOrBranchName) ||
1313
1574
  this.project.getMainBranches());
1314
1575
  // console.log('branches', branches);
1315
1576
  return branches;
1577
+ //#endregion
1316
1578
  }
1317
1579
  //#endregion
1318
1580
  //#region select branch from list of branches
1319
1581
  async __selectBrach(branches, task) {
1582
+ //#region @backendFunc
1320
1583
  const actionWithoutChildren = task === 'reset' && !this.project.git.resetIsRestingAlsoChildren();
1321
1584
  const childrenMsg = actionWithoutChildren
1322
1585
  ? '(without children)'
@@ -1326,10 +1589,12 @@ ${lastCommitMessage}
1326
1589
  return await index_1.Helpers.autocompleteAsk(`Choose branch to ${task} in this project ${childrenMsg}: `, branches.map(b => {
1327
1590
  return { name: b, value: b };
1328
1591
  }));
1592
+ //#endregion
1329
1593
  }
1330
1594
  //#endregion
1331
1595
  //#region commands / clone
1332
1596
  async clone() {
1597
+ //#region @backendFunc
1333
1598
  let url = this.firstArg;
1334
1599
  const originType = this.params['setOrigin'];
1335
1600
  if (originType) {
@@ -1345,57 +1610,85 @@ ${lastCommitMessage}
1345
1610
  cwd: this.cwd,
1346
1611
  });
1347
1612
  this._exit();
1613
+ //#endregion
1348
1614
  }
1349
1615
  //#endregion
1350
1616
  //#region commands / gh temp
1351
1617
  async ghSave() {
1618
+ //#region @backendFunc
1352
1619
  await new gh_temp_code_1.GhTempCode(this.cwd, this.project).init().save();
1353
1620
  this._exit();
1621
+ //#endregion
1354
1622
  }
1355
1623
  async ghRestore() {
1624
+ //#region @backendFunc
1356
1625
  await new gh_temp_code_1.GhTempCode(this.cwd, this.project).init().restore();
1357
1626
  this._exit();
1627
+ //#endregion
1358
1628
  }
1359
1629
  //#endregion
1360
1630
  //#region commands / start cli service ports worker
1361
1631
  async ports() {
1632
+ //#region @backendFunc
1362
1633
  await this.ins.portsWorker.terminalUI.infoScreen();
1634
+ //#endregion
1363
1635
  }
1364
1636
  /**
1365
1637
  * tnp startCliServicePortsWorker --restart
1366
1638
  */
1367
1639
  async startCliServicePortsWorker() {
1640
+ //#region @backendFunc
1368
1641
  await this.ins.portsWorker.cliStartProcedure(this.params);
1642
+ //#endregion
1643
+ }
1644
+ //#endregion
1645
+ //#region commands / wait for any key
1646
+ async waitForUserAnyKey() {
1647
+ //#region @backendFunc
1648
+ console.log('Press any key to exit...');
1649
+ await lib_4.UtilsTerminal.waitForUserAnyKey(async () => {
1650
+ console.log('Exiting...');
1651
+ this._exit();
1652
+ });
1653
+ //#endregion
1369
1654
  }
1370
1655
  //#endregion
1371
1656
  //#region commands / pause terminal
1372
1657
  pauseTerminal() {
1658
+ //#region @backendFunc
1373
1659
  index_1.Helpers.pressKeyAndContinue();
1374
1660
  this._exit();
1661
+ //#endregion
1375
1662
  }
1376
1663
  //#endregion
1377
- //#region commands / pause terminal
1664
+ //#region commands / sleep terminal
1378
1665
  sleepTerminal() {
1666
+ //#region @backendFunc
1379
1667
  index_1.Helpers.info(`Sleeping terminal for 1 second... before exit`);
1380
1668
  index_1.Helpers.sleep(1);
1381
1669
  this._exit();
1670
+ //#endregion
1382
1671
  }
1383
1672
  //#endregion
1384
1673
  //#region commands / gh pages init
1385
1674
  async ghPagesInit() {
1675
+ //#region @backendFunc
1386
1676
  await this.project.init();
1387
1677
  await this.project.staticPages.init(this.params['provider'] || 'github', !!this.params['full']);
1388
1678
  index_1.Helpers.run('code .', {
1389
1679
  cwd: this.project.staticPages.mainFolderAbsPath,
1390
1680
  }).sync();
1391
1681
  this._exit();
1682
+ //#endregion
1392
1683
  }
1393
1684
  //#endregion
1394
1685
  //#region commands / is port in use
1395
1686
  async isPortInUse() {
1687
+ //#region @backendFunc
1396
1688
  const port = parseInt(this.firstArg);
1397
1689
  console.log(`Port ${port} is in use: ${await lib_2.UtilsOs.isPortInUse(port)}`);
1398
1690
  this._exit();
1691
+ //#endregion
1399
1692
  }
1400
1693
  //#endregion
1401
1694
  //#region commands / proc menu
@@ -1453,9 +1746,12 @@ ${lastCommitMessage}
1453
1746
  //#endregion
1454
1747
  //#region commands / proc info
1455
1748
  procInfo() {
1749
+ //#region @backendFunc
1456
1750
  this.processInfo();
1751
+ //#endregion
1457
1752
  }
1458
1753
  processInfo() {
1754
+ //#region @backendFunc
1459
1755
  index_1.Helpers.info(`
1460
1756
 
1461
1757
  Is running in CLI mode: ${lib_2.UtilsOs.isRunningInCliMode()}
@@ -1471,20 +1767,26 @@ ${lastCommitMessage}
1471
1767
 
1472
1768
  `);
1473
1769
  this._exit();
1770
+ //#endregion
1474
1771
  }
1475
1772
  //#endregion
1476
1773
  //#region commands / last git tag
1477
1774
  lastGitTag() {
1775
+ //#region @backendFunc
1478
1776
  console.log('Latest tag');
1479
1777
  console.log(this.project?.git.lastTagVersionName);
1480
1778
  this._exit();
1779
+ //#endregion
1481
1780
  }
1482
1781
  //#endregion
1483
1782
  //#region commands / check ports
1484
1783
  async checkPort() {
1784
+ //#region @backendFunc
1485
1785
  await this.checkPorts();
1786
+ //#endregion
1486
1787
  }
1487
1788
  async checkPorts() {
1789
+ //#region @backendFunc
1488
1790
  const ports = this.args
1489
1791
  .join(' ')
1490
1792
  .replace(/\,/, '')
@@ -1501,37 +1803,47 @@ ${lastCommitMessage}
1501
1803
  console.log(`Port ${port} is in use: ${isPortInUse ? lib_2.chalk.red('YES') : lib_2.chalk.green('NO')}`);
1502
1804
  }
1503
1805
  this._exit();
1806
+ //#endregion
1504
1807
  }
1505
1808
  //#endregion
1506
1809
  //#region commands / remove symlinks
1507
1810
  removeSymlinksDryRun() {
1811
+ //#region @backendFunc
1508
1812
  index_1.Helpers.removeSymlinks(this.project.nodeModules.path, {
1509
1813
  dryRun: true,
1510
1814
  });
1815
+ //#endregion
1511
1816
  }
1512
1817
  //#endregion
1513
1818
  //#region commands / select java
1514
1819
  async selectJava() {
1820
+ //#region @backendFunc
1515
1821
  const selectedJava = await index_1.UtilsJava.selectJdkVersion();
1516
1822
  index_1.UtilsJava.updateJavaHomePath(selectedJava);
1823
+ //#endregion
1517
1824
  }
1518
1825
  //#endregion
1519
1826
  //#region commands / select tomcat
1520
1827
  async selectTomcat() {
1828
+ //#region @backendFunc
1521
1829
  const selectedTomcat = await index_1.UtilsJava.selectTomcatVersion();
1522
1830
  index_1.UtilsJava.updateTomcatHomePath(selectedTomcat);
1523
1831
  this._exit();
1832
+ //#endregion
1524
1833
  }
1525
1834
  //#endregion
1526
1835
  //#region commands / ln
1527
1836
  LN() {
1837
+ //#region @backendFunc
1528
1838
  const [source, dest] = this.args;
1529
1839
  index_1.Helpers.createSymLink(source, dest);
1530
1840
  this._exit();
1841
+ //#endregion
1531
1842
  }
1532
1843
  //#endregion
1533
1844
  //#region commands / copy
1534
1845
  copy() {
1846
+ //#region @backendFunc
1535
1847
  let [from, to] = this.args;
1536
1848
  from = lib_2.path.isAbsolute(from)
1537
1849
  ? (0, lib_3.crossPlatformPath)(from)
@@ -1554,6 +1866,7 @@ ${lastCommitMessage}
1554
1866
  }
1555
1867
  index_1.Helpers.taskDone(`Copied`);
1556
1868
  this._exit();
1869
+ //#endregion
1557
1870
  }
1558
1871
  //#endregion
1559
1872
  //#region commands / simulate domain
@@ -1567,6 +1880,7 @@ ${lastCommitMessage}
1567
1880
  //#endregion
1568
1881
  //#region commands / preview
1569
1882
  async preview() {
1883
+ //#region @backendFunc
1570
1884
  //#region handle preview of docker compose
1571
1885
  if ([lib_1.fileName.docker_compose_yml, lib_1.fileName.compose_yml].includes(lib_2.path.basename(this.firstArg))) {
1572
1886
  const simulateDomain = this.params['domain'] || this.params['domains'];
@@ -1579,8 +1893,8 @@ ${lastCommitMessage}
1579
1893
  // import { readFileSync } from 'fs';
1580
1894
  // import { resolve } from 'path';
1581
1895
  const envPath = (0, lib_3.crossPlatformPath)([cwd, '.env']);
1582
- const COMPOSE_PROJECT_NAME = index_1.UtilsDotFile.getValueFromDotFile(envPath, 'COMPOSE_PROJECT_NAME');
1583
- const envContent = index_1.UtilsDotFile.getValuesKeysAsJsonObject(envPath) || {};
1896
+ const COMPOSE_PROJECT_NAME = lib_5.UtilsDotFile.getValueFromDotFile(envPath, 'COMPOSE_PROJECT_NAME');
1897
+ const envContent = lib_5.UtilsDotFile.getValuesKeysAsJsonObject(envPath) || {};
1584
1898
  const allDomains = lib_2.Utils.uniqArray(Object.keys(envContent)
1585
1899
  .filter(key => {
1586
1900
  return key.startsWith('FRONTEND_HOST_URL_');
@@ -1606,7 +1920,7 @@ ${lastCommitMessage}
1606
1920
  triggerRevertChangesToEtcHosts,
1607
1921
  });
1608
1922
  }
1609
- const child = this.project.docker.getDockerComposeUpExecChildProcess('up');
1923
+ const child = project.docker.getDockerComposeUpExecChildProcess('up');
1610
1924
  console.log(`
1611
1925
 
1612
1926
 
@@ -1628,7 +1942,7 @@ ${lastCommitMessage}
1628
1942
  console.log('Stopping container...');
1629
1943
  child.kill('SIGINT');
1630
1944
  console.log('Exiting...');
1631
- const downProcess = this.project.docker.getDockerComposeUpExecChildProcess('down');
1945
+ const downProcess = project.docker.getDockerComposeUpExecChildProcess('down');
1632
1946
  downProcess.on('close', code => {
1633
1947
  console.log(`docker compose down exited with code ${code}`);
1634
1948
  process.exit(0);
@@ -1639,6 +1953,7 @@ ${lastCommitMessage}
1639
1953
  index_1.Helpers.error(`You can preview only docker-compose.yml or compose.yml files`, false, true);
1640
1954
  }
1641
1955
  //#endregion
1956
+ //#endregion
1642
1957
  }
1643
1958
  //#endregion
1644
1959
  //#region commands / shorten
@@ -1667,6 +1982,7 @@ ${lastCommitMessage}
1667
1982
  //#endregion
1668
1983
  //#region commands / dump packages versions
1669
1984
  dumpPackagesVersions() {
1985
+ //#region @backendFunc
1670
1986
  const getData = (location) => {
1671
1987
  const version = index_1.Helpers.readValueFromJson((0, lib_3.crossPlatformPath)([location, lib_1.fileName.package_json]), 'version');
1672
1988
  const name = index_1.Helpers.readValueFromJson((0, lib_3.crossPlatformPath)([location, lib_1.fileName.package_json]), 'name');
@@ -1692,10 +2008,12 @@ ${lastCommitMessage}
1692
2008
  index_1.Helpers.writeJson([this.cwd, 'packages-versions.json'], pkgs);
1693
2009
  index_1.Helpers.info(`packages-versions.json created with ${pkgs.length} packages`);
1694
2010
  this._exit();
2011
+ //#endregion
1695
2012
  }
1696
2013
  //#endregion
1697
2014
  //#region commands / zip
1698
2015
  async zip() {
2016
+ //#region @backendFunc
1699
2017
  let folderPath = (0, lib_3.crossPlatformPath)(this.firstArg);
1700
2018
  if (!lib_2.path.isAbsolute(folderPath)) {
1701
2019
  folderPath = (0, lib_3.crossPlatformPath)([this.cwd, this.firstArg]);
@@ -1711,10 +2029,12 @@ ${lastCommitMessage}
1711
2029
  });
1712
2030
  index_1.Helpers.info(`Created zip file: ${zipFilePath}`);
1713
2031
  this._exit();
2032
+ //#endregion
1714
2033
  }
1715
2034
  //#endregion
1716
2035
  //#region commands / unzip
1717
2036
  async unzip() {
2037
+ //#region @backendFunc
1718
2038
  let folderPath = (0, lib_3.crossPlatformPath)(this.firstArg);
1719
2039
  if (!lib_2.path.isAbsolute(folderPath)) {
1720
2040
  folderPath = (0, lib_3.crossPlatformPath)([this.cwd, this.firstArg]);
@@ -1725,10 +2045,12 @@ ${lastCommitMessage}
1725
2045
  await index_1.UtilsZip.unzipArchive(folderPath);
1726
2046
  index_1.Helpers.info(`Created zip file: ${folderPath.replace('.zip', '')}`);
1727
2047
  this._exit();
2048
+ //#endregion
1728
2049
  }
1729
2050
  //#endregion
1730
2051
  //#region commands / start transmission
1731
2052
  async startTransmission() {
2053
+ //#region @backendFunc
1732
2054
  await this._removeTransmission();
1733
2055
  const userProfile = process.env.USERPROFILE || lib_2.os.homedir();
1734
2056
  const downloadsDir = lib_2.path.join(userProfile, 'Downloads');
@@ -1775,8 +2097,10 @@ ${lastCommitMessage}
1775
2097
  }
1776
2098
  this._exit();
1777
2099
  });
2100
+ //#endregion
1778
2101
  }
1779
2102
  async _removeTransmission() {
2103
+ //#region @backendFunc
1780
2104
  return new Promise(resolve => {
1781
2105
  const args = ['rm', '-f', 'transmission'];
1782
2106
  console.log('Running:', 'docker', args.join(' '));
@@ -1792,15 +2116,96 @@ ${lastCommitMessage}
1792
2116
  resolve();
1793
2117
  });
1794
2118
  });
2119
+ //#endregion
1795
2120
  }
1796
2121
  //#endregion
1797
- // projectName|-|www-domgrubegozwierzaka-pl||--||releaseType|-|manual||--||version|-|0.0.8||--||
1798
- // envName|-|__||--||envNumber|-|||--||targetArtifact|-|angular-node-app|||||-1759151320202-fa12e3a5cfdd
1799
- extractStringMetadata() {
1800
- const str = this.firstArg || '';
1801
- console.log(str);
1802
- console.log(index_1.FilePathMetaData.extractData(str));
2122
+ //#region commands / backup branch
2123
+ async backupBranch() {
2124
+ //#region @backendFunc
2125
+ await this.project.git.backupBranch(this.firstArg);
1803
2126
  this._exit();
2127
+ //#endregion
2128
+ }
2129
+ async bb() {
2130
+ //#region @backendFunc
2131
+ await this.backupBranch();
2132
+ //#endregion
2133
+ }
2134
+ //#endregion
2135
+ //#region commands / count code lines
2136
+ async countCodeLines() {
2137
+ //#region @backendFunc
2138
+ await this.countLines();
2139
+ //#endregion
2140
+ }
2141
+ async countLines() {
2142
+ //#region @backendFunc
2143
+ let extensions = (this.args || []).filter(f => !!f).map(ext => `.${ext}`);
2144
+ extensions = extensions.length ? extensions : ['.ts', '.tsx'];
2145
+ console.log('Counting SLOC for extensions: ', extensions.join(', '));
2146
+ const sloc = require('sloc');
2147
+ let total = {
2148
+ source: 0,
2149
+ comment: 0,
2150
+ single: 0,
2151
+ block: 0,
2152
+ empty: 0,
2153
+ total: 0,
2154
+ };
2155
+ const skip = [
2156
+ 'node_modules',
2157
+ '.',
2158
+ 'tmp-',
2159
+ 'environments',
2160
+ 'dist',
2161
+ 'browser',
2162
+ ];
2163
+ const walk = (folder) => {
2164
+ const entries = lib_2.fse.readdirSync(folder, { withFileTypes: true });
2165
+ for (const entry of entries) {
2166
+ const fullPath = lib_2.path.join(folder, entry.name);
2167
+ if (skip.some(s => entry.name.startsWith(s))) {
2168
+ continue;
2169
+ }
2170
+ if (entry.isDirectory()) {
2171
+ console.log('Processing: ', lib_2.path.basename(fullPath));
2172
+ walk(fullPath);
2173
+ }
2174
+ else if (extensions.includes(lib_2.path.extname(entry.name))) {
2175
+ const code = lib_2.fse.readFileSync(fullPath, 'utf8');
2176
+ const stats = sloc(code, lib_2.path.extname(entry.name).slice(1)); // e.g., "ts" or "js"
2177
+ for (const key in total) {
2178
+ total[key] += stats[key] ?? 0;
2179
+ }
2180
+ }
2181
+ }
2182
+ };
2183
+ walk((0, lib_3.crossPlatformPath)([
2184
+ this.cwd,
2185
+ // 'src'
2186
+ ]));
2187
+ console.log('📊 SLOC Results:');
2188
+ console.table(total);
2189
+ this._exit?.(); // your existing exit hook
2190
+ return total;
2191
+ //#endregion
2192
+ }
2193
+ //#endregion
2194
+ //#region commands / is node version ok
2195
+ isNodeVersionOk() {
2196
+ //#region @backendFunc
2197
+ try {
2198
+ lib_2.UtilsOs.isNodeVersionOk({
2199
+ throwErrorIfNotOk: true,
2200
+ });
2201
+ console.info(`Node.js version is OK: ${process.version}`);
2202
+ this._exit();
2203
+ }
2204
+ catch (error) {
2205
+ console.error(error);
2206
+ this._exit(1);
2207
+ }
2208
+ //#endregion
1804
2209
  }
1805
2210
  }
1806
2211
  exports.BaseGlobalCommandLine = BaseGlobalCommandLine;