tnp-helpers 16.100.2 → 16.100.4

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 (39) hide show
  1. package/assets/shared/shared_folder_info.txt +1 -1
  2. package/browser/esm2022/lib/base/base-project.mjs +155 -5
  3. package/browser/esm2022/lib/models.mjs +85 -2
  4. package/browser/fesm2022/tnp-helpers.mjs +237 -4
  5. package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
  6. package/browser/lib/base/base-project.d.ts +15 -4
  7. package/browser/lib/models.d.ts +49 -9
  8. package/client/esm2022/lib/base/base-project.mjs +155 -5
  9. package/client/esm2022/lib/models.mjs +85 -2
  10. package/client/fesm2022/tnp-helpers.mjs +237 -4
  11. package/client/fesm2022/tnp-helpers.mjs.map +1 -1
  12. package/client/lib/base/base-project.d.ts +15 -4
  13. package/client/lib/models.d.ts +49 -9
  14. package/client/package.json +174 -124
  15. package/lib/base/base-command-line.backend.d.ts +3 -1
  16. package/lib/base/base-command-line.backend.js +39 -4
  17. package/lib/base/base-command-line.backend.js.map +1 -1
  18. package/lib/base/base-project.d.ts +16 -5
  19. package/lib/base/base-project.js +355 -85
  20. package/lib/base/base-project.js.map +1 -1
  21. package/lib/for-backend/helpers-git.backend.d.ts +5 -2
  22. package/lib/for-backend/helpers-git.backend.js +6 -4
  23. package/lib/for-backend/helpers-git.backend.js.map +1 -1
  24. package/lib/for-browser/angular.helper.js +3 -3
  25. package/lib/models.d.ts +49 -9
  26. package/lib/models.js +107 -0
  27. package/lib/models.js.map +1 -1
  28. package/lib/old/base-component.js +3 -3
  29. package/lib/old/base-formly-component.js +3 -3
  30. package/lib/old/dual-component-ctrl.js +3 -3
  31. package/package.json +5 -5
  32. package/package.json_tnp.json5 +0 -1
  33. package/tmp-environment.json +178 -128
  34. package/websql/esm2022/lib/base/base-project.mjs +155 -5
  35. package/websql/esm2022/lib/models.mjs +85 -2
  36. package/websql/fesm2022/tnp-helpers.mjs +238 -5
  37. package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
  38. package/websql/lib/base/base-project.d.ts +15 -4
  39. package/websql/lib/models.d.ts +49 -9
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseProject = exports.ChildProcess = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  //#region @backend
6
+ var json5Write = require("json10-writer");
6
7
  var tnp_core_1 = require("tnp-core");
7
8
  var child_process_1 = require("child_process");
8
9
  Object.defineProperty(exports, "ChildProcess", { enumerable: true, get: function () { return child_process_1.ChildProcess; } });
@@ -72,6 +73,242 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
72
73
  };
73
74
  //#endregion
74
75
  //#region methods & getters
76
+ BaseProject.prototype.addLinkedProject = function (linkedProj) {
77
+ var linkedProject = tnp_core_3._.isString(linkedProj) ? index_1.LinkedProject.fromName(linkedProj) : linkedProj;
78
+ //#region @backendFunc
79
+ var linkedProjectsConfig = this.getLinkedProjectsConfig();
80
+ linkedProjectsConfig.projects.push(index_1.LinkedProject.from(linkedProject));
81
+ this.setLinkedProjectsConfig(linkedProjectsConfig);
82
+ //#endregion
83
+ };
84
+ BaseProject.prototype.addLinkedProjects = function (linkedProjs) {
85
+ var e_1, _a;
86
+ try {
87
+ //#region @backendFunc
88
+ for (var linkedProjs_1 = tslib_1.__values(linkedProjs), linkedProjs_1_1 = linkedProjs_1.next(); !linkedProjs_1_1.done; linkedProjs_1_1 = linkedProjs_1.next()) {
89
+ var linkedProj = linkedProjs_1_1.value;
90
+ this.addLinkedProject(linkedProj);
91
+ }
92
+ }
93
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
94
+ finally {
95
+ try {
96
+ if (linkedProjs_1_1 && !linkedProjs_1_1.done && (_a = linkedProjs_1.return)) _a.call(linkedProjs_1);
97
+ }
98
+ finally { if (e_1) throw e_1.error; }
99
+ }
100
+ //#endregion
101
+ };
102
+ BaseProject.prototype.setLinkedProjectsConfig = function (linkedPorjectsConfig) {
103
+ //#region @backendFunc
104
+ linkedPorjectsConfig = index_1.LinkedPorjectsConfig.from(linkedPorjectsConfig);
105
+ var writer = json5Write.load(index_1.Helpers.readFile(this.linkedProjectsConfigPath));
106
+ writer.write(linkedPorjectsConfig);
107
+ var removeEmptyLineFromString = function (str) {
108
+ return (str || '').split('\n').filter(function (f) { return !!f.trim(); }).join('\n');
109
+ };
110
+ index_1.Helpers.writeFile(this.linkedProjectsConfigPath, removeEmptyLineFromString(writer.toSource({ quote: 'double', trailingComma: false })));
111
+ // Helpers.writeJson(this.pathFor(config.file.linked_projects_json), linkedPorjectsConfig);
112
+ //#endregion
113
+ };
114
+ Object.defineProperty(BaseProject.prototype, "linkedProjectsConfigPath", {
115
+ get: function () {
116
+ return this.pathFor(tnp_config_1.config.file.linked_projects_json);
117
+ },
118
+ enumerable: false,
119
+ configurable: true
120
+ });
121
+ BaseProject.prototype.recreateLinkedProjectsConfig = function () {
122
+ //#region @backendFunc
123
+ if (!index_1.Helpers.exists(this.linkedProjectsConfigPath)) {
124
+ index_1.Helpers.writeJson(this.linkedProjectsConfigPath, index_1.LinkedPorjectsConfig.from({ projects: [] }));
125
+ }
126
+ //#endregion
127
+ };
128
+ BaseProject.prototype.getLinkedProjectsConfig = function () {
129
+ //#region @backendFunc
130
+ this.recreateLinkedProjectsConfig();
131
+ var existedConfig = index_1.Helpers.readJson(this.pathFor(tnp_config_1.config.file.linked_projects_json), {}, true);
132
+ var orgExistedConfig = tnp_core_3._.cloneDeep(existedConfig);
133
+ // console.log({ existedConfig });
134
+ var linkedPorjectsConfig = index_1.LinkedPorjectsConfig.from(existedConfig);
135
+ var currentRemoteUrl = this.git.originURL;
136
+ var currentBranch = this.git.currentBranchName;
137
+ linkedPorjectsConfig.projects = (linkedPorjectsConfig.projects || []).map(function (projOrProjName) {
138
+ if (tnp_core_3._.isString(projOrProjName)) {
139
+ return index_1.LinkedProject.fromName(projOrProjName, currentRemoteUrl, currentBranch);
140
+ }
141
+ if (!projOrProjName.relativeClonePath) {
142
+ projOrProjName.relativeClonePath = tnp_core_2.path.basename(projOrProjName.remoteUrl()).replace('.git', '');
143
+ }
144
+ projOrProjName = index_1.LinkedProject.from(projOrProjName);
145
+ if (!projOrProjName.remoteUrl()) {
146
+ projOrProjName.repoUrl = currentRemoteUrl.replace(tnp_core_2.path.basename(currentRemoteUrl), "".concat(projOrProjName.relativeClonePath, ".git"));
147
+ }
148
+ return projOrProjName;
149
+ });
150
+ // console.log({ linkedPorjectsConfig })
151
+ linkedPorjectsConfig.projects = index_1.Helpers.uniqArray(linkedPorjectsConfig.projects, 'relativeClonePath');
152
+ if (!tnp_core_3._.isEqual(orgExistedConfig, linkedPorjectsConfig)) {
153
+ this.setLinkedProjectsConfig(linkedPorjectsConfig);
154
+ }
155
+ return linkedPorjectsConfig;
156
+ //#endregion
157
+ };
158
+ Object.defineProperty(BaseProject.prototype, "linkedProjects", {
159
+ //#region methods & getters / linked projects
160
+ get: function () {
161
+ return this.getLinkedProjectsConfig().projects || [];
162
+ },
163
+ enumerable: false,
164
+ configurable: true
165
+ });
166
+ Object.defineProperty(BaseProject.prototype, "detectedLinkedProjects", {
167
+ //#endregion
168
+ get: function () {
169
+ var _this = this;
170
+ var detectedLinkedProjects = index_1.LinkedProject.detect(this.location)
171
+ .filter(function (linkedProj) { return !!_this.ins.From([_this.location, linkedProj.relativeClonePath]); });
172
+ return detectedLinkedProjects;
173
+ },
174
+ enumerable: false,
175
+ configurable: true
176
+ });
177
+ Object.defineProperty(BaseProject.prototype, "linkedProjectsPrefix", {
178
+ get: function () {
179
+ return this.getLinkedProjectsConfig().prefix;
180
+ },
181
+ enumerable: false,
182
+ configurable: true
183
+ });
184
+ Object.defineProperty(BaseProject.prototype, "linkedProjectsExisted", {
185
+ //#region getters & methods / link project exited
186
+ get: function () {
187
+ var _this = this;
188
+ //#region @backendFunc
189
+ return this.linkedProjects
190
+ .map(function (f) {
191
+ var proj = _this.ins.From(_this.pathFor(f.relativeClonePath));
192
+ return proj;
193
+ })
194
+ .filter(function (f) { return !!f; });
195
+ //#endregion
196
+ },
197
+ enumerable: false,
198
+ configurable: true
199
+ });
200
+ //#endregion
201
+ //#region getters & methods / get unexisted projects
202
+ BaseProject.prototype.cloneUnexistedLinkedProjects = function (actionType, cloneChildren) {
203
+ if (cloneChildren === void 0) { cloneChildren = false; }
204
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
205
+ var detectedLinkedProjects, _loop_1, this_1, detectedLinkedProjects_1, detectedLinkedProjects_1_1, detectedLinkedProject, e_2_1, projectsThatShouldBeLinked, _a, projectsThatShouldBeLinked_1, projectsThatShouldBeLinked_1_1, linkedProj, e_3_1;
206
+ var e_2, _b, e_3, _c;
207
+ return tslib_1.__generator(this, function (_d) {
208
+ switch (_d.label) {
209
+ case 0:
210
+ //#region @backendFunc
211
+ if (actionType === 'push' && this.automaticallyAddAllChnagesWhenPushingToGit()) {
212
+ return [2 /*return*/];
213
+ }
214
+ index_1.Helpers.taskStarted("Checking linked projects in ".concat(this.genericName));
215
+ detectedLinkedProjects = this.detectedLinkedProjects;
216
+ _loop_1 = function (detectedLinkedProject) {
217
+ return tslib_1.__generator(this, function (_e) {
218
+ switch (_e.label) {
219
+ case 0:
220
+ if (this_1.linkedProjects.find(function (f) { return f.relativeClonePath === detectedLinkedProject.relativeClonePath; })) {
221
+ return [2 /*return*/, "continue"];
222
+ }
223
+ return [4 /*yield*/, index_1.Helpers.questionYesNo("Do you want to remove unexisted linked project ".concat(detectedLinkedProject.relativeClonePath, " ?"))];
224
+ case 1:
225
+ if (_e.sent()) {
226
+ index_1.Helpers.taskStarted("Removing unexisted project ".concat(detectedLinkedProject.relativeClonePath));
227
+ index_1.Helpers.removeFolderIfExists(this_1.pathFor(detectedLinkedProject.relativeClonePath));
228
+ index_1.Helpers.taskDone("Removed unexisted project ".concat(detectedLinkedProject.relativeClonePath));
229
+ }
230
+ return [2 /*return*/];
231
+ }
232
+ });
233
+ };
234
+ this_1 = this;
235
+ _d.label = 1;
236
+ case 1:
237
+ _d.trys.push([1, 6, 7, 8]);
238
+ detectedLinkedProjects_1 = tslib_1.__values(detectedLinkedProjects), detectedLinkedProjects_1_1 = detectedLinkedProjects_1.next();
239
+ _d.label = 2;
240
+ case 2:
241
+ if (!!detectedLinkedProjects_1_1.done) return [3 /*break*/, 5];
242
+ detectedLinkedProject = detectedLinkedProjects_1_1.value;
243
+ return [5 /*yield**/, _loop_1(detectedLinkedProject)];
244
+ case 3:
245
+ _d.sent();
246
+ _d.label = 4;
247
+ case 4:
248
+ detectedLinkedProjects_1_1 = detectedLinkedProjects_1.next();
249
+ return [3 /*break*/, 2];
250
+ case 5: return [3 /*break*/, 8];
251
+ case 6:
252
+ e_2_1 = _d.sent();
253
+ e_2 = { error: e_2_1 };
254
+ return [3 /*break*/, 8];
255
+ case 7:
256
+ try {
257
+ if (detectedLinkedProjects_1_1 && !detectedLinkedProjects_1_1.done && (_b = detectedLinkedProjects_1.return)) _b.call(detectedLinkedProjects_1);
258
+ }
259
+ finally { if (e_2) throw e_2.error; }
260
+ return [7 /*endfinally*/];
261
+ case 8:
262
+ index_1.Helpers.taskDone("Checking linked projects done in ".concat(this.genericName));
263
+ projectsThatShouldBeLinked = this.linkedProjects
264
+ .map(function (linkedProj) {
265
+ return detectedLinkedProjects.find(function (f) { return f.relativeClonePath === linkedProj.relativeClonePath; }) ? void 0 : linkedProj;
266
+ }).filter(function (f) { return !!f; });
267
+ if (!(projectsThatShouldBeLinked.length > 0)) return [3 /*break*/, 18];
268
+ index_1.Helpers.info("\n\n".concat(projectsThatShouldBeLinked.map(function (p, index) {
269
+ return "- ".concat(index + 1, ". ").concat(tnp_core_1.chalk.bold(p.relativeClonePath), " ").concat(p.remoteUrl(), " {").concat(p.purpose ? " purpose: ".concat(p.purpose, " }") : '');
270
+ }).join('\n'), "\n\n "));
271
+ _a = cloneChildren;
272
+ if (_a) return [3 /*break*/, 10];
273
+ return [4 /*yield*/, index_1.Helpers.questionYesNo("Do you want to clone above (missing) linked projects ?")];
274
+ case 9:
275
+ _a = (_d.sent());
276
+ _d.label = 10;
277
+ case 10:
278
+ if (!_a) return [3 /*break*/, 18];
279
+ _d.label = 11;
280
+ case 11:
281
+ _d.trys.push([11, 16, 17, 18]);
282
+ projectsThatShouldBeLinked_1 = tslib_1.__values(projectsThatShouldBeLinked), projectsThatShouldBeLinked_1_1 = projectsThatShouldBeLinked_1.next();
283
+ _d.label = 12;
284
+ case 12:
285
+ if (!!projectsThatShouldBeLinked_1_1.done) return [3 /*break*/, 15];
286
+ linkedProj = projectsThatShouldBeLinked_1_1.value;
287
+ index_1.Helpers.info("Cloning unexisted project from url ".concat(tnp_core_1.chalk.bold(linkedProj.remoteUrl()), " to ").concat(linkedProj.relativeClonePath));
288
+ return [4 /*yield*/, this.git.clone(linkedProj.remoteUrl(), linkedProj.relativeClonePath, linkedProj.deafultBranch)];
289
+ case 13:
290
+ _d.sent();
291
+ _d.label = 14;
292
+ case 14:
293
+ projectsThatShouldBeLinked_1_1 = projectsThatShouldBeLinked_1.next();
294
+ return [3 /*break*/, 12];
295
+ case 15: return [3 /*break*/, 18];
296
+ case 16:
297
+ e_3_1 = _d.sent();
298
+ e_3 = { error: e_3_1 };
299
+ return [3 /*break*/, 18];
300
+ case 17:
301
+ try {
302
+ if (projectsThatShouldBeLinked_1_1 && !projectsThatShouldBeLinked_1_1.done && (_c = projectsThatShouldBeLinked_1.return)) _c.call(projectsThatShouldBeLinked_1);
303
+ }
304
+ finally { if (e_3) throw e_3.error; }
305
+ return [7 /*endfinally*/];
306
+ case 18: return [2 /*return*/];
307
+ }
308
+ });
309
+ });
310
+ };
311
+ //#endregion
75
312
  //#region methods & getters / set type
76
313
  BaseProject.prototype.setType = function (type) {
77
314
  // @ts-ignore
@@ -682,8 +919,8 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
682
919
  BaseProject.prototype.resetProcess = function (overrideBranch, recrusive) {
683
920
  if (recrusive === void 0) { recrusive = false; }
684
921
  return tslib_1.__awaiter(this, void 0, void 0, function () {
685
- var defaultBranch, childrenRepos, childrenRepos_1, childrenRepos_1_1, child, e_1_1;
686
- var e_1, _a;
922
+ var defaultBranch, childrenRepos, childrenRepos_1, childrenRepos_1_1, child, e_4_1;
923
+ var e_4, _a;
687
924
  return tslib_1.__generator(this, function (_b) {
688
925
  switch (_b.label) {
689
926
  case 0:
@@ -725,14 +962,14 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
725
962
  return [3 /*break*/, 4];
726
963
  case 7: return [3 /*break*/, 10];
727
964
  case 8:
728
- e_1_1 = _b.sent();
729
- e_1 = { error: e_1_1 };
965
+ e_4_1 = _b.sent();
966
+ e_4 = { error: e_4_1 };
730
967
  return [3 /*break*/, 10];
731
968
  case 9:
732
969
  try {
733
970
  if (childrenRepos_1_1 && !childrenRepos_1_1.done && (_a = childrenRepos_1.return)) _a.call(childrenRepos_1);
734
971
  }
735
- finally { if (e_1) throw e_1.error; }
972
+ finally { if (e_4) throw e_4.error; }
736
973
  return [7 /*endfinally*/];
737
974
  case 10: return [2 /*return*/];
738
975
  }
@@ -741,15 +978,16 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
741
978
  };
742
979
  //#endregion
743
980
  //#region methods & getters / push process
744
- BaseProject.prototype.pullProcess = function () {
981
+ BaseProject.prototype.pullProcess = function (cloneChildren) {
982
+ if (cloneChildren === void 0) { cloneChildren = false; }
745
983
  return tslib_1.__awaiter(this, void 0, void 0, function () {
746
- var uncommitedChanges, location, childrenRepos, childrenRepos_2, childrenRepos_2_1, child, e_2_1;
747
- var e_2, _a;
984
+ var uncommitedChanges, location, childrenRepos, childrenRepos_2, childrenRepos_2_1, child, e_5_1;
985
+ var e_5, _a;
748
986
  return tslib_1.__generator(this, function (_b) {
749
987
  switch (_b.label) {
750
988
  case 0:
751
989
  //#region @backendFunc
752
- return [4 /*yield*/, this._beforePullProcessAction()];
990
+ return [4 /*yield*/, this._beforePullProcessAction(cloneChildren)];
753
991
  case 1:
754
992
  //#region @backendFunc
755
993
  _b.sent();
@@ -772,7 +1010,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
772
1010
  location = this.location;
773
1011
  this.ins.unload(this);
774
1012
  this.ins.add(this.ins.From(location));
775
- if (!this.automaticallyAddAllChnagesWhenPushingToGit()) return [3 /*break*/, 10];
1013
+ if (!(this.automaticallyAddAllChnagesWhenPushingToGit() || cloneChildren)) return [3 /*break*/, 10];
776
1014
  childrenRepos = this.children.filter(function (f) { return f.git.isGitRepo && f.git.isGitRoot; });
777
1015
  _b.label = 3;
778
1016
  case 3:
@@ -791,14 +1029,14 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
791
1029
  return [3 /*break*/, 4];
792
1030
  case 7: return [3 /*break*/, 10];
793
1031
  case 8:
794
- e_2_1 = _b.sent();
795
- e_2 = { error: e_2_1 };
1032
+ e_5_1 = _b.sent();
1033
+ e_5 = { error: e_5_1 };
796
1034
  return [3 /*break*/, 10];
797
1035
  case 9:
798
1036
  try {
799
1037
  if (childrenRepos_2_1 && !childrenRepos_2_1.done && (_a = childrenRepos_2.return)) _a.call(childrenRepos_2);
800
1038
  }
801
- finally { if (e_2) throw e_2.error; }
1039
+ finally { if (e_5) throw e_5.error; }
802
1040
  return [7 /*endfinally*/];
803
1041
  case 10: return [2 /*return*/];
804
1042
  }
@@ -811,53 +1049,55 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
811
1049
  var _a;
812
1050
  if (options === void 0) { options = {}; }
813
1051
  return tslib_1.__awaiter(this, void 0, void 0, function () {
814
- var force, typeofCommit, forcePushNoQuestion, origin, exitCallBack, args, commitMessageRequired, commitData, error_1, childrenRepos, childrenRepos_3, childrenRepos_3_1, child, e_3_1;
815
- var _b, _c, _d, e_3, _e;
1052
+ var force, typeofCommit, forcePushNoQuestion, origin, exitCallBack, args, commitMessageRequired, commitData, error_1, childrenRepos, childrenRepos_3, childrenRepos_3_1, child, e_6_1;
1053
+ var _b, _c, _d, e_6, _e;
816
1054
  return tslib_1.__generator(this, function (_f) {
817
1055
  switch (_f.label) {
818
1056
  case 0:
819
1057
  force = (_b = options.force, _b === void 0 ? false : _b), typeofCommit = options.typeofCommit, forcePushNoQuestion = options.forcePushNoQuestion, origin = (_c = options.origin, _c === void 0 ? 'origin' : _c), exitCallBack = options.exitCallBack, args = (_d = options.args, _d === void 0 ? [] : _d), commitMessageRequired = options.commitMessageRequired;
820
- this._beforePushProcessAction();
821
- return [4 /*yield*/, this._getCommitMessage(typeofCommit, args, commitMessageRequired)];
1058
+ return [4 /*yield*/, this._beforePushProcessAction()];
822
1059
  case 1:
823
- commitData = _f.sent();
824
- _f.label = 2;
1060
+ _f.sent();
1061
+ return [4 /*yield*/, this._getCommitMessage(typeofCommit, args, commitMessageRequired)];
825
1062
  case 2:
826
- if (!true) return [3 /*break*/, 8];
1063
+ commitData = _f.sent();
827
1064
  _f.label = 3;
828
1065
  case 3:
829
- _f.trys.push([3, 5, , 7]);
830
- return [4 /*yield*/, this.lint()];
1066
+ if (!true) return [3 /*break*/, 9];
1067
+ _f.label = 4;
831
1068
  case 4:
832
- _f.sent();
833
- return [3 /*break*/, 8];
1069
+ _f.trys.push([4, 6, , 8]);
1070
+ return [4 /*yield*/, this.lint()];
834
1071
  case 5:
1072
+ _f.sent();
1073
+ return [3 /*break*/, 9];
1074
+ case 6:
835
1075
  error_1 = _f.sent();
836
1076
  index_1.Helpers.warn('Fix your code...');
837
1077
  return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Try again lint ? .. (or just skip it)')];
838
- case 6:
1078
+ case 7:
839
1079
  if (!(_f.sent())) {
840
- return [3 /*break*/, 8];
1080
+ return [3 /*break*/, 9];
841
1081
  }
842
- return [3 /*break*/, 7];
843
- case 7: return [3 /*break*/, 2];
844
- case 8:
845
- if (!!commitData.isActionCommit) return [3 /*break*/, 12];
1082
+ return [3 /*break*/, 8];
1083
+ case 8: return [3 /*break*/, 3];
1084
+ case 9:
1085
+ if (!!commitData.isActionCommit) return [3 /*break*/, 13];
846
1086
  index_1.Helpers.info("Current commit:\n - message to include {".concat(commitData.commitMessage, "}\n - branch to checkout {").concat(commitData.branchName, "}\n "));
847
- if (!(this.git.lastCommitMessage() === commitData.commitMessage)) return [3 /*break*/, 10];
1087
+ if (!(this.git.lastCommitMessage() === commitData.commitMessage)) return [3 /*break*/, 11];
848
1088
  return [4 /*yield*/, index_1.Helpers.questionYesNo('Soft reset last commit with same message ?')];
849
- case 9:
1089
+ case 10:
850
1090
  if (_f.sent()) {
851
1091
  this.git.resetSoftHEAD(1);
852
1092
  }
853
- _f.label = 10;
854
- case 10: return [4 /*yield*/, index_1.Helpers.questionYesNo('Commit and push this ?')];
855
- case 11:
1093
+ _f.label = 11;
1094
+ case 11: return [4 /*yield*/, index_1.Helpers.questionYesNo('Commit and push this ?')];
1095
+ case 12:
856
1096
  if (!(_f.sent())) {
857
1097
  exitCallBack();
858
1098
  }
859
- _f.label = 12;
860
- case 12:
1099
+ _f.label = 13;
1100
+ case 13:
861
1101
  if (this.automaticallyAddAllChnagesWhenPushingToGit()) { // my project
862
1102
  this.git.stageAllFiles();
863
1103
  }
@@ -879,37 +1119,37 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
879
1119
  index_1.Helpers.warn("Not commiting anything... ");
880
1120
  }
881
1121
  return [4 /*yield*/, this.git.pushCurrentBranch({ force: force, origin: origin, forcePushNoQuestion: forcePushNoQuestion, askToRetry: true })];
882
- case 13:
1122
+ case 14:
883
1123
  _f.sent();
884
- if (!this.automaticallyAddAllChnagesWhenPushingToGit()) return [3 /*break*/, 21];
1124
+ if (!this.automaticallyAddAllChnagesWhenPushingToGit()) return [3 /*break*/, 22];
885
1125
  childrenRepos = this.children.filter(function (f) { return f.git.isGitRepo && f.git.isGitRoot; });
886
- _f.label = 14;
887
- case 14:
888
- _f.trys.push([14, 19, 20, 21]);
889
- childrenRepos_3 = tslib_1.__values(childrenRepos), childrenRepos_3_1 = childrenRepos_3.next();
890
1126
  _f.label = 15;
891
1127
  case 15:
892
- if (!!childrenRepos_3_1.done) return [3 /*break*/, 18];
1128
+ _f.trys.push([15, 20, 21, 22]);
1129
+ childrenRepos_3 = tslib_1.__values(childrenRepos), childrenRepos_3_1 = childrenRepos_3.next();
1130
+ _f.label = 16;
1131
+ case 16:
1132
+ if (!!childrenRepos_3_1.done) return [3 /*break*/, 19];
893
1133
  child = childrenRepos_3_1.value;
894
1134
  return [4 /*yield*/, child.pushProcess(options)];
895
- case 16:
896
- _f.sent();
897
- _f.label = 17;
898
1135
  case 17:
1136
+ _f.sent();
1137
+ _f.label = 18;
1138
+ case 18:
899
1139
  childrenRepos_3_1 = childrenRepos_3.next();
900
- return [3 /*break*/, 15];
901
- case 18: return [3 /*break*/, 21];
902
- case 19:
903
- e_3_1 = _f.sent();
904
- e_3 = { error: e_3_1 };
905
- return [3 /*break*/, 21];
1140
+ return [3 /*break*/, 16];
1141
+ case 19: return [3 /*break*/, 22];
906
1142
  case 20:
1143
+ e_6_1 = _f.sent();
1144
+ e_6 = { error: e_6_1 };
1145
+ return [3 /*break*/, 22];
1146
+ case 21:
907
1147
  try {
908
1148
  if (childrenRepos_3_1 && !childrenRepos_3_1.done && (_e = childrenRepos_3.return)) _e.call(childrenRepos_3);
909
1149
  }
910
- finally { if (e_3) throw e_3.error; }
1150
+ finally { if (e_6) throw e_6.error; }
911
1151
  return [7 /*endfinally*/];
912
- case 21: return [2 /*return*/];
1152
+ case 22: return [2 /*return*/];
913
1153
  }
914
1154
  });
915
1155
  });
@@ -945,19 +1185,29 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
945
1185
  this.git.commit('first commit ');
946
1186
  }
947
1187
  _b.label = 2;
948
- case 2: return [2 /*return*/];
1188
+ case 2: return [4 /*yield*/, this.cloneUnexistedLinkedProjects('push')];
1189
+ case 3:
1190
+ _b.sent();
1191
+ return [2 /*return*/];
949
1192
  }
950
1193
  });
951
1194
  });
952
1195
  };
953
1196
  //#endregion
954
1197
  //#region before push action
955
- BaseProject.prototype._beforePullProcessAction = function () {
1198
+ BaseProject.prototype._beforePullProcessAction = function (cloneChildren) {
1199
+ if (cloneChildren === void 0) { cloneChildren = false; }
956
1200
  return tslib_1.__awaiter(this, void 0, void 0, function () {
957
1201
  return tslib_1.__generator(this, function (_a) {
958
- //#region @backendFunc
959
- this._beforeAnyActionOnGitRoot();
960
- return [2 /*return*/];
1202
+ switch (_a.label) {
1203
+ case 0:
1204
+ //#region @backendFunc
1205
+ this._beforeAnyActionOnGitRoot();
1206
+ return [4 /*yield*/, this.cloneUnexistedLinkedProjects('pull', cloneChildren)];
1207
+ case 1:
1208
+ _a.sent();
1209
+ return [2 /*return*/];
1210
+ }
961
1211
  });
962
1212
  });
963
1213
  };
@@ -1043,11 +1293,30 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
1043
1293
  index_1.Helpers.git.revertFileChanges(self.location, fileReletivePath);
1044
1294
  //#endregion
1045
1295
  },
1046
- clone: function (url, destinationFolderName) {
1296
+ clone: function (url, destinationFolderName, branchName) {
1047
1297
  if (destinationFolderName === void 0) { destinationFolderName = ''; }
1048
- //#region @backendFunc
1049
- return index_1.Helpers.git.clone({ cwd: self.location, url: url, destinationFolderName: destinationFolderName });
1050
- //#endregion
1298
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1299
+ var clondeFolderpath, error_2;
1300
+ return tslib_1.__generator(this, function (_a) {
1301
+ switch (_a.label) {
1302
+ case 0:
1303
+ clondeFolderpath = index_1.Helpers.git.clone({ cwd: self.location, url: url, destinationFolderName: destinationFolderName, });
1304
+ if (!branchName) return [3 /*break*/, 4];
1305
+ _a.label = 1;
1306
+ case 1:
1307
+ _a.trys.push([1, 3, , 4]);
1308
+ index_1.Helpers.git.checkout(clondeFolderpath, branchName);
1309
+ return [4 /*yield*/, index_1.Helpers.git.pullCurrentBranch(clondeFolderpath, { askToRetry: true })];
1310
+ case 2:
1311
+ _a.sent();
1312
+ return [3 /*break*/, 4];
1313
+ case 3:
1314
+ error_2 = _a.sent();
1315
+ return [3 /*break*/, 4];
1316
+ case 4: return [2 /*return*/];
1317
+ }
1318
+ });
1319
+ });
1051
1320
  },
1052
1321
  restoreLastVersion: function (localFilePath) {
1053
1322
  //#region @backendFunc
@@ -1437,11 +1706,12 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
1437
1706
  * get info about porject
1438
1707
  */
1439
1708
  BaseProject.prototype.info = function () {
1709
+ var _a, _b;
1440
1710
  return tslib_1.__awaiter(this, void 0, void 0, function () {
1441
1711
  var proj;
1442
- return tslib_1.__generator(this, function (_a) {
1712
+ return tslib_1.__generator(this, function (_c) {
1443
1713
  proj = this;
1444
- index_1.Helpers.info("\n\n name: ".concat(proj === null || proj === void 0 ? void 0 : proj.name, "\n type: ").concat(proj === null || proj === void 0 ? void 0 : proj.type, "\n children (").concat(proj === null || proj === void 0 ? void 0 : proj.children.length, "): ").concat((!proj || !proj.children.length) ? '< none >' : '', "\n").concat(proj === null || proj === void 0 ? void 0 : proj.children.map(function (c) { return '+' + c.genericName; }).join('\n'), "\n\n\n "));
1714
+ index_1.Helpers.info("\n\n name: ".concat(proj === null || proj === void 0 ? void 0 : proj.name, "\n type: ").concat(proj === null || proj === void 0 ? void 0 : proj.type, "\n children (").concat(proj === null || proj === void 0 ? void 0 : proj.children.length, "): ").concat((!proj || !proj.children.length) ? '< none >' : '', "\n").concat(proj === null || proj === void 0 ? void 0 : proj.children.map(function (c) { return '+' + c.genericName; }).join('\n'), "\n\nlinked porject prefix: \"").concat(this.linkedProjectsPrefix, "\"\n\nlinked projects from json (").concat(((_a = this.linkedProjects) === null || _a === void 0 ? void 0 : _a.length) || 0, "):\n").concat((this.linkedProjects || []).map(function (c) { return '- ' + c.relativeClonePath; }).join('\n'), "\n\nlinked projects detected (").concat(((_b = this.detectedLinkedProjects) === null || _b === void 0 ? void 0 : _b.length) || 0, "):\n").concat((this.detectedLinkedProjects || []).map(function (c) { return '- ' + c.relativeClonePath; }).join('\n'), "\n\n "));
1445
1715
  return [2 /*return*/];
1446
1716
  });
1447
1717
  });
@@ -1616,8 +1886,8 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
1616
1886
  BaseProject.prototype.buildLibraries = function (_a) {
1617
1887
  var _b = _a === void 0 ? {} : _a, _c = _b.rebuild, rebuild = _c === void 0 ? false : _c, _d = _b.watch, watch = _d === void 0 ? false : _d, strategy = _b.strategy;
1618
1888
  return tslib_1.__awaiter(this, void 0, void 0, function () {
1619
- var libsToWatch, locationsForNodeModules, libs, _loop_1, this_1, _e, _f, _g, index, lib, _loop_2, _h, _j, _k, index, lib, e_4_1;
1620
- var e_5, _l, e_4, _m;
1889
+ var libsToWatch, locationsForNodeModules, libs, _loop_2, this_2, _e, _f, _g, index, lib, _loop_3, _h, _j, _k, index, lib, e_7_1;
1890
+ var e_8, _l, e_7, _m;
1621
1891
  var _this = this;
1622
1892
  return tslib_1.__generator(this, function (_o) {
1623
1893
  switch (_o.label) {
@@ -1642,14 +1912,14 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
1642
1912
  this.run('yarn install', { output: true }).sync();
1643
1913
  }
1644
1914
  libs = this.libraries;
1645
- _loop_1 = function (index, lib) {
1915
+ _loop_2 = function (index, lib) {
1646
1916
  index_1.Helpers.info("Building (".concat(index + 1, "/").concat(libs.length, ") ").concat(lib.basename, " (").concat(tnp_core_1.chalk.bold(lib.name), ")"));
1647
1917
  if (strategy === 'link') {
1648
1918
  (function () {
1649
- var e_6, _a;
1919
+ var e_9, _a;
1650
1920
  var sourceDist = _this.pathFor([tnp_config_1.config.folder.dist, lib.basename]);
1651
1921
  try {
1652
- for (var locationsForNodeModules_1 = (e_6 = void 0, tslib_1.__values(locationsForNodeModules)), locationsForNodeModules_1_1 = locationsForNodeModules_1.next(); !locationsForNodeModules_1_1.done; locationsForNodeModules_1_1 = locationsForNodeModules_1.next()) {
1922
+ for (var locationsForNodeModules_1 = (e_9 = void 0, tslib_1.__values(locationsForNodeModules)), locationsForNodeModules_1_1 = locationsForNodeModules_1.next(); !locationsForNodeModules_1_1.done; locationsForNodeModules_1_1 = locationsForNodeModules_1.next()) {
1653
1923
  var node_modules = locationsForNodeModules_1_1.value;
1654
1924
  var dest = (0, tnp_core_2.crossPlatformPath)([node_modules, lib.name]);
1655
1925
  if (!index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
@@ -1661,12 +1931,12 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
1661
1931
  index_1.Helpers.createSymLink(sourceDist, dest, { continueWhenExistedFolderDoesntExists: true });
1662
1932
  }
1663
1933
  }
1664
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1934
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
1665
1935
  finally {
1666
1936
  try {
1667
1937
  if (locationsForNodeModules_1_1 && !locationsForNodeModules_1_1.done && (_a = locationsForNodeModules_1.return)) _a.call(locationsForNodeModules_1);
1668
1938
  }
1669
- finally { if (e_6) throw e_6.error; }
1939
+ finally { if (e_9) throw e_9.error; }
1670
1940
  }
1671
1941
  if (rebuild || !index_1.Helpers.exists(sourceDist)) {
1672
1942
  index_1.Helpers.info("Compiling ".concat(lib.name, " ..."));
@@ -1683,11 +1953,11 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
1683
1953
  })();
1684
1954
  }
1685
1955
  else if (strategy === 'copy') {
1686
- var sourceDist = this_1.pathFor([tnp_config_1.config.folder.dist, lib.basename]);
1687
- var dest = this_1.pathFor([tnp_config_1.config.folder.node_modules, lib.name]);
1956
+ var sourceDist = this_2.pathFor([tnp_config_1.config.folder.dist, lib.basename]);
1957
+ var dest = this_2.pathFor([tnp_config_1.config.folder.node_modules, lib.name]);
1688
1958
  if (rebuild || !index_1.Helpers.exists(sourceDist)) {
1689
1959
  index_1.Helpers.info("Compiling ".concat(lib.name, " ..."));
1690
- this_1.run(lib.getLibraryBuildComamnd({ watch: false }), { output: true }).sync();
1960
+ this_2.run(lib.getLibraryBuildComamnd({ watch: false }), { output: true }).sync();
1691
1961
  }
1692
1962
  if (index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
1693
1963
  index_1.Helpers.remove(dest);
@@ -1695,22 +1965,22 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
1695
1965
  index_1.Helpers.copy(sourceDist, dest);
1696
1966
  }
1697
1967
  };
1698
- this_1 = this;
1968
+ this_2 = this;
1699
1969
  try {
1700
1970
  for (_e = tslib_1.__values(this.sortedLibrariesByDeps.entries()), _f = _e.next(); !_f.done; _f = _e.next()) {
1701
1971
  _g = tslib_1.__read(_f.value, 2), index = _g[0], lib = _g[1];
1702
- _loop_1(index, lib);
1972
+ _loop_2(index, lib);
1703
1973
  }
1704
1974
  }
1705
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1975
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1706
1976
  finally {
1707
1977
  try {
1708
1978
  if (_f && !_f.done && (_l = _e.return)) _l.call(_e);
1709
1979
  }
1710
- finally { if (e_5) throw e_5.error; }
1980
+ finally { if (e_8) throw e_8.error; }
1711
1981
  }
1712
1982
  if (!watch) return [3 /*break*/, 11];
1713
- _loop_2 = function (index, lib) {
1983
+ _loop_3 = function (index, lib) {
1714
1984
  return tslib_1.__generator(this, function (_p) {
1715
1985
  switch (_p.label) {
1716
1986
  case 0:
@@ -1746,7 +2016,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
1746
2016
  case 4:
1747
2017
  if (!!_j.done) return [3 /*break*/, 7];
1748
2018
  _k = tslib_1.__read(_j.value, 2), index = _k[0], lib = _k[1];
1749
- return [5 /*yield**/, _loop_2(index, lib)];
2019
+ return [5 /*yield**/, _loop_3(index, lib)];
1750
2020
  case 5:
1751
2021
  _o.sent();
1752
2022
  _o.label = 6;
@@ -1755,14 +2025,14 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
1755
2025
  return [3 /*break*/, 4];
1756
2026
  case 7: return [3 /*break*/, 10];
1757
2027
  case 8:
1758
- e_4_1 = _o.sent();
1759
- e_4 = { error: e_4_1 };
2028
+ e_7_1 = _o.sent();
2029
+ e_7 = { error: e_7_1 };
1760
2030
  return [3 /*break*/, 10];
1761
2031
  case 9:
1762
2032
  try {
1763
2033
  if (_j && !_j.done && (_m = _h.return)) _m.call(_h);
1764
2034
  }
1765
- finally { if (e_4) throw e_4.error; }
2035
+ finally { if (e_7) throw e_7.error; }
1766
2036
  return [7 /*endfinally*/];
1767
2037
  case 10:
1768
2038
  // await this.__indexRebuilder.startAndWatch({ taskName: 'index rebuild watch' });