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.
- package/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/browser/esm2022/lib/base/base-git.mjs +34 -4
- package/browser/esm2022/lib/base/base-library-build.mjs +39 -27
- package/browser/esm2022/lib/base/base-linked-projects.mjs +15 -4
- package/browser/esm2022/lib/base/base-npm-helpers.mjs +16 -6
- package/browser/esm2022/lib/base/base-project-resolver.mjs +10 -1
- package/browser/esm2022/lib/base/base-project.mjs +67 -9
- package/browser/esm2022/lib/base/base-vscode.mjs +66 -0
- package/browser/esm2022/lib/base/core-project.mjs +1 -1
- package/browser/esm2022/lib/base/linked-project.mjs +2 -7
- package/browser/esm2022/lib/models.mjs +1 -1
- package/browser/fesm2022/tnp-helpers.mjs +175 -51
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/base-git.d.ts +11 -0
- package/browser/lib/base/base-library-build.d.ts +31 -6
- package/browser/lib/base/base-npm-helpers.d.ts +0 -1
- package/browser/lib/base/base-project-resolver.d.ts +9 -8
- package/browser/lib/base/base-project.d.ts +9 -4
- package/browser/lib/base/base-vscode.d.ts +6 -0
- package/browser/lib/base/core-project.d.ts +14 -3
- package/browser/lib/models.d.ts +1 -5
- package/client/README.md +24 -24
- package/client/esm2022/lib/base/base-git.mjs +34 -4
- package/client/esm2022/lib/base/base-library-build.mjs +39 -27
- package/client/esm2022/lib/base/base-linked-projects.mjs +15 -4
- package/client/esm2022/lib/base/base-npm-helpers.mjs +16 -6
- package/client/esm2022/lib/base/base-project-resolver.mjs +10 -1
- package/client/esm2022/lib/base/base-project.mjs +67 -9
- package/client/esm2022/lib/base/base-vscode.mjs +66 -0
- package/client/esm2022/lib/base/core-project.mjs +1 -1
- package/client/esm2022/lib/base/linked-project.mjs +2 -7
- package/client/esm2022/lib/models.mjs +1 -1
- package/client/fesm2022/tnp-helpers.mjs +175 -51
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/base-git.d.ts +11 -0
- package/client/lib/base/base-library-build.d.ts +31 -6
- package/client/lib/base/base-npm-helpers.d.ts +0 -1
- package/client/lib/base/base-project-resolver.d.ts +9 -8
- package/client/lib/base/base-project.d.ts +9 -4
- package/client/lib/base/base-vscode.d.ts +6 -0
- package/client/lib/base/core-project.d.ts +14 -3
- package/client/lib/models.d.ts +1 -5
- package/client/package.json +25 -25
- package/firedev.jsonc +61 -61
- package/lib/base/base-command-line.backend.d.ts +7 -1
- package/lib/base/base-command-line.backend.js +83 -7
- package/lib/base/base-command-line.backend.js.map +1 -1
- package/lib/base/base-git.d.ts +11 -0
- package/lib/base/base-git.js +92 -56
- package/lib/base/base-git.js.map +1 -1
- package/lib/base/base-library-build.d.ts +39 -8
- package/lib/base/base-library-build.js +256 -231
- package/lib/base/base-library-build.js.map +1 -1
- package/lib/base/base-linked-projects.js +14 -4
- package/lib/base/base-linked-projects.js.map +1 -1
- package/lib/base/base-npm-helpers.d.ts +0 -1
- package/lib/base/base-npm-helpers.js +15 -8
- package/lib/base/base-npm-helpers.js.map +1 -1
- package/lib/base/base-project-resolver.d.ts +10 -9
- package/lib/base/base-project-resolver.js +11 -1
- package/lib/base/base-project-resolver.js.map +1 -1
- package/lib/base/base-project.d.ts +10 -5
- package/lib/base/base-project.js +84 -22
- package/lib/base/base-project.js.map +1 -1
- package/lib/base/base-vscode.d.ts +5 -0
- package/lib/base/base-vscode.js +79 -0
- package/lib/base/base-vscode.js.map +1 -0
- package/lib/base/command-line-feature.backend.d.ts +6 -1
- package/lib/base/command-line-feature.backend.js +67 -1
- package/lib/base/command-line-feature.backend.js.map +1 -1
- package/lib/base/core-project.d.ts +14 -3
- package/lib/base/core-project.js.map +1 -1
- package/lib/base/linked-project.js +8 -10
- package/lib/base/linked-project.js.map +1 -1
- package/lib/helpers/for-backend/helpers-file-folders.backend.d.ts +16 -8
- package/lib/helpers/for-backend/helpers-file-folders.backend.js +156 -65
- package/lib/helpers/for-backend/helpers-file-folders.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-git.backend.d.ts +2 -0
- package/lib/helpers/for-backend/helpers-git.backend.js +72 -0
- package/lib/helpers/for-backend/helpers-git.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-process.backend.js +3 -1
- package/lib/helpers/for-backend/helpers-process.backend.js.map +1 -1
- package/lib/helpers/for-browser/angular.helper.js +3 -3
- package/lib/models.d.ts +1 -5
- package/lib/old/base-component.js +3 -3
- package/lib/old/base-formly-component.js +3 -3
- package/lib/old/dual-component-ctrl.js +3 -3
- package/package.json +4 -4
- package/tmp-environment.json +30 -30
- package/websql/README.md +24 -24
- package/websql/esm2022/lib/base/base-git.mjs +34 -4
- package/websql/esm2022/lib/base/base-library-build.mjs +39 -27
- package/websql/esm2022/lib/base/base-linked-projects.mjs +15 -4
- package/websql/esm2022/lib/base/base-npm-helpers.mjs +16 -6
- package/websql/esm2022/lib/base/base-project-resolver.mjs +10 -1
- package/websql/esm2022/lib/base/base-project.mjs +76 -18
- package/websql/esm2022/lib/base/base-vscode.mjs +66 -0
- package/websql/esm2022/lib/base/core-project.mjs +1 -1
- package/websql/esm2022/lib/base/linked-project.mjs +2 -7
- package/websql/esm2022/lib/models.mjs +1 -1
- package/websql/fesm2022/tnp-helpers.mjs +183 -59
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/base-git.d.ts +11 -0
- package/websql/lib/base/base-library-build.d.ts +31 -6
- package/websql/lib/base/base-npm-helpers.d.ts +0 -1
- package/websql/lib/base/base-project-resolver.d.ts +9 -8
- package/websql/lib/base/base-project.d.ts +10 -8
- package/websql/lib/base/base-vscode.d.ts +6 -0
- package/websql/lib/base/core-project.d.ts +14 -3
- 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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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,
|
|
73
|
-
return tslib_1.__generator(this, function (
|
|
74
|
-
switch (
|
|
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 = ((
|
|
79
|
-
if (!(tnp_core_3._.isArray(lastSelected) && lastSelected.length > 0)) return [3 /*break*/,
|
|
80
|
-
selected = lastSelected.map(function (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 (
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
91
|
-
|
|
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*/,
|
|
85
|
+
return [2 /*return*/, { selectedLibs: selectedLibs, skipRebuildingAllForWatch: skipRebuildingAllForWatch }];
|
|
98
86
|
}
|
|
99
|
-
|
|
100
|
-
case
|
|
101
|
-
if (!true) return [3 /*break*/,
|
|
102
|
-
return [4 /*yield*/, index_1.Helpers.consoleGui.multiselect("Select libraries to
|
|
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
|
|
106
|
-
|
|
107
|
-
selected =
|
|
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
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
return [3 /*break*/,
|
|
98
|
+
case 9:
|
|
99
|
+
if (_c.sent()) {
|
|
100
|
+
selectedLibs = selected;
|
|
101
|
+
return [3 /*break*/, 10];
|
|
114
102
|
}
|
|
115
|
-
return [3 /*break*/,
|
|
116
|
-
case
|
|
103
|
+
return [3 /*break*/, 7];
|
|
104
|
+
case 10:
|
|
117
105
|
index_1.Helpers.writeJson(this.project.pathFor(lastSelectedJsonFile), {
|
|
118
|
-
lastSelected:
|
|
106
|
+
lastSelected: selectedLibs.map(function (c) { return c.basename; }),
|
|
119
107
|
});
|
|
120
|
-
return [2 /*return*/,
|
|
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
|
|
141
|
+
var watch = _a.watch, watchBuildSupported = _a.watchBuildSupported;
|
|
165
142
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
166
|
-
var allLibs,
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Angular library build
|
|
174
|
+
*/
|
|
199
175
|
BaseLibraryBuild.prototype.buildLibraries = function (_a) {
|
|
200
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.
|
|
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,
|
|
203
|
-
var e_2, _m, e_1,
|
|
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 (
|
|
206
|
-
switch (
|
|
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
|
-
|
|
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.
|
|
218
|
-
|
|
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
|
-
|
|
199
|
+
_q.sent();
|
|
224
200
|
return [4 /*yield*/, this.selectLibraries({
|
|
225
|
-
|
|
201
|
+
watch: watch,
|
|
226
202
|
})];
|
|
227
203
|
case 3:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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 && (
|
|
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 (
|
|
246
|
+
if (!index_1.Helpers.exists(sourceDist)) {
|
|
262
247
|
index_1.Helpers.info("Compiling ".concat(lib.name, " ..."));
|
|
263
|
-
|
|
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 (
|
|
313
|
-
|
|
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 (
|
|
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
|
-
|
|
336
|
-
return tslib_1.__generator(this, function (
|
|
337
|
-
switch (
|
|
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(
|
|
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:
|
|
345
|
-
|
|
346
|
-
|
|
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
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
-
|
|
365
|
+
_r.sent();
|
|
371
366
|
return [2 /*return*/];
|
|
372
367
|
}
|
|
373
368
|
});
|
|
374
369
|
};
|
|
375
|
-
|
|
370
|
+
_q.label = 4;
|
|
376
371
|
case 4:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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 (!!
|
|
382
|
-
|
|
383
|
-
return [5 /*yield**/,
|
|
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
|
-
|
|
386
|
-
|
|
380
|
+
_q.sent();
|
|
381
|
+
_q.label = 7;
|
|
387
382
|
case 7:
|
|
388
|
-
|
|
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 =
|
|
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 (
|
|
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
|
-
|
|
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;
|