tnp-helpers 16.444.18 → 16.444.20

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 (111) hide show
  1. package/assets/shared/shared_folder_info.txt +1 -1
  2. package/browser/README.md +24 -24
  3. package/browser/esm2022/lib/base/base-git.mjs +34 -4
  4. package/browser/esm2022/lib/base/base-library-build.mjs +39 -27
  5. package/browser/esm2022/lib/base/base-linked-projects.mjs +15 -4
  6. package/browser/esm2022/lib/base/base-npm-helpers.mjs +16 -6
  7. package/browser/esm2022/lib/base/base-project-resolver.mjs +10 -1
  8. package/browser/esm2022/lib/base/base-project.mjs +67 -9
  9. package/browser/esm2022/lib/base/base-vscode.mjs +66 -0
  10. package/browser/esm2022/lib/base/core-project.mjs +1 -1
  11. package/browser/esm2022/lib/base/linked-project.mjs +2 -7
  12. package/browser/esm2022/lib/models.mjs +1 -1
  13. package/browser/fesm2022/tnp-helpers.mjs +175 -51
  14. package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
  15. package/browser/lib/base/base-git.d.ts +11 -0
  16. package/browser/lib/base/base-library-build.d.ts +31 -6
  17. package/browser/lib/base/base-npm-helpers.d.ts +0 -1
  18. package/browser/lib/base/base-project-resolver.d.ts +9 -8
  19. package/browser/lib/base/base-project.d.ts +9 -4
  20. package/browser/lib/base/base-vscode.d.ts +6 -0
  21. package/browser/lib/base/core-project.d.ts +14 -3
  22. package/browser/lib/models.d.ts +1 -5
  23. package/client/README.md +24 -24
  24. package/client/esm2022/lib/base/base-git.mjs +34 -4
  25. package/client/esm2022/lib/base/base-library-build.mjs +39 -27
  26. package/client/esm2022/lib/base/base-linked-projects.mjs +15 -4
  27. package/client/esm2022/lib/base/base-npm-helpers.mjs +16 -6
  28. package/client/esm2022/lib/base/base-project-resolver.mjs +10 -1
  29. package/client/esm2022/lib/base/base-project.mjs +67 -9
  30. package/client/esm2022/lib/base/base-vscode.mjs +66 -0
  31. package/client/esm2022/lib/base/core-project.mjs +1 -1
  32. package/client/esm2022/lib/base/linked-project.mjs +2 -7
  33. package/client/esm2022/lib/models.mjs +1 -1
  34. package/client/fesm2022/tnp-helpers.mjs +175 -51
  35. package/client/fesm2022/tnp-helpers.mjs.map +1 -1
  36. package/client/lib/base/base-git.d.ts +11 -0
  37. package/client/lib/base/base-library-build.d.ts +31 -6
  38. package/client/lib/base/base-npm-helpers.d.ts +0 -1
  39. package/client/lib/base/base-project-resolver.d.ts +9 -8
  40. package/client/lib/base/base-project.d.ts +9 -4
  41. package/client/lib/base/base-vscode.d.ts +6 -0
  42. package/client/lib/base/core-project.d.ts +14 -3
  43. package/client/lib/models.d.ts +1 -5
  44. package/client/package.json +25 -25
  45. package/firedev.jsonc +61 -61
  46. package/lib/base/base-command-line.backend.d.ts +7 -1
  47. package/lib/base/base-command-line.backend.js +83 -7
  48. package/lib/base/base-command-line.backend.js.map +1 -1
  49. package/lib/base/base-git.d.ts +11 -0
  50. package/lib/base/base-git.js +92 -56
  51. package/lib/base/base-git.js.map +1 -1
  52. package/lib/base/base-library-build.d.ts +39 -8
  53. package/lib/base/base-library-build.js +256 -231
  54. package/lib/base/base-library-build.js.map +1 -1
  55. package/lib/base/base-linked-projects.js +14 -4
  56. package/lib/base/base-linked-projects.js.map +1 -1
  57. package/lib/base/base-npm-helpers.d.ts +0 -1
  58. package/lib/base/base-npm-helpers.js +15 -8
  59. package/lib/base/base-npm-helpers.js.map +1 -1
  60. package/lib/base/base-project-resolver.d.ts +10 -9
  61. package/lib/base/base-project-resolver.js +11 -1
  62. package/lib/base/base-project-resolver.js.map +1 -1
  63. package/lib/base/base-project.d.ts +10 -5
  64. package/lib/base/base-project.js +84 -22
  65. package/lib/base/base-project.js.map +1 -1
  66. package/lib/base/base-vscode.d.ts +5 -0
  67. package/lib/base/base-vscode.js +79 -0
  68. package/lib/base/base-vscode.js.map +1 -0
  69. package/lib/base/command-line-feature.backend.d.ts +6 -1
  70. package/lib/base/command-line-feature.backend.js +67 -1
  71. package/lib/base/command-line-feature.backend.js.map +1 -1
  72. package/lib/base/core-project.d.ts +14 -3
  73. package/lib/base/core-project.js.map +1 -1
  74. package/lib/base/linked-project.js +8 -10
  75. package/lib/base/linked-project.js.map +1 -1
  76. package/lib/helpers/for-backend/helpers-file-folders.backend.d.ts +16 -8
  77. package/lib/helpers/for-backend/helpers-file-folders.backend.js +156 -65
  78. package/lib/helpers/for-backend/helpers-file-folders.backend.js.map +1 -1
  79. package/lib/helpers/for-backend/helpers-git.backend.d.ts +2 -0
  80. package/lib/helpers/for-backend/helpers-git.backend.js +72 -0
  81. package/lib/helpers/for-backend/helpers-git.backend.js.map +1 -1
  82. package/lib/helpers/for-backend/helpers-process.backend.js +3 -1
  83. package/lib/helpers/for-backend/helpers-process.backend.js.map +1 -1
  84. package/lib/helpers/for-browser/angular.helper.js +3 -3
  85. package/lib/models.d.ts +1 -5
  86. package/lib/old/base-component.js +3 -3
  87. package/lib/old/base-formly-component.js +3 -3
  88. package/lib/old/dual-component-ctrl.js +3 -3
  89. package/package.json +4 -4
  90. package/tmp-environment.json +30 -30
  91. package/websql/README.md +24 -24
  92. package/websql/esm2022/lib/base/base-git.mjs +34 -4
  93. package/websql/esm2022/lib/base/base-library-build.mjs +39 -27
  94. package/websql/esm2022/lib/base/base-linked-projects.mjs +15 -4
  95. package/websql/esm2022/lib/base/base-npm-helpers.mjs +16 -6
  96. package/websql/esm2022/lib/base/base-project-resolver.mjs +10 -1
  97. package/websql/esm2022/lib/base/base-project.mjs +76 -18
  98. package/websql/esm2022/lib/base/base-vscode.mjs +66 -0
  99. package/websql/esm2022/lib/base/core-project.mjs +1 -1
  100. package/websql/esm2022/lib/base/linked-project.mjs +2 -7
  101. package/websql/esm2022/lib/models.mjs +1 -1
  102. package/websql/fesm2022/tnp-helpers.mjs +183 -59
  103. package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
  104. package/websql/lib/base/base-git.d.ts +11 -0
  105. package/websql/lib/base/base-library-build.d.ts +31 -6
  106. package/websql/lib/base/base-npm-helpers.d.ts +0 -1
  107. package/websql/lib/base/base-project-resolver.d.ts +9 -8
  108. package/websql/lib/base/base-project.d.ts +10 -8
  109. package/websql/lib/base/base-vscode.d.ts +6 -0
  110. package/websql/lib/base/core-project.d.ts +14 -3
  111. package/websql/lib/models.d.ts +1 -5
@@ -25,99 +25,87 @@ var BaseLibraryBuild = /** @class */ (function (_super) {
25
25
  return _this;
26
26
  //#endregion
27
27
  }
28
- Object.defineProperty(BaseLibraryBuild.prototype, "sortedLibrariesByDeps", {
29
- //#region getters & methods / sorted libraries by deps
30
- get: function () {
31
- var _this = this;
32
- //#region @backendFunc
33
- var libs = this.libraries;
34
- var sorted = this.project.ins.sortGroupOfProject(libs, function (proj) {
35
- if (!tnp_core_3._.isUndefined(_this.cache['deps'])) {
36
- return _this.cache['deps'];
37
- }
38
- var uiJsonPath = proj.pathFor('ui-module.json');
39
- if (index_1.Helpers.exists(uiJsonPath)) {
40
- var uiModuleJson = index_1.Helpers.readJson(uiJsonPath);
41
- var allLibs = (uiModuleJson.dependencies || []);
42
- _this.cache['deps'] = allLibs.filter(function (f) { return !tnp_core_3._.isUndefined(libs.find(function (c) { return c.basename === f; })); });
43
- }
44
- else {
45
- var allLibs = Object.keys(proj.npmHelpers.allDependencies);
46
- _this.cache['deps'] = allLibs.filter(function (f) { return !tnp_core_3._.isUndefined(libs.find(function (c) { return c.name === f; })); });
47
- }
48
- // console.log(`${proj.name} => all libs`, this.cache['deps'])
49
- return _this.cache['deps'];
50
- }, function (proj) {
51
- if (!tnp_core_3._.isUndefined(_this.cache['nameToCompare'])) {
52
- // console.log(`CACHE ${proj.basename} => name: ` + this.cache['nameToCompare'])
53
- return _this.cache['nameToCompare'];
54
- }
55
- _this.cache['nameToCompare'] = index_1.Helpers.exists(proj.pathFor('ui-module.json'))
56
- ? proj.basename
57
- : proj.name;
58
- return _this.cache['nameToCompare'];
59
- });
60
- return sorted;
61
- //#endregion
62
- },
63
- enumerable: false,
64
- configurable: true
65
- });
66
- //#endregion
67
- //#region getters & methods / get sorted libraries by deps for build
68
- BaseLibraryBuild.prototype.getSortedLibrariesByDepsForBuild = function (libs, dontSugestBuildAll) {
69
- var _a;
70
- if (dontSugestBuildAll === void 0) { dontSugestBuildAll = false; }
28
+ //#region getters & methods / sort by deps
29
+ BaseLibraryBuild.prototype.sortByDeps = function (libraries) {
30
+ return libraries;
31
+ };
32
+ //#region getters & methods / get sorted libraries by deps for build\
33
+ /**
34
+ * Use cases:
35
+ * 1. build all libraries in normal mode
36
+ * 2. build all libraries in watch mode
37
+ * 3. build selected libraries in normal mode
38
+ * (with first time all libraries will be build)
39
+ * 4. build selected libraries in watch mode
40
+ * (use normal build for not selected libraries)
41
+ * 5. build selected libraries in watch mode
42
+ * (skip normal build for not selected libraries)
43
+ */
44
+ BaseLibraryBuild.prototype.selectAndSaveLibraries = function (_a) {
45
+ var _b;
46
+ var selectedLibs = _a.libs, watch = _a.watch, watchBuildSupported = _a.watchBuildSupported;
71
47
  return tslib_1.__awaiter(this, void 0, void 0, function () {
72
- var buildAll, lastSelectedJsonFile, lastSelected, selected, selectedLibs, selected;
73
- return tslib_1.__generator(this, function (_b) {
74
- switch (_b.label) {
48
+ var buildAll, skipRebuildingAllForWatch, lastSelectedJsonFile, lastSelected, selected, pickedLibs, selected;
49
+ return tslib_1.__generator(this, function (_c) {
50
+ switch (_c.label) {
75
51
  case 0:
76
52
  buildAll = false;
53
+ skipRebuildingAllForWatch = false;
54
+ if (selectedLibs.length <= 1) {
55
+ return [2 /*return*/, { selectedLibs: selectedLibs, skipRebuildingAllForWatch: skipRebuildingAllForWatch }];
56
+ }
57
+ if (tnp_core_3._.isUndefined(watchBuildSupported)) {
58
+ watchBuildSupported = true;
59
+ }
77
60
  lastSelectedJsonFile = 'tmp-last-selected.json';
78
- lastSelected = ((_a = index_1.Helpers.readJson(this.project.pathFor(lastSelectedJsonFile))) === null || _a === void 0 ? void 0 : _a.lastSelected) || [];
79
- if (!(tnp_core_3._.isArray(lastSelected) && lastSelected.length > 0)) return [3 /*break*/, 2];
80
- selected = lastSelected.map(function (c) { return libs.find(function (l) { return l.basename == c; }); });
61
+ lastSelected = ((_b = index_1.Helpers.readJson(this.project.pathFor(lastSelectedJsonFile))) === null || _b === void 0 ? void 0 : _b.lastSelected) || [];
62
+ if (!(tnp_core_3._.isArray(lastSelected) && lastSelected.length > 0)) return [3 /*break*/, 4];
63
+ selected = lastSelected.map(function (c) {
64
+ return selectedLibs.find(function (l) { return l.basename == c; });
65
+ });
81
66
  index_1.Helpers.info("\nLast selected libs\n\n".concat(selected.map(function (c, i) { return "".concat(i + 1, ". ").concat(c.basename, " ").concat(tnp_core_1.chalk.bold(c.name)); }).join('\n'), "\n\n "));
82
- return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo("Continue watch build with last selected ?")];
67
+ return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo("Continue ".concat(watch ? 'watch' : '', " build with last selected ?"))];
83
68
  case 1:
84
- if (_b.sent()) {
85
- libs = selected;
86
- return [2 /*return*/, libs];
87
- }
88
- _b.label = 2;
69
+ if (!_c.sent()) return [3 /*break*/, 4];
70
+ selectedLibs = selected;
71
+ if (!(watchBuildSupported && watch)) return [3 /*break*/, 3];
72
+ return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo("Skip rebuilding all libraries for watch mode ?")];
89
73
  case 2:
90
- if (!(libs.length < 6 && !dontSugestBuildAll)) return [3 /*break*/, 4];
91
- return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Should all libraries be included in watch build ?')];
92
- case 3:
93
- buildAll = _b.sent();
94
- _b.label = 4;
74
+ skipRebuildingAllForWatch = _c.sent();
75
+ _c.label = 3;
76
+ case 3: return [2 /*return*/, { selectedLibs: selectedLibs, skipRebuildingAllForWatch: skipRebuildingAllForWatch }];
95
77
  case 4:
78
+ if (!(!watch || (watch && selectedLibs.length < 6))) return [3 /*break*/, 6];
79
+ return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo("Should all libraries be included in".concat(watch ? ' watch' : ' ', "build ?"))];
80
+ case 5:
81
+ buildAll = _c.sent();
82
+ _c.label = 6;
83
+ case 6:
96
84
  if (buildAll) {
97
- return [2 /*return*/, libs];
85
+ return [2 /*return*/, { selectedLibs: selectedLibs, skipRebuildingAllForWatch: skipRebuildingAllForWatch }];
98
86
  }
99
- _b.label = 5;
100
- case 5:
101
- if (!true) return [3 /*break*/, 8];
102
- return [4 /*yield*/, index_1.Helpers.consoleGui.multiselect("Select libraries to build watch ", libs.map(function (c) {
87
+ _c.label = 7;
88
+ case 7:
89
+ if (!true) return [3 /*break*/, 10];
90
+ return [4 /*yield*/, index_1.Helpers.consoleGui.multiselect("Select libraries to ".concat(watch ? 'watch' : '', " build "), selectedLibs.map(function (c) {
103
91
  return { name: c.name, value: c.name, selected: true };
104
92
  }), true)];
105
- case 6:
106
- selectedLibs = _b.sent();
107
- selected = selectedLibs.map(function (c) { return libs.find(function (l) { return l.name == c; }); });
93
+ case 8:
94
+ pickedLibs = _c.sent();
95
+ selected = pickedLibs.map(function (c) { return selectedLibs.find(function (l) { return l.name == c; }); });
108
96
  index_1.Helpers.info("\n\n".concat(selected.map(function (c, i) { return "".concat(i + 1, ". ").concat(c.basename, " ").concat(tnp_core_1.chalk.bold(c.name)); }).join('\n'), "\n\n "));
109
97
  return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo("Continue build with ".concat(selected.length, " selected ?"))];
110
- case 7:
111
- if (_b.sent()) {
112
- libs = selected;
113
- return [3 /*break*/, 8];
98
+ case 9:
99
+ if (_c.sent()) {
100
+ selectedLibs = selected;
101
+ return [3 /*break*/, 10];
114
102
  }
115
- return [3 /*break*/, 5];
116
- case 8:
103
+ return [3 /*break*/, 7];
104
+ case 10:
117
105
  index_1.Helpers.writeJson(this.project.pathFor(lastSelectedJsonFile), {
118
- lastSelected: libs.map(function (c) { return c.basename; }),
106
+ lastSelected: selectedLibs.map(function (c) { return c.basename; }),
119
107
  });
120
- return [2 /*return*/, libs];
108
+ return [2 /*return*/, { selectedLibs: selectedLibs, skipRebuildingAllForWatch: skipRebuildingAllForWatch }];
121
109
  }
122
110
  });
123
111
  });
@@ -135,22 +123,11 @@ var BaseLibraryBuild = /** @class */ (function (_super) {
135
123
  if (!tnp_core_3._.isUndefined(this.cache['libraries'])) {
136
124
  return this.cache['libraries'];
137
125
  }
138
- if (!this.project.pathExists(tnp_config_1.config.file.angular_json)) {
139
- var externalPath = tnp_core_2.path.join(this.project.location, tnp_config_1.config.folder.projects);
140
- var libraries_1 = index_1.Helpers.findChildren(externalPath, function (childLocation) {
141
- var childProject = _this.project.ins.From(childLocation);
142
- if ((childProject === null || childProject === void 0 ? void 0 : childProject.name) === _this.project.name) {
143
- return void 0;
144
- }
145
- return childProject;
146
- }, { allowAllNames: true });
147
- this.cache['libraries'] = libraries_1;
148
- return libraries_1;
149
- }
150
126
  var projects = Object.values(((_a = index_1.Helpers.readJson(this.project.pathFor(tnp_config_1.config.file.angular_json))) === null || _a === void 0 ? void 0 : _a.projects) || {}).filter(function (f) { return f.projectType === 'library'; });
151
127
  var libraries = projects.map(function (c) {
152
128
  return _this.project.ins.From(tnp_core_2.path.join(_this.project.location, c.root));
153
129
  });
130
+ libraries = this.sortByDeps(libraries);
154
131
  this.cache['libraries'] = libraries;
155
132
  return libraries;
156
133
  //#endregion
@@ -161,85 +138,89 @@ var BaseLibraryBuild = /** @class */ (function (_super) {
161
138
  //#endregion
162
139
  //#region getters & methods / selected libraries
163
140
  BaseLibraryBuild.prototype.selectLibraries = function (_a) {
164
- var onlySelectedLibs = _a.onlySelectedLibs;
141
+ var watch = _a.watch, watchBuildSupported = _a.watchBuildSupported;
165
142
  return tslib_1.__awaiter(this, void 0, void 0, function () {
166
- var allLibs, allLibsToBuild, libsToBuild, libsToWatch, _b;
143
+ var allLibs, _b, selectedLibs, skipRebuildingAllForWatch;
167
144
  return tslib_1.__generator(this, function (_c) {
168
145
  switch (_c.label) {
169
146
  case 0:
170
147
  allLibs = this.libraries;
171
- allLibsToBuild = this.sortedLibrariesByDeps.filter(function (f) {
172
- if (!onlySelectedLibs) {
173
- return true;
174
- }
175
- var nameMatchesPattern = onlySelectedLibs.find(function (c) { return f.name.includes(c); });
176
- var basenameMatchesPattern = onlySelectedLibs.find(function (c) {
177
- return f.basename.includes(c);
178
- });
179
- return nameMatchesPattern || basenameMatchesPattern;
180
- });
181
- libsToBuild = this.sortedLibrariesByDeps;
182
- if (!(allLibsToBuild.length == 1)) return [3 /*break*/, 1];
183
- _b = [tnp_core_3._.first(allLibsToBuild)];
184
- return [3 /*break*/, 3];
185
- case 1: return [4 /*yield*/, this.getSortedLibrariesByDepsForBuild(allLibsToBuild, allLibs.length != allLibsToBuild.length)];
186
- case 2:
187
- _b = _c.sent();
188
- _c.label = 3;
189
- case 3:
190
- libsToWatch = _b;
191
- return [2 /*return*/, { libsToBuild: libsToBuild, libsToWatch: libsToWatch, allLibs: allLibs }];
148
+ return [4 /*yield*/, this.selectAndSaveLibraries({
149
+ libs: allLibs,
150
+ watch: watch,
151
+ watchBuildSupported: watchBuildSupported,
152
+ })];
153
+ case 1:
154
+ _b = _c.sent(), selectedLibs = _b.selectedLibs, skipRebuildingAllForWatch = _b.skipRebuildingAllForWatch;
155
+ return [2 /*return*/, {
156
+ skipRebuildingAllForWatch: skipRebuildingAllForWatch,
157
+ /**
158
+ * libs selected for build
159
+ */
160
+ selectedLibs: selectedLibs,
161
+ /**
162
+ * all libs that can be in build
163
+ */
164
+ allLibs: allLibs,
165
+ }];
192
166
  }
193
167
  });
194
168
  });
195
169
  };
196
170
  //#endregion
197
171
  //#region getters & methods / build libraries
198
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
172
+ /**
173
+ * Angular library build
174
+ */
199
175
  BaseLibraryBuild.prototype.buildLibraries = function (_a) {
200
- 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, onlySelectedLibs = _b.onlySelectedLibs, buildType = _b.buildType;
176
+ var _b = _a === void 0 ? {} : _a, _c = _b.watch, watch = _c === void 0 ? false : _c, strategy = _b.strategy, buildType = _b.buildType, copylink_to_node_modules = _b.copylink_to_node_modules;
201
177
  return tslib_1.__awaiter(this, void 0, void 0, function () {
202
- var locationsForNodeModules, _e, libsToBuild, libsToWatch, allLibs, _loop_1, this_1, _f, _g, _h, index, lib, _loop_2, _j, _k, _l, index, lib, e_1_1;
203
- var e_2, _m, e_1, _o;
178
+ var locationsForNodeModules, _d, selectedLibs, allLibs, skipRebuildingAllForWatch, _e, _f, _g, index, lib, sourceDist, locationsForNodeModules_1, locationsForNodeModules_1_1, node_modules, dest, locationsForNodeModules_2, locationsForNodeModules_2_1, node_modules, dest, _loop_1, _h, _j, _k, index, lib, e_1_1;
179
+ var e_2, _l, e_3, _m, e_4, _o, e_1, _p;
204
180
  var _this = this;
205
- return tslib_1.__generator(this, function (_p) {
206
- switch (_p.label) {
207
- case 0:
208
- //#region @backend
209
- return [4 /*yield*/, this.project.linkedProjects.saveAllLinkedProjectsToDB()];
210
- case 1:
181
+ return tslib_1.__generator(this, function (_q) {
182
+ switch (_q.label) {
183
+ case 0:
211
184
  //#region @backend
212
- _p.sent();
185
+ if (!Array.isArray(copylink_to_node_modules)) {
186
+ copylink_to_node_modules = [];
187
+ }
188
+ return [4 /*yield*/, this.project.linkedProjects.saveAllLinkedProjectsToDB()];
189
+ case 1:
190
+ _q.sent();
213
191
  if (!strategy) {
214
192
  strategy = 'link';
215
193
  }
216
- locationsForNodeModules = [
217
- this.project.location,
218
- // this.parent.location,
219
- // ...this.parent.children.map(c => c.location),
220
- ].map(function (l) { return (0, tnp_core_2.crossPlatformPath)([l, tnp_config_1.config.folder.node_modules]); });
194
+ locationsForNodeModules = tslib_1.__spreadArray([
195
+ this.project.pathFor(tnp_config_1.config.folder.node_modules)
196
+ ], tslib_1.__read(copylink_to_node_modules), false);
221
197
  return [4 /*yield*/, this.project.npmHelpers.makeSureNodeModulesInstalled()];
222
198
  case 2:
223
- _p.sent();
199
+ _q.sent();
224
200
  return [4 /*yield*/, this.selectLibraries({
225
- onlySelectedLibs: onlySelectedLibs,
201
+ watch: watch,
226
202
  })];
227
203
  case 3:
228
- _e = _p.sent(), libsToBuild = _e.libsToBuild, libsToWatch = _e.libsToWatch, allLibs = _e.allLibs;
229
- _loop_1 = function (index, lib) {
230
- index_1.Helpers.info("Building (".concat(index + 1, "/").concat(allLibs.length, ") ").concat(lib.basename, " (").concat(tnp_core_1.chalk.bold(lib.name), ")"));
231
- if (strategy === 'link') {
232
- //#region link dist to node_modules
233
- (function () {
234
- var e_3, _a;
235
- var sourceDist = _this.project.pathFor([
236
- tnp_config_1.config.folder.dist,
237
- lib.basename,
238
- ]);
204
+ _d = _q.sent(), selectedLibs = _d.selectedLibs, allLibs = _d.allLibs, skipRebuildingAllForWatch = _d.skipRebuildingAllForWatch;
205
+ try {
206
+ //#endregion
207
+ //#region normal build
208
+ for (_e = tslib_1.__values(allLibs.entries()), _f = _e.next(); !_f.done; _f = _e.next()) {
209
+ _g = tslib_1.__read(_f.value, 2), index = _g[0], lib = _g[1];
210
+ if (watch && skipRebuildingAllForWatch) {
211
+ index_1.Helpers.info("Skipping build for watch mode (".concat(index + 1, "/").concat(allLibs.length, ") ").concat(lib.basename, " (").concat(tnp_core_1.chalk.bold(lib.name), ")"));
212
+ }
213
+ index_1.Helpers.info("Building (".concat(index + 1, "/").concat(allLibs.length, ") ").concat(lib.basename, " (").concat(tnp_core_1.chalk.bold(lib.name), ")"));
214
+ sourceDist = this.project.pathFor([
215
+ tnp_config_1.config.folder.dist,
216
+ lib.basename,
217
+ ]);
218
+ if (strategy === 'link') {
239
219
  try {
240
- for (var locationsForNodeModules_1 = (e_3 = void 0, tslib_1.__values(locationsForNodeModules)), locationsForNodeModules_1_1 = locationsForNodeModules_1.next(); !locationsForNodeModules_1_1.done; locationsForNodeModules_1_1 = locationsForNodeModules_1.next()) {
241
- var node_modules = locationsForNodeModules_1_1.value;
242
- var dest = (0, tnp_core_2.crossPlatformPath)([node_modules, lib.name]);
220
+ //#region link dist to node_modules
221
+ for (locationsForNodeModules_1 = (e_3 = void 0, tslib_1.__values(locationsForNodeModules)), locationsForNodeModules_1_1 = locationsForNodeModules_1.next(); !locationsForNodeModules_1_1.done; locationsForNodeModules_1_1 = locationsForNodeModules_1.next()) {
222
+ node_modules = locationsForNodeModules_1_1.value;
223
+ dest = (0, tnp_core_2.crossPlatformPath)([node_modules, lib.name]);
243
224
  if (!index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
244
225
  index_1.Helpers.remove(dest);
245
226
  }
@@ -249,18 +230,22 @@ var BaseLibraryBuild = /** @class */ (function (_super) {
249
230
  index_1.Helpers.createSymLink(sourceDist, dest, {
250
231
  continueWhenExistedFolderDoesntExists: true,
251
232
  });
233
+ console.log("Sync (link) done for ".concat(lib.basename, " to ").concat(lib.name, " (").concat((0, tnp_core_2.crossPlatformPath)([
234
+ tnp_core_2.path.basename(tnp_core_2.path.dirname(node_modules)),
235
+ tnp_config_1.config.folder.node_modules,
236
+ ]), ")"));
252
237
  }
253
238
  }
254
239
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
255
240
  finally {
256
241
  try {
257
- if (locationsForNodeModules_1_1 && !locationsForNodeModules_1_1.done && (_a = locationsForNodeModules_1.return)) _a.call(locationsForNodeModules_1);
242
+ if (locationsForNodeModules_1_1 && !locationsForNodeModules_1_1.done && (_m = locationsForNodeModules_1.return)) _m.call(locationsForNodeModules_1);
258
243
  }
259
244
  finally { if (e_3) throw e_3.error; }
260
245
  }
261
- if (rebuild || !index_1.Helpers.exists(sourceDist)) {
246
+ if (!index_1.Helpers.exists(sourceDist)) {
262
247
  index_1.Helpers.info("Compiling ".concat(lib.name, " ..."));
263
- _this.project
248
+ this.project
264
249
  .run(lib.libraryBuild.getLibraryBuildComamnd({
265
250
  watch: false,
266
251
  buildType: buildType,
@@ -269,97 +254,107 @@ var BaseLibraryBuild = /** @class */ (function (_super) {
269
254
  })
270
255
  .sync();
271
256
  }
272
- })();
273
- (function () {
274
- var sourceDist = _this.project.pathFor([
275
- tnp_config_1.config.folder.dist,
276
- lib.basename,
277
- ]);
278
- var dest = _this.project.pathFor([
279
- tnp_config_1.config.folder.node_modules,
280
- lib.name,
281
- ]);
282
- if (!index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
283
- index_1.Helpers.remove(dest);
284
- }
285
- index_1.Helpers.createSymLink(sourceDist, dest, {
286
- continueWhenExistedFolderDoesntExists: true,
287
- });
288
- })();
289
- //#endregion
290
- }
291
- else if (strategy === 'copy') {
292
- //#region copy dist to node_modules
293
- var sourceDist = this_1.project.pathFor([
294
- tnp_config_1.config.folder.dist,
295
- lib.basename,
296
- ]);
297
- var dest = this_1.project.pathFor([
298
- tnp_config_1.config.folder.node_modules,
299
- lib.name,
300
- ]);
301
- if (rebuild || !index_1.Helpers.exists(sourceDist)) {
302
- index_1.Helpers.info("Compiling ".concat(lib.name, " ..."));
303
- this_1.project
304
- .run(lib.libraryBuild.getLibraryBuildComamnd({
305
- watch: false,
306
- buildType: buildType,
307
- }), {
308
- output: true,
309
- })
310
- .sync();
257
+ //#endregion
311
258
  }
312
- if (index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
313
- index_1.Helpers.remove(dest);
259
+ else if (strategy === 'copy') {
260
+ //#region copy dist to node_modules
261
+ if (!index_1.Helpers.exists(sourceDist)) {
262
+ index_1.Helpers.info("Compiling ".concat(lib.name, " ..."));
263
+ this.project
264
+ .run(lib.libraryBuild.getLibraryBuildComamnd({
265
+ watch: false,
266
+ buildType: buildType,
267
+ }), {
268
+ output: true,
269
+ })
270
+ .sync();
271
+ }
272
+ try {
273
+ for (locationsForNodeModules_2 = (e_4 = void 0, tslib_1.__values(locationsForNodeModules)), locationsForNodeModules_2_1 = locationsForNodeModules_2.next(); !locationsForNodeModules_2_1.done; locationsForNodeModules_2_1 = locationsForNodeModules_2.next()) {
274
+ node_modules = locationsForNodeModules_2_1.value;
275
+ dest = (0, tnp_core_2.crossPlatformPath)([node_modules, lib.name]);
276
+ if (index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
277
+ index_1.Helpers.remove(dest);
278
+ }
279
+ index_1.Helpers.copy(sourceDist, dest);
280
+ console.log("Sync done for ".concat(lib.basename, " to ").concat(lib.name, " (").concat((0, tnp_core_2.crossPlatformPath)([
281
+ tnp_core_2.path.basename(tnp_core_2.path.dirname(node_modules)),
282
+ tnp_config_1.config.folder.node_modules,
283
+ ]), ")"));
284
+ }
285
+ }
286
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
287
+ finally {
288
+ try {
289
+ if (locationsForNodeModules_2_1 && !locationsForNodeModules_2_1.done && (_o = locationsForNodeModules_2.return)) _o.call(locationsForNodeModules_2);
290
+ }
291
+ finally { if (e_4) throw e_4.error; }
292
+ }
293
+ //#endregion
314
294
  }
315
- index_1.Helpers.copy(sourceDist, dest);
316
- //#endregion
317
- }
318
- };
319
- this_1 = this;
320
- try {
321
- //#region normal build
322
- for (_f = tslib_1.__values(libsToBuild.entries()), _g = _f.next(); !_g.done; _g = _f.next()) {
323
- _h = tslib_1.__read(_g.value, 2), index = _h[0], lib = _h[1];
324
- _loop_1(index, lib);
325
295
  }
326
296
  }
327
297
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
328
298
  finally {
329
299
  try {
330
- if (_g && !_g.done && (_m = _f.return)) _m.call(_f);
300
+ if (_f && !_f.done && (_l = _e.return)) _l.call(_e);
331
301
  }
332
302
  finally { if (e_2) throw e_2.error; }
333
303
  }
334
304
  if (!watch) return [3 /*break*/, 12];
335
- _loop_2 = function (index, lib) {
336
- return tslib_1.__generator(this, function (_q) {
337
- switch (_q.label) {
305
+ _loop_1 = function (index, lib) {
306
+ return tslib_1.__generator(this, function (_r) {
307
+ switch (_r.label) {
338
308
  case 0:
339
- index_1.Helpers.info("Building for watch (".concat(index + 1, "/").concat(libsToWatch.length, ") ").concat(lib.basename, " (").concat(tnp_core_1.chalk.bold(lib.name), ")"));
309
+ index_1.Helpers.info("Building for watch (".concat(index + 1, "/").concat(selectedLibs.length, ") ") +
310
+ "".concat(lib.basename, " (").concat(tnp_core_1.chalk.bold(lib.name), ")"));
340
311
  return [4 /*yield*/, (function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
312
+ var debouncedBuild;
341
313
  var _this = this;
342
314
  return tslib_1.__generator(this, function (_a) {
343
315
  switch (_a.label) {
344
- case 0: return [4 /*yield*/, this.project
345
- .run(lib.libraryBuild.getLibraryBuildComamnd({
346
- watch: true,
347
- buildType: buildType,
348
- }), {
349
- output: true,
350
- })
351
- .unitlOutputContains(lib.libraryBuild.getLibraryBuildSuccessComamnd, [], 0, function () {
316
+ case 0:
317
+ debouncedBuild = tnp_core_3._.debounce(function () {
318
+ var e_5, _a;
352
319
  var sourceDist = _this.project.pathFor([
353
320
  tnp_config_1.config.folder.dist,
354
321
  lib.basename,
355
322
  ]);
356
- var dest = _this.project.pathFor([
357
- tnp_config_1.config.folder.node_modules,
358
- lib.name,
359
- ]);
360
- index_1.Helpers.copy(sourceDist, dest);
361
- console.log("Sync done for ".concat(lib.basename, " to ").concat(lib.name));
362
- })];
323
+ try {
324
+ for (var locationsForNodeModules_3 = tslib_1.__values(locationsForNodeModules), locationsForNodeModules_3_1 = locationsForNodeModules_3.next(); !locationsForNodeModules_3_1.done; locationsForNodeModules_3_1 = locationsForNodeModules_3.next()) {
325
+ var node_modules = locationsForNodeModules_3_1.value;
326
+ var dest = (0, tnp_core_2.crossPlatformPath)([node_modules, lib.name]);
327
+ if (index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
328
+ index_1.Helpers.remove(dest);
329
+ }
330
+ index_1.Helpers.copy(sourceDist, dest);
331
+ // console.log({ sourceDist, dest });
332
+ console.log("Sync (watch) done for ".concat(lib.basename, " to ").concat(lib.name, " (").concat((0, tnp_core_2.crossPlatformPath)([
333
+ tnp_core_2.path.basename(tnp_core_2.path.dirname(node_modules)),
334
+ tnp_config_1.config.folder.node_modules,
335
+ ]), ")"));
336
+ }
337
+ }
338
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
339
+ finally {
340
+ try {
341
+ if (locationsForNodeModules_3_1 && !locationsForNodeModules_3_1.done && (_a = locationsForNodeModules_3.return)) _a.call(locationsForNodeModules_3);
342
+ }
343
+ finally { if (e_5) throw e_5.error; }
344
+ }
345
+ }, 500);
346
+ return [4 /*yield*/, this.project
347
+ .run(lib.libraryBuild.getLibraryBuildComamnd({
348
+ watch: true,
349
+ buildType: buildType,
350
+ }), {
351
+ output: true,
352
+ })
353
+ .unitlOutputContains(lib.libraryBuild.getLibraryBuildSuccessComamnd, [], 0, function () {
354
+ if (strategy === 'copy') {
355
+ debouncedBuild();
356
+ }
357
+ })];
363
358
  case 1:
364
359
  _a.sent();
365
360
  return [2 /*return*/];
@@ -367,34 +362,34 @@ var BaseLibraryBuild = /** @class */ (function (_super) {
367
362
  });
368
363
  }); })()];
369
364
  case 1:
370
- _q.sent();
365
+ _r.sent();
371
366
  return [2 /*return*/];
372
367
  }
373
368
  });
374
369
  };
375
- _p.label = 4;
370
+ _q.label = 4;
376
371
  case 4:
377
- _p.trys.push([4, 9, 10, 11]);
378
- _j = tslib_1.__values(libsToWatch.entries()), _k = _j.next();
379
- _p.label = 5;
372
+ _q.trys.push([4, 9, 10, 11]);
373
+ _h = tslib_1.__values(selectedLibs.entries()), _j = _h.next();
374
+ _q.label = 5;
380
375
  case 5:
381
- if (!!_k.done) return [3 /*break*/, 8];
382
- _l = tslib_1.__read(_k.value, 2), index = _l[0], lib = _l[1];
383
- return [5 /*yield**/, _loop_2(index, lib)];
376
+ if (!!_j.done) return [3 /*break*/, 8];
377
+ _k = tslib_1.__read(_j.value, 2), index = _k[0], lib = _k[1];
378
+ return [5 /*yield**/, _loop_1(index, lib)];
384
379
  case 6:
385
- _p.sent();
386
- _p.label = 7;
380
+ _q.sent();
381
+ _q.label = 7;
387
382
  case 7:
388
- _k = _j.next();
383
+ _j = _h.next();
389
384
  return [3 /*break*/, 5];
390
385
  case 8: return [3 /*break*/, 11];
391
386
  case 9:
392
- e_1_1 = _p.sent();
387
+ e_1_1 = _q.sent();
393
388
  e_1 = { error: e_1_1 };
394
389
  return [3 /*break*/, 11];
395
390
  case 10:
396
391
  try {
397
- if (_k && !_k.done && (_o = _j.return)) _o.call(_j);
392
+ if (_j && !_j.done && (_p = _h.return)) _p.call(_h);
398
393
  }
399
394
  finally { if (e_1) throw e_1.error; }
400
395
  return [7 /*endfinally*/];
@@ -405,7 +400,7 @@ var BaseLibraryBuild = /** @class */ (function (_super) {
405
400
  case 12:
406
401
  // await this.__indexRebuilder.start({ taskName: 'index rebuild watch' });
407
402
  index_1.Helpers.success('BUILD DONE');
408
- _p.label = 13;
403
+ _q.label = 13;
409
404
  case 13: return [2 /*return*/];
410
405
  }
411
406
  });
@@ -444,6 +439,36 @@ var BaseLibraryBuild = /** @class */ (function (_super) {
444
439
  enumerable: false,
445
440
  configurable: true
446
441
  });
442
+ //#endregion
443
+ //#region getters & methods / select copy to projects
444
+ BaseLibraryBuild.prototype.selectCopytoProjects = function () {
445
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
446
+ var projects, locations;
447
+ var _this = this;
448
+ return tslib_1.__generator(this, function (_a) {
449
+ switch (_a.label) {
450
+ case 0:
451
+ projects = this.project.ins.allProjectsFromFolder(tnp_core_2.path.dirname(this.project.location))
452
+ .filter(function (c) { return c.location !== _this.project.location; })
453
+ .map(function (p) {
454
+ var _a;
455
+ return ((_a = p.linkedProjects) === null || _a === void 0 ? void 0 : _a.embeddedProject)
456
+ ? p.linkedProjects.embeddedProject
457
+ : p;
458
+ });
459
+ return [4 /*yield*/, index_1.Helpers.consoleGui.multiselect('Copy compiled version to projects', projects.map(function (c) {
460
+ return {
461
+ name: c.genericName,
462
+ value: c.pathFor(tnp_config_1.config.folder.node_modules),
463
+ };
464
+ }), true)];
465
+ case 1:
466
+ locations = _a.sent();
467
+ return [2 /*return*/, locations];
468
+ }
469
+ });
470
+ });
471
+ };
447
472
  return BaseLibraryBuild;
448
473
  }(base_feature_for_project_1.BaseFeatureForProject));
449
474
  exports.BaseLibraryBuild = BaseLibraryBuild;