tnp-helpers 16.444.16 → 16.444.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/browser/esm2022/lib/base/base-git.mjs +613 -0
- package/browser/esm2022/lib/base/base-library-build.mjs +383 -0
- package/browser/esm2022/lib/base/base-linked-projects.mjs +291 -0
- package/browser/esm2022/lib/base/base-npm-helpers.mjs +317 -0
- package/browser/esm2022/lib/base/base-project-resolver.mjs +56 -2
- package/browser/esm2022/lib/base/base-project.mjs +180 -1482
- package/browser/esm2022/lib/base/core-project.mjs +5 -3
- package/browser/esm2022/lib/base/index.mjs +5 -1
- package/browser/esm2022/lib/models.mjs +2 -1
- package/browser/fesm2022/tnp-helpers.mjs +1098 -748
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/base-git.d.ts +114 -0
- package/browser/lib/base/base-library-build.d.ts +22 -0
- package/browser/lib/base/base-linked-projects.d.ts +23 -0
- package/browser/lib/base/base-npm-helpers.d.ts +80 -0
- package/browser/lib/base/base-project-resolver.d.ts +2 -1
- package/browser/lib/base/base-project.d.ts +9 -205
- package/browser/lib/base/index.d.ts +4 -0
- package/browser/lib/models.d.ts +17 -4
- package/client/README.md +24 -24
- package/client/esm2022/lib/base/base-git.mjs +613 -0
- package/client/esm2022/lib/base/base-library-build.mjs +383 -0
- package/client/esm2022/lib/base/base-linked-projects.mjs +291 -0
- package/client/esm2022/lib/base/base-npm-helpers.mjs +317 -0
- package/client/esm2022/lib/base/base-project-resolver.mjs +56 -2
- package/client/esm2022/lib/base/base-project.mjs +180 -1482
- package/client/esm2022/lib/base/core-project.mjs +5 -3
- package/client/esm2022/lib/base/index.mjs +5 -1
- package/client/esm2022/lib/models.mjs +2 -1
- package/client/fesm2022/tnp-helpers.mjs +1098 -748
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/base-git.d.ts +114 -0
- package/client/lib/base/base-library-build.d.ts +22 -0
- package/client/lib/base/base-linked-projects.d.ts +23 -0
- package/client/lib/base/base-npm-helpers.d.ts +80 -0
- package/client/lib/base/base-project-resolver.d.ts +2 -1
- package/client/lib/base/base-project.d.ts +9 -205
- package/client/lib/base/index.d.ts +4 -0
- package/client/lib/models.d.ts +17 -4
- package/client/package.json +9 -9
- package/firedev.jsonc +61 -61
- package/lib/base/base-command-line.backend.d.ts +1 -0
- package/lib/base/base-command-line.backend.js +26 -13
- package/lib/base/base-command-line.backend.js.map +1 -1
- package/lib/base/base-git.d.ts +120 -0
- package/lib/base/base-git.js +856 -0
- package/lib/base/base-git.js.map +1 -0
- package/lib/base/base-library-build.d.ts +26 -0
- package/lib/base/base-library-build.js +450 -0
- package/lib/base/base-library-build.js.map +1 -0
- package/lib/base/base-linked-projects.d.ts +23 -0
- package/lib/base/base-linked-projects.js +391 -0
- package/lib/base/base-linked-projects.js.map +1 -0
- package/lib/base/base-npm-helpers.d.ts +79 -0
- package/lib/base/base-npm-helpers.js +399 -0
- package/lib/base/base-npm-helpers.js.map +1 -0
- package/lib/base/base-project-resolver.d.ts +2 -1
- package/lib/base/base-project-resolver.js +39 -4
- package/lib/base/base-project-resolver.js.map +1 -1
- package/lib/base/base-project.d.ts +11 -214
- package/lib/base/base-project.js +103 -1739
- package/lib/base/base-project.js.map +1 -1
- package/lib/base/core-project.js +8 -4
- package/lib/base/core-project.js.map +1 -1
- package/lib/base/index.d.ts +4 -0
- package/lib/base/index.js +4 -0
- package/lib/base/index.js.map +1 -1
- package/lib/helpers/for-backend/helpers-git.backend.d.ts +1 -1
- package/lib/helpers/for-backend/helpers-git.backend.js +2 -2
- package/lib/helpers/for-browser/angular.helper.js +3 -3
- package/lib/models.d.ts +17 -4
- 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 +13 -13
- package/websql/README.md +24 -24
- package/websql/esm2022/lib/base/base-git.mjs +613 -0
- package/websql/esm2022/lib/base/base-library-build.mjs +383 -0
- package/websql/esm2022/lib/base/base-linked-projects.mjs +291 -0
- package/websql/esm2022/lib/base/base-npm-helpers.mjs +317 -0
- package/websql/esm2022/lib/base/base-project-resolver.mjs +50 -2
- package/websql/esm2022/lib/base/base-project.mjs +235 -1537
- package/websql/esm2022/lib/base/core-project.mjs +5 -3
- package/websql/esm2022/lib/base/index.mjs +5 -1
- package/websql/esm2022/lib/models.mjs +2 -1
- package/websql/fesm2022/tnp-helpers.mjs +1106 -761
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/base-git.d.ts +114 -0
- package/websql/lib/base/base-library-build.d.ts +22 -0
- package/websql/lib/base/base-linked-projects.d.ts +23 -0
- package/websql/lib/base/base-npm-helpers.d.ts +80 -0
- package/websql/lib/base/base-project-resolver.d.ts +2 -1
- package/websql/lib/base/base-project.d.ts +12 -205
- package/websql/lib/base/index.d.ts +4 -0
- package/websql/lib/models.d.ts +17 -4
package/lib/base/base-project.js
CHANGED
|
@@ -2,20 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseProject = exports.ChildProcess = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var tnp_cli_1 = require("tnp-cli");
|
|
6
5
|
var tnp_core_1 = require("tnp-core");
|
|
7
|
-
var
|
|
6
|
+
var child_process_1 = require("child_process");
|
|
7
|
+
Object.defineProperty(exports, "ChildProcess", { enumerable: true, get: function () { return child_process_1.ChildProcess; } });
|
|
8
|
+
var tnp_cli_1 = require("tnp-cli");
|
|
8
9
|
var tnp_core_2 = require("tnp-core");
|
|
10
|
+
var tnp_core_3 = require("tnp-core");
|
|
9
11
|
var index_1 = require("../index");
|
|
10
12
|
var base_project_resolver_1 = require("./base-project-resolver");
|
|
11
|
-
//#region @backend
|
|
12
|
-
var translate_1 = require("./translate");
|
|
13
|
-
var json5Write = require("json10-writer");
|
|
14
|
-
var tnp_core_3 = require("tnp-core");
|
|
15
|
-
var child_process_1 = require("child_process");
|
|
16
|
-
Object.defineProperty(exports, "ChildProcess", { enumerable: true, get: function () { return child_process_1.ChildProcess; } });
|
|
17
|
-
var tsfmt = require("typescript-formatter");
|
|
18
|
-
//#endregion
|
|
19
13
|
//#endregion
|
|
20
14
|
var takenPorts = [];
|
|
21
15
|
var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
@@ -39,114 +33,16 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
39
33
|
this.toString = function () {
|
|
40
34
|
return "".concat(_this.name, "=>").concat(_this.location);
|
|
41
35
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (stack[projNameToCompare(project)]) {
|
|
51
|
-
// Circular dependency detected
|
|
52
|
-
index_1.Helpers.error("Circular dependency detected involving project: ".concat(projNameToCompare(project)));
|
|
53
|
-
}
|
|
54
|
-
if (!visited[projNameToCompare(project)]) {
|
|
55
|
-
visited[projNameToCompare(project)] = true;
|
|
56
|
-
stack[projNameToCompare(project)] = true;
|
|
57
|
-
var depsResolved = resoveDepsArray(project);
|
|
58
|
-
depsResolved.forEach(function (dependency) {
|
|
59
|
-
var dependentProject = projects.find(function (p) {
|
|
60
|
-
// console.log(`comparing :"${projNameToCompare(p)}" and "${dependency}"`)
|
|
61
|
-
return projNameToCompare(p) === dependency;
|
|
62
|
-
});
|
|
63
|
-
if (dependentProject) {
|
|
64
|
-
visit(dependentProject);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
stack[projNameToCompare(project)] = false;
|
|
68
|
-
result.push(project);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
projects.forEach(function (project) { return visit(project); });
|
|
72
|
-
return result;
|
|
73
|
-
// return result.reverse(); // Reverse the result to get the correct order
|
|
74
|
-
};
|
|
75
|
-
Object.defineProperty(BaseProject.prototype, "embeddedProject", {
|
|
36
|
+
//#region @backend
|
|
37
|
+
this.libraryBuild = new (require('./base-library-build')
|
|
38
|
+
.BaseLibraryBuild)(this);
|
|
39
|
+
this.npmHelpers = new (require('./base-npm-helpers')
|
|
40
|
+
.BaseNpmHelpers)(this);
|
|
41
|
+
this.linkedProjects = new (require('./base-linked-projects')
|
|
42
|
+
.BaseLinkedProjects)(this);
|
|
43
|
+
this.git = new (require('./base-git').BaseGit)(this);
|
|
76
44
|
//#endregion
|
|
77
|
-
|
|
78
|
-
var _this = this;
|
|
79
|
-
var _a;
|
|
80
|
-
var cacheKey = 'embeddedProject' + tnp_core_2._.kebabCase(this.location);
|
|
81
|
-
if (!tnp_core_2._.isUndefined(this.globalCache[cacheKey])) {
|
|
82
|
-
return this.globalCache[cacheKey];
|
|
83
|
-
}
|
|
84
|
-
// Helpers.taskStarted(`Detecting embedded project for ${this.location}`); // TODO it is slow
|
|
85
|
-
var nearsetProj = this.ins.nearestTo((0, tnp_core_1.crossPlatformPath)([this.location, '..']));
|
|
86
|
-
var linkedPorj = (_a = nearsetProj === null || nearsetProj === void 0 ? void 0 : nearsetProj.linkedProjects) === null || _a === void 0 ? void 0 : _a.find(function (l) {
|
|
87
|
-
return (_this.location ===
|
|
88
|
-
(0, tnp_core_1.crossPlatformPath)([nearsetProj.location, l.relativeClonePath]));
|
|
89
|
-
});
|
|
90
|
-
if (!linkedPorj || !linkedPorj.internalRealtiveProjectPath) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
var pathToEmbededProj = (0, tnp_core_1.crossPlatformPath)([
|
|
94
|
-
nearsetProj.location,
|
|
95
|
-
linkedPorj.relativeClonePath,
|
|
96
|
-
linkedPorj.internalRealtiveProjectPath || '',
|
|
97
|
-
]);
|
|
98
|
-
var embdedresult = this.ins.From(pathToEmbededProj);
|
|
99
|
-
// Helpers.taskDone(`Embedded project detected for ${this.location}`);
|
|
100
|
-
this.globalCache[cacheKey] = embdedresult;
|
|
101
|
-
return this.globalCache[cacheKey];
|
|
102
|
-
},
|
|
103
|
-
enumerable: false,
|
|
104
|
-
configurable: true
|
|
105
|
-
});
|
|
106
|
-
Object.defineProperty(BaseProject.prototype, "projectsDbLocation", {
|
|
107
|
-
get: function () {
|
|
108
|
-
//#region @backendFunc
|
|
109
|
-
return this.ins.projectsDb.projectsDbLocation;
|
|
110
|
-
//#endregion
|
|
111
|
-
},
|
|
112
|
-
enumerable: false,
|
|
113
|
-
configurable: true
|
|
114
|
-
});
|
|
115
|
-
//#region static / save location to db
|
|
116
|
-
BaseProject.prototype.saveLocationToDB = function () {
|
|
117
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
118
|
-
var db, existed, error_1;
|
|
119
|
-
var _this = this;
|
|
120
|
-
return tslib_1.__generator(this, function (_a) {
|
|
121
|
-
switch (_a.label) {
|
|
122
|
-
case 0: return [4 /*yield*/, this.ins.projectsDb.useDB()];
|
|
123
|
-
case 1:
|
|
124
|
-
db = _a.sent();
|
|
125
|
-
existed = db.data.projects.find(function (f) { return f.location === _this.location; });
|
|
126
|
-
if (!!existed) return [3 /*break*/, 5];
|
|
127
|
-
_a.label = 2;
|
|
128
|
-
case 2:
|
|
129
|
-
_a.trys.push([2, 4, , 5]);
|
|
130
|
-
return [4 /*yield*/, db.update(function (data) {
|
|
131
|
-
if (data.projects.length > 50) {
|
|
132
|
-
data.projects.shift();
|
|
133
|
-
}
|
|
134
|
-
data.projects.push({
|
|
135
|
-
location: _this.location,
|
|
136
|
-
});
|
|
137
|
-
})];
|
|
138
|
-
case 3:
|
|
139
|
-
_a.sent();
|
|
140
|
-
return [3 /*break*/, 5];
|
|
141
|
-
case 4:
|
|
142
|
-
error_1 = _a.sent();
|
|
143
|
-
index_1.Helpers.warn("Cannot save location to db");
|
|
144
|
-
return [3 /*break*/, 5];
|
|
145
|
-
case 5: return [2 /*return*/];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
};
|
|
45
|
+
}
|
|
150
46
|
Object.defineProperty(BaseProject.prototype, "globalCache", {
|
|
151
47
|
get: function () {
|
|
152
48
|
return BaseProject.cache;
|
|
@@ -154,59 +50,6 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
154
50
|
enumerable: false,
|
|
155
51
|
configurable: true
|
|
156
52
|
});
|
|
157
|
-
//#endregion
|
|
158
|
-
//#region methods & getters / save all linked projects to db
|
|
159
|
-
BaseProject.prototype.saveAllLinkedProjectsToDB = function () {
|
|
160
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
161
|
-
var proj, _a, _b, link, linkedPorj, e_1_1;
|
|
162
|
-
var e_1, _c;
|
|
163
|
-
return tslib_1.__generator(this, function (_d) {
|
|
164
|
-
switch (_d.label) {
|
|
165
|
-
case 0:
|
|
166
|
-
proj = this;
|
|
167
|
-
return [4 /*yield*/, proj.saveLocationToDB()];
|
|
168
|
-
case 1:
|
|
169
|
-
_d.sent();
|
|
170
|
-
_d.label = 2;
|
|
171
|
-
case 2:
|
|
172
|
-
_d.trys.push([2, 8, 9, 10]);
|
|
173
|
-
_a = tslib_1.__values(proj.linkedProjects), _b = _a.next();
|
|
174
|
-
_d.label = 3;
|
|
175
|
-
case 3:
|
|
176
|
-
if (!!_b.done) return [3 /*break*/, 7];
|
|
177
|
-
link = _b.value;
|
|
178
|
-
linkedPorj = this.ins.From([
|
|
179
|
-
proj.location,
|
|
180
|
-
link.relativeClonePath,
|
|
181
|
-
link.internalRealtiveProjectPath || '',
|
|
182
|
-
]);
|
|
183
|
-
if (!linkedPorj) return [3 /*break*/, 5];
|
|
184
|
-
return [4 /*yield*/, linkedPorj.saveLocationToDB()];
|
|
185
|
-
case 4:
|
|
186
|
-
_d.sent();
|
|
187
|
-
return [3 /*break*/, 6];
|
|
188
|
-
case 5:
|
|
189
|
-
index_1.Helpers.warn("Folder ".concat(link.relativeClonePath, " is missing projects..."));
|
|
190
|
-
_d.label = 6;
|
|
191
|
-
case 6:
|
|
192
|
-
_b = _a.next();
|
|
193
|
-
return [3 /*break*/, 3];
|
|
194
|
-
case 7: return [3 /*break*/, 10];
|
|
195
|
-
case 8:
|
|
196
|
-
e_1_1 = _d.sent();
|
|
197
|
-
e_1 = { error: e_1_1 };
|
|
198
|
-
return [3 /*break*/, 10];
|
|
199
|
-
case 9:
|
|
200
|
-
try {
|
|
201
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
202
|
-
}
|
|
203
|
-
finally { if (e_1) throw e_1.error; }
|
|
204
|
-
return [7 /*endfinally*/];
|
|
205
|
-
case 10: return [2 /*return*/];
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
53
|
Object.defineProperty(BaseProject.prototype, "isMonorepo", {
|
|
211
54
|
//#endregion
|
|
212
55
|
//#region methods & getters / is monorepo
|
|
@@ -219,7 +62,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
219
62
|
//#endregion
|
|
220
63
|
//#region getters & methods / order core projects
|
|
221
64
|
BaseProject.prototype.orderCoreProjects = function (coreProjects) {
|
|
222
|
-
var
|
|
65
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
223
66
|
var projectMap = new Map();
|
|
224
67
|
try {
|
|
225
68
|
// Initialize the project map
|
|
@@ -228,12 +71,12 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
228
71
|
projectMap.set(project, []);
|
|
229
72
|
}
|
|
230
73
|
}
|
|
231
|
-
catch (
|
|
74
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
232
75
|
finally {
|
|
233
76
|
try {
|
|
234
77
|
if (coreProjects_1_1 && !coreProjects_1_1.done && (_a = coreProjects_1.return)) _a.call(coreProjects_1);
|
|
235
78
|
}
|
|
236
|
-
finally { if (
|
|
79
|
+
finally { if (e_1) throw e_1.error; }
|
|
237
80
|
}
|
|
238
81
|
try {
|
|
239
82
|
// Populate the project map with dependencies
|
|
@@ -245,17 +88,17 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
245
88
|
projectMap.get(project.extends).push(project);
|
|
246
89
|
}
|
|
247
90
|
}
|
|
248
|
-
catch (
|
|
91
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
249
92
|
finally {
|
|
250
93
|
try {
|
|
251
94
|
if (coreProjects_2_1 && !coreProjects_2_1.done && (_b = coreProjects_2.return)) _b.call(coreProjects_2);
|
|
252
95
|
}
|
|
253
|
-
finally { if (
|
|
96
|
+
finally { if (e_2) throw e_2.error; }
|
|
254
97
|
}
|
|
255
98
|
var orderedProjects = [];
|
|
256
99
|
var visited = new Set();
|
|
257
100
|
var visit = function (project) {
|
|
258
|
-
var
|
|
101
|
+
var e_4, _a;
|
|
259
102
|
if (!visited.has(project)) {
|
|
260
103
|
visited.add(project);
|
|
261
104
|
var dependencies = projectMap.get(project);
|
|
@@ -266,12 +109,12 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
266
109
|
visit(dep);
|
|
267
110
|
}
|
|
268
111
|
}
|
|
269
|
-
catch (
|
|
112
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
270
113
|
finally {
|
|
271
114
|
try {
|
|
272
115
|
if (dependencies_1_1 && !dependencies_1_1.done && (_a = dependencies_1.return)) _a.call(dependencies_1);
|
|
273
116
|
}
|
|
274
|
-
finally { if (
|
|
117
|
+
finally { if (e_4) throw e_4.error; }
|
|
275
118
|
}
|
|
276
119
|
}
|
|
277
120
|
orderedProjects.push(project);
|
|
@@ -284,12 +127,12 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
284
127
|
visit(project);
|
|
285
128
|
}
|
|
286
129
|
}
|
|
287
|
-
catch (
|
|
130
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
288
131
|
finally {
|
|
289
132
|
try {
|
|
290
133
|
if (coreProjects_3_1 && !coreProjects_3_1.done && (_c = coreProjects_3.return)) _c.call(coreProjects_3);
|
|
291
134
|
}
|
|
292
|
-
finally { if (
|
|
135
|
+
finally { if (e_3) throw e_3.error; }
|
|
293
136
|
}
|
|
294
137
|
return orderedProjects.reverse();
|
|
295
138
|
};
|
|
@@ -298,7 +141,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
298
141
|
//#region methods & getters / core
|
|
299
142
|
get: function () {
|
|
300
143
|
var _this = this;
|
|
301
|
-
if (!
|
|
144
|
+
if (!tnp_core_3._.isUndefined(this.cache['core'])) {
|
|
302
145
|
return this.cache['core'];
|
|
303
146
|
}
|
|
304
147
|
// Helpers.taskStarted(`Detecting core project for ${this.genericName}`);
|
|
@@ -308,166 +151,19 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
308
151
|
coreProjects = this.orderCoreProjects(coreProjects);
|
|
309
152
|
// Helpers.taskDone(`Core project detected for ${this.genericName}`);
|
|
310
153
|
// console.log('CoreProject.coreProjects', CoreProject.coreProjects.map(c => c.name));
|
|
311
|
-
this.cache['core'] =
|
|
154
|
+
this.cache['core'] = tnp_core_3._.first(coreProjects);
|
|
312
155
|
return this.cache['core'];
|
|
313
156
|
},
|
|
314
157
|
enumerable: false,
|
|
315
158
|
configurable: true
|
|
316
159
|
});
|
|
317
|
-
//#endregion
|
|
318
|
-
//#region methods & getters / add linked project
|
|
319
|
-
BaseProject.prototype.addLinkedProject = function (linkedProj) {
|
|
320
|
-
var linkedProject = tnp_core_2._.isString(linkedProj)
|
|
321
|
-
? index_1.LinkedProject.fromName(linkedProj)
|
|
322
|
-
: linkedProj;
|
|
323
|
-
//#region @backendFunc
|
|
324
|
-
var linkedProjectsConfig = this.getLinkedProjectsConfig();
|
|
325
|
-
linkedProjectsConfig.projects.push(index_1.LinkedProject.from(linkedProject));
|
|
326
|
-
this.setLinkedProjectsConfig(linkedProjectsConfig);
|
|
327
|
-
//#endregion
|
|
328
|
-
};
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region methods & getters / add linked projects
|
|
331
|
-
BaseProject.prototype.addLinkedProjects = function (linkedProjs) {
|
|
332
|
-
var e_6, _a;
|
|
333
|
-
try {
|
|
334
|
-
//#region @backendFunc
|
|
335
|
-
for (var linkedProjs_1 = tslib_1.__values(linkedProjs), linkedProjs_1_1 = linkedProjs_1.next(); !linkedProjs_1_1.done; linkedProjs_1_1 = linkedProjs_1.next()) {
|
|
336
|
-
var linkedProj = linkedProjs_1_1.value;
|
|
337
|
-
this.addLinkedProject(linkedProj);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
341
|
-
finally {
|
|
342
|
-
try {
|
|
343
|
-
if (linkedProjs_1_1 && !linkedProjs_1_1.done && (_a = linkedProjs_1.return)) _a.call(linkedProjs_1);
|
|
344
|
-
}
|
|
345
|
-
finally { if (e_6) throw e_6.error; }
|
|
346
|
-
}
|
|
347
|
-
//#endregion
|
|
348
|
-
};
|
|
349
|
-
//#endregion
|
|
350
|
-
//#region methods & getters / set linked projects config
|
|
351
|
-
BaseProject.prototype.setLinkedProjectsConfig = function (linkedPorjectsConfig) {
|
|
352
|
-
//#region @backendFunc
|
|
353
|
-
if (!index_1.Helpers.exists(this.linkedProjectsConfigPath)) {
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
var orgContent = index_1.Helpers.readFile(this.linkedProjectsConfigPath);
|
|
357
|
-
linkedPorjectsConfig = index_1.LinkedPorjectsConfig.from(linkedPorjectsConfig);
|
|
358
|
-
var writer = json5Write.load(orgContent);
|
|
359
|
-
writer.write(linkedPorjectsConfig);
|
|
360
|
-
var newContent = writer.toSource({
|
|
361
|
-
quote: 'double',
|
|
362
|
-
trailingComma: true,
|
|
363
|
-
quotaKey: true,
|
|
364
|
-
});
|
|
365
|
-
index_1.Helpers.writeFile(this.linkedProjectsConfigPath, newContent);
|
|
366
|
-
try {
|
|
367
|
-
tsfmt.processFiles([this.linkedProjectsConfigPath], {
|
|
368
|
-
verbose: false,
|
|
369
|
-
replace: true,
|
|
370
|
-
verify: false,
|
|
371
|
-
// tsconfig: true,
|
|
372
|
-
// tslint: true,
|
|
373
|
-
editorconfig: true,
|
|
374
|
-
tsfmt: true,
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
catch (error) {
|
|
378
|
-
// console.log('ts formatting error',error)
|
|
379
|
-
}
|
|
380
|
-
//#endregion
|
|
381
|
-
};
|
|
382
|
-
Object.defineProperty(BaseProject.prototype, "linkedProjectsConfigPath", {
|
|
383
|
-
//#endregion
|
|
384
|
-
//#region methods & getters / get linked projects config path
|
|
385
|
-
get: function () {
|
|
386
|
-
return this.pathFor(tnp_config_1.config.file.linked_projects_json);
|
|
387
|
-
},
|
|
388
|
-
enumerable: false,
|
|
389
|
-
configurable: true
|
|
390
|
-
});
|
|
391
|
-
//#endregion
|
|
392
|
-
//#region methods & getters / recreate linked projects config
|
|
393
|
-
BaseProject.prototype.recreateLinkedProjectsConfig = function () {
|
|
394
|
-
//#region @backendFunc
|
|
395
|
-
if (!index_1.Helpers.exists(this.linkedProjectsConfigPath) &&
|
|
396
|
-
index_1.Helpers.exists(this.pathFor(tnp_config_1.config.file.firedev_jsonc))) {
|
|
397
|
-
index_1.Helpers.writeJson(this.linkedProjectsConfigPath, index_1.LinkedPorjectsConfig.from({ projects: [] }));
|
|
398
|
-
}
|
|
399
|
-
//#endregion
|
|
400
|
-
};
|
|
401
|
-
//#endregion
|
|
402
|
-
//#region methods & getters / get linked projects config
|
|
403
|
-
BaseProject.prototype.getLinkedProjectsConfig = function () {
|
|
404
|
-
//#region @backendFunc
|
|
405
|
-
this.recreateLinkedProjectsConfig();
|
|
406
|
-
var existedConfig = index_1.Helpers.readJson(this.pathFor(tnp_config_1.config.file.linked_projects_json), {}, true);
|
|
407
|
-
var orgExistedConfig = tnp_core_2._.cloneDeep(existedConfig);
|
|
408
|
-
// console.log({ existedConfig });
|
|
409
|
-
var linkedPorjectsConfig = index_1.LinkedPorjectsConfig.from(existedConfig);
|
|
410
|
-
var currentRemoteUrl = this.git.originURL;
|
|
411
|
-
var currentBranch = this.git.currentBranchName;
|
|
412
|
-
linkedPorjectsConfig.projects = (linkedPorjectsConfig.projects || []).map(function (projOrProjName) {
|
|
413
|
-
if (tnp_core_2._.isString(projOrProjName)) {
|
|
414
|
-
return index_1.LinkedProject.fromName(projOrProjName, currentRemoteUrl, currentBranch);
|
|
415
|
-
}
|
|
416
|
-
if (!projOrProjName.relativeClonePath) {
|
|
417
|
-
projOrProjName.relativeClonePath = tnp_core_1.path
|
|
418
|
-
.basename(projOrProjName.remoteUrl())
|
|
419
|
-
.replace('.git', '');
|
|
420
|
-
}
|
|
421
|
-
projOrProjName = index_1.LinkedProject.from(projOrProjName);
|
|
422
|
-
if (!projOrProjName.remoteUrl()) {
|
|
423
|
-
projOrProjName.repoUrl = currentRemoteUrl.replace(tnp_core_1.path.basename(currentRemoteUrl), "".concat(projOrProjName.relativeClonePath, ".git"));
|
|
424
|
-
}
|
|
425
|
-
return projOrProjName;
|
|
426
|
-
});
|
|
427
|
-
// console.log({ linkedPorjectsConfig })
|
|
428
|
-
// @ts-ignore
|
|
429
|
-
linkedPorjectsConfig.projects = index_1.Helpers.uniqArray(linkedPorjectsConfig.projects, 'relativeClonePath');
|
|
430
|
-
if (!tnp_core_2._.isEqual(orgExistedConfig, linkedPorjectsConfig)) {
|
|
431
|
-
this.setLinkedProjectsConfig(linkedPorjectsConfig);
|
|
432
|
-
}
|
|
433
|
-
return linkedPorjectsConfig;
|
|
434
|
-
//#endregion
|
|
435
|
-
};
|
|
436
|
-
Object.defineProperty(BaseProject.prototype, "linkedProjects", {
|
|
437
|
-
//#endregion
|
|
438
|
-
//#region methods & getters / linked projects
|
|
439
|
-
get: function () {
|
|
440
|
-
return this.getLinkedProjectsConfig().projects || [];
|
|
441
|
-
},
|
|
442
|
-
enumerable: false,
|
|
443
|
-
configurable: true
|
|
444
|
-
});
|
|
445
|
-
Object.defineProperty(BaseProject.prototype, "detectedLinkedProjects", {
|
|
446
|
-
//#endregion
|
|
447
|
-
//#region methods & getters / detected linked projects
|
|
448
|
-
get: function () {
|
|
449
|
-
var detectedLinkedProjects = index_1.LinkedProject.detect(this.location, true);
|
|
450
|
-
return detectedLinkedProjects;
|
|
451
|
-
},
|
|
452
|
-
enumerable: false,
|
|
453
|
-
configurable: true
|
|
454
|
-
});
|
|
455
|
-
Object.defineProperty(BaseProject.prototype, "linkedProjectsPrefix", {
|
|
456
|
-
//#endregion
|
|
457
|
-
//#region methods & getters / linked projects prefix
|
|
458
|
-
get: function () {
|
|
459
|
-
return this.getLinkedProjectsConfig().prefix;
|
|
460
|
-
},
|
|
461
|
-
enumerable: false,
|
|
462
|
-
configurable: true
|
|
463
|
-
});
|
|
464
160
|
Object.defineProperty(BaseProject.prototype, "linkedProjectsExisted", {
|
|
465
161
|
//#endregion
|
|
466
162
|
//#region getters & methods / link project exited
|
|
467
163
|
get: function () {
|
|
468
164
|
var _this = this;
|
|
469
165
|
//#region @backendFunc
|
|
470
|
-
return this.linkedProjects
|
|
166
|
+
return this.linkedProjects.linkedProjects
|
|
471
167
|
.map(function (f) {
|
|
472
168
|
var proj = _this.ins.From(_this.pathFor(f.relativeClonePath));
|
|
473
169
|
return proj;
|
|
@@ -479,98 +175,13 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
479
175
|
configurable: true
|
|
480
176
|
});
|
|
481
177
|
//#endregion
|
|
482
|
-
//#region
|
|
483
|
-
BaseProject.prototype.resetLinkedProjectsOnlyToCoreBranches = function () {
|
|
484
|
-
return false;
|
|
485
|
-
};
|
|
486
|
-
//#endregion
|
|
487
|
-
//#region getters & methods / get unexisted projects
|
|
488
|
-
BaseProject.prototype.cloneUnexistedLinkedProjects = function (actionType, cloneChildren) {
|
|
489
|
-
if (cloneChildren === void 0) { cloneChildren = false; }
|
|
490
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
491
|
-
var detectedLinkedProjects, projectsThatShouldBeLinked, _a, projectsThatShouldBeLinked_1, projectsThatShouldBeLinked_1_1, linkedProj, childProjLocaiton, childProj, e_7_1;
|
|
492
|
-
var e_7, _b;
|
|
493
|
-
return tslib_1.__generator(this, function (_c) {
|
|
494
|
-
switch (_c.label) {
|
|
495
|
-
case 0:
|
|
496
|
-
//#region @backendFunc
|
|
497
|
-
if (actionType === 'push' &&
|
|
498
|
-
this.automaticallyAddAllChnagesWhenPushingToGit()) {
|
|
499
|
-
return [2 /*return*/];
|
|
500
|
-
}
|
|
501
|
-
detectedLinkedProjects = this.detectedLinkedProjects;
|
|
502
|
-
projectsThatShouldBeLinked = this.linkedProjects
|
|
503
|
-
.map(function (linkedProj) {
|
|
504
|
-
return detectedLinkedProjects.find(function (f) { return f.relativeClonePath === linkedProj.relativeClonePath; })
|
|
505
|
-
? void 0
|
|
506
|
-
: linkedProj;
|
|
507
|
-
})
|
|
508
|
-
.filter(function (f) { return !!f; });
|
|
509
|
-
if (!(projectsThatShouldBeLinked.length > 0)) return [3 /*break*/, 11];
|
|
510
|
-
index_1.Helpers.info("\n\n".concat(projectsThatShouldBeLinked
|
|
511
|
-
.map(function (p, index) {
|
|
512
|
-
return "- ".concat(index + 1, ". ").concat(tnp_core_3.chalk.bold(p.relativeClonePath), " ").concat(p.remoteUrl(), " {").concat(p.purpose ? " purpose: ".concat(p.purpose, " }") : '');
|
|
513
|
-
})
|
|
514
|
-
.join('\n'), "\n\n "));
|
|
515
|
-
if (!!this.isMonorepo) return [3 /*break*/, 11];
|
|
516
|
-
_a = cloneChildren;
|
|
517
|
-
if (_a) return [3 /*break*/, 2];
|
|
518
|
-
return [4 /*yield*/, index_1.Helpers.questionYesNo("Do you want to clone above (missing) linked projects ?")];
|
|
519
|
-
case 1:
|
|
520
|
-
_a = (_c.sent());
|
|
521
|
-
_c.label = 2;
|
|
522
|
-
case 2:
|
|
523
|
-
if (!_a) return [3 /*break*/, 11];
|
|
524
|
-
_c.label = 3;
|
|
525
|
-
case 3:
|
|
526
|
-
_c.trys.push([3, 9, 10, 11]);
|
|
527
|
-
projectsThatShouldBeLinked_1 = tslib_1.__values(projectsThatShouldBeLinked), projectsThatShouldBeLinked_1_1 = projectsThatShouldBeLinked_1.next();
|
|
528
|
-
_c.label = 4;
|
|
529
|
-
case 4:
|
|
530
|
-
if (!!projectsThatShouldBeLinked_1_1.done) return [3 /*break*/, 8];
|
|
531
|
-
linkedProj = projectsThatShouldBeLinked_1_1.value;
|
|
532
|
-
// console.log({linkedProj})
|
|
533
|
-
index_1.Helpers.info("Cloning unexisted project from url ".concat(tnp_core_3.chalk.bold(linkedProj.remoteUrl()), " to ").concat(linkedProj.relativeClonePath));
|
|
534
|
-
return [4 /*yield*/, this.git.clone(linkedProj.remoteUrl(), linkedProj.relativeClonePath, linkedProj.deafultBranch)];
|
|
535
|
-
case 5:
|
|
536
|
-
_c.sent();
|
|
537
|
-
childProjLocaiton = this.pathFor([
|
|
538
|
-
linkedProj.relativeClonePath,
|
|
539
|
-
linkedProj.internalRealtiveProjectPath,
|
|
540
|
-
]);
|
|
541
|
-
childProj = this.ins.From(childProjLocaiton);
|
|
542
|
-
if (!childProj) return [3 /*break*/, 7];
|
|
543
|
-
return [4 /*yield*/, childProj.saveLocationToDB()];
|
|
544
|
-
case 6:
|
|
545
|
-
_c.sent();
|
|
546
|
-
_c.label = 7;
|
|
547
|
-
case 7:
|
|
548
|
-
projectsThatShouldBeLinked_1_1 = projectsThatShouldBeLinked_1.next();
|
|
549
|
-
return [3 /*break*/, 4];
|
|
550
|
-
case 8: return [3 /*break*/, 11];
|
|
551
|
-
case 9:
|
|
552
|
-
e_7_1 = _c.sent();
|
|
553
|
-
e_7 = { error: e_7_1 };
|
|
554
|
-
return [3 /*break*/, 11];
|
|
555
|
-
case 10:
|
|
556
|
-
try {
|
|
557
|
-
if (projectsThatShouldBeLinked_1_1 && !projectsThatShouldBeLinked_1_1.done && (_b = projectsThatShouldBeLinked_1.return)) _b.call(projectsThatShouldBeLinked_1);
|
|
558
|
-
}
|
|
559
|
-
finally { if (e_7) throw e_7.error; }
|
|
560
|
-
return [7 /*endfinally*/];
|
|
561
|
-
case 11: return [2 /*return*/];
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
});
|
|
565
|
-
};
|
|
566
|
-
//#endregion
|
|
567
|
-
//#region methods & getters / set type
|
|
178
|
+
//#region methods & getters / set type
|
|
568
179
|
BaseProject.prototype.setType = function (type) {
|
|
569
180
|
// @ts-ignore
|
|
570
181
|
this.type = type;
|
|
571
182
|
};
|
|
572
183
|
//#endregion
|
|
573
|
-
//#region methods & getters
|
|
184
|
+
//#region methods & getters / type is
|
|
574
185
|
BaseProject.prototype.typeIs = function () {
|
|
575
186
|
var types = [];
|
|
576
187
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -579,7 +190,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
579
190
|
return this.type && types.includes(this.type);
|
|
580
191
|
};
|
|
581
192
|
//#endregion
|
|
582
|
-
//#region methods & getters
|
|
193
|
+
//#region methods & getters / type is not
|
|
583
194
|
BaseProject.prototype.typeIsNot = function () {
|
|
584
195
|
var types = [];
|
|
585
196
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -589,13 +200,13 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
589
200
|
};
|
|
590
201
|
Object.defineProperty(BaseProject.prototype, "basename", {
|
|
591
202
|
//#endregion
|
|
592
|
-
//#region methods & getters
|
|
203
|
+
//#region methods & getters / basename
|
|
593
204
|
/**
|
|
594
205
|
* project folder basename
|
|
595
206
|
*/
|
|
596
207
|
get: function () {
|
|
597
208
|
//#region @websqlFunc
|
|
598
|
-
return
|
|
209
|
+
return tnp_core_2.path.basename(this.location);
|
|
599
210
|
//#endregion
|
|
600
211
|
},
|
|
601
212
|
enumerable: false,
|
|
@@ -603,13 +214,13 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
603
214
|
});
|
|
604
215
|
Object.defineProperty(BaseProject.prototype, "name", {
|
|
605
216
|
//#endregion
|
|
606
|
-
//#region methods & getters
|
|
217
|
+
//#region methods & getters / name
|
|
607
218
|
/**
|
|
608
219
|
* name from package.json
|
|
609
220
|
*/
|
|
610
221
|
get: function () {
|
|
611
222
|
var _a;
|
|
612
|
-
return ((_a = this.
|
|
223
|
+
return ((_a = this.npmHelpers) === null || _a === void 0 ? void 0 : _a.name) || this.nameFromPomXML;
|
|
613
224
|
},
|
|
614
225
|
enumerable: false,
|
|
615
226
|
configurable: true
|
|
@@ -626,164 +237,19 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
626
237
|
enumerable: false,
|
|
627
238
|
configurable: true
|
|
628
239
|
});
|
|
629
|
-
Object.defineProperty(BaseProject.prototype, "version", {
|
|
630
|
-
//#endregion
|
|
631
|
-
//#region methods & getters / version
|
|
632
|
-
/**
|
|
633
|
-
* version from package.json -> property version
|
|
634
|
-
*/
|
|
635
|
-
get: function () {
|
|
636
|
-
var _a;
|
|
637
|
-
return (_a = this.packageJSON) === null || _a === void 0 ? void 0 : _a.version;
|
|
638
|
-
},
|
|
639
|
-
enumerable: false,
|
|
640
|
-
configurable: true
|
|
641
|
-
});
|
|
642
|
-
Object.defineProperty(BaseProject.prototype, "majorVersion", {
|
|
643
|
-
//#endregion
|
|
644
|
-
//#region methods & getters / major version
|
|
645
|
-
/**
|
|
646
|
-
* Major Version from package.json
|
|
647
|
-
*/
|
|
648
|
-
// @ts-ignore
|
|
649
|
-
get: function () {
|
|
650
|
-
//#region @backendFunc
|
|
651
|
-
return Number(tnp_core_2._.first((this.version || '').split('.')));
|
|
652
|
-
//#endregion
|
|
653
|
-
},
|
|
654
|
-
enumerable: false,
|
|
655
|
-
configurable: true
|
|
656
|
-
});
|
|
657
|
-
Object.defineProperty(BaseProject.prototype, "minorVersion", {
|
|
658
|
-
//#endregion
|
|
659
|
-
//#region methods & getters / minor version
|
|
660
|
-
/**
|
|
661
|
-
* Minor Version from package.json
|
|
662
|
-
*/
|
|
663
|
-
// @ts-ignore
|
|
664
|
-
get: function () {
|
|
665
|
-
var _a;
|
|
666
|
-
//#region @backendFunc
|
|
667
|
-
var __ = (_a = tslib_1.__read((this.version || '').split('.') || [void 0, void 0], 2), _a[0]), minor = _a[1];
|
|
668
|
-
return Number(minor);
|
|
669
|
-
//#endregion
|
|
670
|
-
},
|
|
671
|
-
enumerable: false,
|
|
672
|
-
configurable: true
|
|
673
|
-
});
|
|
674
|
-
//#endregion
|
|
675
|
-
/**
|
|
676
|
-
* @deprecated
|
|
677
|
-
*/
|
|
678
|
-
BaseProject.prototype.bumpPatchVersion = function () {
|
|
679
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
680
|
-
var packageJson, version, versionComponents, major, minor, patch, preRelease, newPatch, newVersion;
|
|
681
|
-
return tslib_1.__generator(this, function (_a) {
|
|
682
|
-
packageJson = this.readJson(tnp_config_1.config.file.package_json);
|
|
683
|
-
version = packageJson === null || packageJson === void 0 ? void 0 : packageJson.version;
|
|
684
|
-
if (!version) {
|
|
685
|
-
return [2 /*return*/];
|
|
686
|
-
}
|
|
687
|
-
versionComponents = version.match(/^(\d+)\.(\d+)\.(\d+)(-.+)?$/);
|
|
688
|
-
major = versionComponents[1];
|
|
689
|
-
minor = versionComponents[2];
|
|
690
|
-
patch = versionComponents[3];
|
|
691
|
-
preRelease = versionComponents[4] || '';
|
|
692
|
-
newPatch = parseInt(patch, 10) + 1;
|
|
693
|
-
newVersion = "".concat(major, ".").concat(minor, ".").concat(newPatch).concat(preRelease);
|
|
694
|
-
// Update the version in the package.json object
|
|
695
|
-
packageJson.version = newVersion;
|
|
696
|
-
// Write the updated package.json back to disk
|
|
697
|
-
this.writeJson(tnp_config_1.config.file.package_json, packageJson);
|
|
698
|
-
return [2 /*return*/];
|
|
699
|
-
});
|
|
700
|
-
});
|
|
701
|
-
};
|
|
702
|
-
Object.defineProperty(BaseProject.prototype, "versionPathAsNumber", {
|
|
703
|
-
//#region methods & getters / get version path as number
|
|
704
|
-
get: function () {
|
|
705
|
-
//#region @backendFunc
|
|
706
|
-
var ver = this.version.split('.');
|
|
707
|
-
var res = Number(tnp_core_2._.last(ver));
|
|
708
|
-
return isNaN(res) ? 0 : res;
|
|
709
|
-
//#endregion
|
|
710
|
-
},
|
|
711
|
-
enumerable: false,
|
|
712
|
-
configurable: true
|
|
713
|
-
});
|
|
714
|
-
Object.defineProperty(BaseProject.prototype, "dependencies", {
|
|
715
|
-
//#endregion
|
|
716
|
-
//#region methods & getters / dependencies
|
|
717
|
-
/**
|
|
718
|
-
* npm dependencies from package.json
|
|
719
|
-
*/
|
|
720
|
-
get: function () {
|
|
721
|
-
return (this.packageJSON ? this.packageJSON.dependencies : {}) || {};
|
|
722
|
-
},
|
|
723
|
-
enumerable: false,
|
|
724
|
-
configurable: true
|
|
725
|
-
});
|
|
726
|
-
Object.defineProperty(BaseProject.prototype, "peerDependencies", {
|
|
727
|
-
//#endregion
|
|
728
|
-
//#region methods & getters / peer dependencies
|
|
729
|
-
/**
|
|
730
|
-
* peerDependencies dependencies
|
|
731
|
-
*/
|
|
732
|
-
get: function () {
|
|
733
|
-
return (this.packageJSON ? this.packageJSON.peerDependencies : {}) || {};
|
|
734
|
-
},
|
|
735
|
-
enumerable: false,
|
|
736
|
-
configurable: true
|
|
737
|
-
});
|
|
738
|
-
Object.defineProperty(BaseProject.prototype, "devDependencies", {
|
|
739
|
-
//#endregion
|
|
740
|
-
//#region methods & getters / dev dependencies
|
|
741
|
-
/**
|
|
742
|
-
* devDependencies dependencies
|
|
743
|
-
*/
|
|
744
|
-
get: function () {
|
|
745
|
-
return (this.packageJSON ? this.packageJSON.devDependencies : {}) || {};
|
|
746
|
-
},
|
|
747
|
-
enumerable: false,
|
|
748
|
-
configurable: true
|
|
749
|
-
});
|
|
750
|
-
Object.defineProperty(BaseProject.prototype, "resolutions", {
|
|
751
|
-
//#endregion
|
|
752
|
-
//#region methods & getters / resolutions dependencies
|
|
753
|
-
/**
|
|
754
|
-
* resolutions dependencies
|
|
755
|
-
*/
|
|
756
|
-
get: function () {
|
|
757
|
-
return (this.packageJSON ? this.packageJSON['resolutions'] : {}) || {};
|
|
758
|
-
},
|
|
759
|
-
enumerable: false,
|
|
760
|
-
configurable: true
|
|
761
|
-
});
|
|
762
|
-
Object.defineProperty(BaseProject.prototype, "allDependencies", {
|
|
763
|
-
//#endregion
|
|
764
|
-
//#region methods & getters / all dependencies
|
|
765
|
-
/**
|
|
766
|
-
* object with all deps from package json
|
|
767
|
-
*/
|
|
768
|
-
get: function () {
|
|
769
|
-
return tnp_core_2._.merge(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, this.devDependencies), this.peerDependencies), this.dependencies), this.resolutions));
|
|
770
|
-
},
|
|
771
|
-
enumerable: false,
|
|
772
|
-
configurable: true
|
|
773
|
-
});
|
|
774
240
|
//#endregion
|
|
775
|
-
//#region methods & getters
|
|
241
|
+
//#region methods & getters / get folder for possible project chhildrens
|
|
776
242
|
BaseProject.prototype.getFoldersForPossibleProjectChildren = function () {
|
|
777
243
|
//#region @backendFunc
|
|
778
|
-
var isDirectory = function (source) { return
|
|
244
|
+
var isDirectory = function (source) { return tnp_core_1.fse.lstatSync(source).isDirectory(); };
|
|
779
245
|
var getDirectories = function (source) {
|
|
780
|
-
return
|
|
246
|
+
return tnp_core_1.fse
|
|
781
247
|
.readdirSync(source)
|
|
782
|
-
.map(function (name) { return
|
|
248
|
+
.map(function (name) { return tnp_core_2.path.join(source, name); })
|
|
783
249
|
.filter(isDirectory);
|
|
784
250
|
};
|
|
785
251
|
var subdirectories = getDirectories(this.location).filter(function (f) {
|
|
786
|
-
var folderName =
|
|
252
|
+
var folderName = tnp_core_2.path.basename(f);
|
|
787
253
|
return index_1.Helpers.checkIfNameAllowedForFiredevProj(folderName);
|
|
788
254
|
});
|
|
789
255
|
// if (this.isTnp' && fse.existsSync(path.join(this.location, '../firedev-projects'))) {
|
|
@@ -813,7 +279,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
813
279
|
};
|
|
814
280
|
Object.defineProperty(BaseProject.prototype, "children", {
|
|
815
281
|
//#endregion
|
|
816
|
-
//#region methods & getters
|
|
282
|
+
//#region methods & getters / children
|
|
817
283
|
/**
|
|
818
284
|
* alias to getAllChildren
|
|
819
285
|
*/
|
|
@@ -826,7 +292,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
826
292
|
configurable: true
|
|
827
293
|
});
|
|
828
294
|
//#endregion
|
|
829
|
-
//#region methods & getters
|
|
295
|
+
//#region methods & getters / get child
|
|
830
296
|
BaseProject.prototype.getChildBy = function (nameOrBasename, errors) {
|
|
831
297
|
if (errors === void 0) { errors = true; }
|
|
832
298
|
//#region @websqlFunc
|
|
@@ -839,13 +305,13 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
839
305
|
};
|
|
840
306
|
Object.defineProperty(BaseProject.prototype, "parent", {
|
|
841
307
|
//#endregion
|
|
842
|
-
//#region methods & getters
|
|
308
|
+
//#region methods & getters / parent
|
|
843
309
|
get: function () {
|
|
844
310
|
//#region @websqlFunc
|
|
845
|
-
if (!
|
|
311
|
+
if (!tnp_core_3._.isString(this.location) || this.location.trim() === '') {
|
|
846
312
|
return void 0;
|
|
847
313
|
}
|
|
848
|
-
return this.ins.From(
|
|
314
|
+
return this.ins.From(tnp_core_2.path.join(this.location, '..'));
|
|
849
315
|
//#endregion
|
|
850
316
|
},
|
|
851
317
|
enumerable: false,
|
|
@@ -853,13 +319,13 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
853
319
|
});
|
|
854
320
|
Object.defineProperty(BaseProject.prototype, "grandpa", {
|
|
855
321
|
//#endregion
|
|
856
|
-
//#region methods & getters
|
|
322
|
+
//#region methods & getters / grandpa
|
|
857
323
|
get: function () {
|
|
858
324
|
//#region @websqlFunc
|
|
859
|
-
if (!
|
|
325
|
+
if (!tnp_core_3._.isString(this.location) || this.location.trim() === '') {
|
|
860
326
|
return void 0;
|
|
861
327
|
}
|
|
862
|
-
var grandpa = this.ins.From(
|
|
328
|
+
var grandpa = this.ins.From(tnp_core_2.path.join(this.location, '..', '..'));
|
|
863
329
|
return grandpa;
|
|
864
330
|
//#endregion
|
|
865
331
|
},
|
|
@@ -868,7 +334,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
868
334
|
});
|
|
869
335
|
Object.defineProperty(BaseProject.prototype, "genericName", {
|
|
870
336
|
//#endregion
|
|
871
|
-
//#region methods & getters
|
|
337
|
+
//#region methods & getters / generic name
|
|
872
338
|
get: function () {
|
|
873
339
|
//#region @websqlFunc
|
|
874
340
|
var parent = this.parent;
|
|
@@ -878,8 +344,8 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
878
344
|
return [
|
|
879
345
|
// (secondNearest && secondNearest !== nearest) ? (secondNearest.name || secondNearest.basename) : void 0,
|
|
880
346
|
// nerestProj,
|
|
881
|
-
parent ?
|
|
882
|
-
parent ? parent.basename :
|
|
347
|
+
parent ? tnp_core_2.path.basename(tnp_core_2.path.dirname(parent.location)) : void 0,
|
|
348
|
+
parent ? parent.basename : tnp_core_2.path.basename(this.location),
|
|
883
349
|
this.basename,
|
|
884
350
|
//#region @backend
|
|
885
351
|
"(".concat(tnp_cli_1.CLI.chalk.bold.underline(this.name), ")"),
|
|
@@ -895,51 +361,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
895
361
|
configurable: true
|
|
896
362
|
});
|
|
897
363
|
//#endregion
|
|
898
|
-
//#region methods & getters
|
|
899
|
-
BaseProject.prototype.deleteNodeModules = function () {
|
|
900
|
-
this.remove(tnp_config_1.config.folder.node_modules);
|
|
901
|
-
};
|
|
902
|
-
//#endregion
|
|
903
|
-
//#region methods & getters /reinstall node modules
|
|
904
|
-
BaseProject.prototype.reinstalNodeModules = function (options) {
|
|
905
|
-
//#region @backendFunc
|
|
906
|
-
index_1.Helpers.taskStarted("Reinstalling node modules for ".concat(this.genericName));
|
|
907
|
-
this.deleteNodeModules();
|
|
908
|
-
index_1.Helpers.run("".concat((options === null || options === void 0 ? void 0 : options.useYarn) ? 'yarn' : 'npm', " install ").concat((options === null || options === void 0 ? void 0 : options.force) ? '--force' : ''), { cwd: this.location }).sync();
|
|
909
|
-
index_1.Helpers.taskDone("Reinstalled node modules for ".concat(this.genericName));
|
|
910
|
-
//#endregion
|
|
911
|
-
};
|
|
912
|
-
//#endregion
|
|
913
|
-
//#region methods & getters / make sure node modules installed
|
|
914
|
-
BaseProject.prototype.makeSureNodeModulesInstalled = function (options) {
|
|
915
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
916
|
-
return tslib_1.__generator(this, function (_a) {
|
|
917
|
-
if (this.nodeModulesEmpty()) {
|
|
918
|
-
this.reinstalNodeModules(options);
|
|
919
|
-
}
|
|
920
|
-
return [2 /*return*/];
|
|
921
|
-
});
|
|
922
|
-
});
|
|
923
|
-
};
|
|
924
|
-
//#endregion
|
|
925
|
-
//#region methods & getters / prefer yarn over npm
|
|
926
|
-
BaseProject.prototype.preferYarnOverNpm = function () {
|
|
927
|
-
return false;
|
|
928
|
-
};
|
|
929
|
-
//#endregion
|
|
930
|
-
//#region methods & getters / node modules empty
|
|
931
|
-
/**
|
|
932
|
-
*
|
|
933
|
-
* @returns true if node_modules folder is empty
|
|
934
|
-
*/
|
|
935
|
-
BaseProject.prototype.nodeModulesEmpty = function () {
|
|
936
|
-
//#region @backendFunc
|
|
937
|
-
return (!this.hasFolder(tnp_config_1.config.folder.node_modules) ||
|
|
938
|
-
tnp_core_3.fse.readdirSync(this.pathFor(tnp_config_1.config.folder.node_modules)).length === 0);
|
|
939
|
-
//#endregion
|
|
940
|
-
};
|
|
941
|
-
//#endregion
|
|
942
|
-
//#region methods & getters / path exits
|
|
364
|
+
//#region methods & getters / path exits
|
|
943
365
|
/**
|
|
944
366
|
* same has project.hasFile();
|
|
945
367
|
*/
|
|
@@ -947,7 +369,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
947
369
|
return this.hasFile(relativePath);
|
|
948
370
|
};
|
|
949
371
|
//#endregion
|
|
950
|
-
//#region methods & getters
|
|
372
|
+
//#region methods & getters / has file
|
|
951
373
|
/**
|
|
952
374
|
* same as project.pathExists();
|
|
953
375
|
*/
|
|
@@ -959,21 +381,21 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
959
381
|
BaseProject.prototype.hasFolder = function (relativePath) {
|
|
960
382
|
//#region @backendFunc
|
|
961
383
|
return (index_1.Helpers.exists(this.pathFor(relativePath)) &&
|
|
962
|
-
|
|
384
|
+
tnp_core_1.fse.lstatSync(this.pathFor(relativePath)).isDirectory());
|
|
963
385
|
//#endregion
|
|
964
386
|
};
|
|
965
387
|
//#endregion
|
|
966
|
-
//#region methods & getters
|
|
388
|
+
//#region methods & getters / contains file
|
|
967
389
|
/**
|
|
968
390
|
* same as project.pathhasFileExists();
|
|
969
391
|
* but with path.resolve
|
|
970
392
|
*/
|
|
971
393
|
BaseProject.prototype.containsFile = function (fileRelativeToProjectPath) {
|
|
972
|
-
var fullPath =
|
|
394
|
+
var fullPath = tnp_core_2.path.resolve(tnp_core_2.path.join(this.location, fileRelativeToProjectPath));
|
|
973
395
|
return index_1.Helpers.exists(fullPath);
|
|
974
396
|
};
|
|
975
397
|
//#endregion
|
|
976
|
-
//#region methods & getters
|
|
398
|
+
//#region methods & getters / path for
|
|
977
399
|
/**
|
|
978
400
|
* absolute path:
|
|
979
401
|
* concated project location with relative path
|
|
@@ -983,24 +405,24 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
983
405
|
if (Array.isArray(relativePath)) {
|
|
984
406
|
relativePath = relativePath.join('/');
|
|
985
407
|
}
|
|
986
|
-
if (
|
|
408
|
+
if (tnp_core_2.path.isAbsolute(relativePath)) {
|
|
987
409
|
index_1.Helpers.error("Cannot join relative path with absolute: ".concat(relativePath));
|
|
988
410
|
}
|
|
989
|
-
return (0,
|
|
411
|
+
return (0, tnp_core_2.crossPlatformPath)(tnp_core_2.path.join(this.location, relativePath));
|
|
990
412
|
//#endregion
|
|
991
413
|
};
|
|
992
414
|
//#endregion
|
|
993
|
-
//#region methods & getters
|
|
415
|
+
//#region methods & getters / write json
|
|
994
416
|
BaseProject.prototype.writeJson = function (relativePath, json) {
|
|
995
417
|
//#region @backendFunc
|
|
996
|
-
if (
|
|
418
|
+
if (tnp_core_2.path.isAbsolute(relativePath)) {
|
|
997
419
|
index_1.Helpers.error("Cannot join relative path with absolute: ".concat(relativePath));
|
|
998
420
|
}
|
|
999
|
-
index_1.Helpers.writeJson((0,
|
|
421
|
+
index_1.Helpers.writeJson((0, tnp_core_2.crossPlatformPath)([this.location, relativePath]), json);
|
|
1000
422
|
//#endregion
|
|
1001
423
|
};
|
|
1002
424
|
//#endregion
|
|
1003
|
-
//#region methods & getters
|
|
425
|
+
//#region methods & getters / run
|
|
1004
426
|
/**
|
|
1005
427
|
* @deprecated us execute instead
|
|
1006
428
|
* use output from or more preciese crafted api
|
|
@@ -1008,9 +430,9 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1008
430
|
BaseProject.prototype.run = function (command, options) {
|
|
1009
431
|
var opt;
|
|
1010
432
|
//#region @backend
|
|
1011
|
-
options =
|
|
433
|
+
options = tnp_core_3._.cloneDeep(options) || {};
|
|
1012
434
|
index_1.Helpers.log("command: ".concat(command));
|
|
1013
|
-
if (
|
|
435
|
+
if (tnp_core_3._.isUndefined(options.showCommand)) {
|
|
1014
436
|
options.showCommand = false;
|
|
1015
437
|
}
|
|
1016
438
|
opt = options;
|
|
@@ -1027,7 +449,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1027
449
|
return index_1.Helpers.run(command, opt);
|
|
1028
450
|
};
|
|
1029
451
|
//#endregion
|
|
1030
|
-
//#region methods & getters
|
|
452
|
+
//#region methods & getters / execute
|
|
1031
453
|
/**
|
|
1032
454
|
* same as run but async
|
|
1033
455
|
*/
|
|
@@ -1038,7 +460,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1038
460
|
switch (_a.label) {
|
|
1039
461
|
case 0:
|
|
1040
462
|
//#region @backendFunc
|
|
1041
|
-
if (
|
|
463
|
+
if (tnp_core_3._.isUndefined(options.showCommand)) {
|
|
1042
464
|
options.showCommand = false;
|
|
1043
465
|
}
|
|
1044
466
|
if (!options) {
|
|
@@ -1058,7 +480,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1058
480
|
});
|
|
1059
481
|
};
|
|
1060
482
|
//#endregion
|
|
1061
|
-
//#region methods & getters
|
|
483
|
+
//#region methods & getters / try run sync command
|
|
1062
484
|
/**
|
|
1063
485
|
* try run but continue when it fails
|
|
1064
486
|
* @param command
|
|
@@ -1078,7 +500,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1078
500
|
//#endregion
|
|
1079
501
|
};
|
|
1080
502
|
//#endregion
|
|
1081
|
-
//#region methods & getters
|
|
503
|
+
//#region methods & getters / output from command
|
|
1082
504
|
BaseProject.prototype.outputFrom = function (command,
|
|
1083
505
|
//#region @backend
|
|
1084
506
|
options) {
|
|
@@ -1087,31 +509,31 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1087
509
|
//#endregion
|
|
1088
510
|
};
|
|
1089
511
|
//#endregion
|
|
1090
|
-
//#region methods & getters
|
|
512
|
+
//#region methods & getters / remove file
|
|
1091
513
|
BaseProject.prototype.removeFile = function (fileRelativeToProjectPath) {
|
|
1092
514
|
//#region @backendFunc
|
|
1093
|
-
var fullPath =
|
|
515
|
+
var fullPath = tnp_core_2.path.resolve(tnp_core_2.path.join(this.location, fileRelativeToProjectPath));
|
|
1094
516
|
return index_1.Helpers.removeFileIfExists(fullPath);
|
|
1095
517
|
//#endregion
|
|
1096
518
|
};
|
|
1097
519
|
//#endregion
|
|
1098
|
-
//#region methods & getters
|
|
520
|
+
//#region methods & getters / read file
|
|
1099
521
|
BaseProject.prototype.readFile = function (fileRelativeToProjectPath) {
|
|
1100
522
|
//#region @backendFunc
|
|
1101
|
-
var fullPath =
|
|
523
|
+
var fullPath = tnp_core_2.path.resolve(tnp_core_2.path.join(this.location, fileRelativeToProjectPath));
|
|
1102
524
|
return index_1.Helpers.readFile(fullPath);
|
|
1103
525
|
//#endregion
|
|
1104
526
|
};
|
|
1105
527
|
//#endregion
|
|
1106
|
-
//#region methods & getters
|
|
528
|
+
//#region methods & getters / read file
|
|
1107
529
|
BaseProject.prototype.readJson = function (fileRelativeToProjectPath) {
|
|
1108
530
|
//#region @backendFunc
|
|
1109
|
-
var fullPath =
|
|
531
|
+
var fullPath = tnp_core_2.path.resolve(tnp_core_2.path.join(this.location, fileRelativeToProjectPath));
|
|
1110
532
|
return index_1.Helpers.readJson5(fullPath);
|
|
1111
533
|
//#endregion
|
|
1112
534
|
};
|
|
1113
535
|
//#endregion
|
|
1114
|
-
//#region methods & getters
|
|
536
|
+
//#region methods & getters / remove (fiel or folder)
|
|
1115
537
|
BaseProject.prototype.remove = function (relativePath, exactPath) {
|
|
1116
538
|
if (exactPath === void 0) { exactPath = true; }
|
|
1117
539
|
//#region @backend
|
|
@@ -1120,41 +542,17 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1120
542
|
//#endregion
|
|
1121
543
|
};
|
|
1122
544
|
//#endregion
|
|
1123
|
-
//#region methods & getters
|
|
545
|
+
//#region methods & getters / remove folder by relative path
|
|
1124
546
|
BaseProject.prototype.removeFolderByRelativePath = function (relativePathToFolder) {
|
|
1125
547
|
//#region @backend
|
|
1126
548
|
relativePathToFolder = relativePathToFolder.replace(/^\//, '');
|
|
1127
549
|
var location = this.location;
|
|
1128
|
-
var p =
|
|
550
|
+
var p = tnp_core_2.path.join(location, relativePathToFolder);
|
|
1129
551
|
index_1.Helpers.remove(p, true);
|
|
1130
552
|
//#endregion
|
|
1131
553
|
};
|
|
1132
554
|
//#endregion
|
|
1133
|
-
//#region methods & getters
|
|
1134
|
-
BaseProject.prototype.linkNodeModulesTo = function (proj) {
|
|
1135
|
-
//#region @backendFunc
|
|
1136
|
-
var source = this.pathFor(tnp_config_1.config.folder.node_modules);
|
|
1137
|
-
var dest = proj.pathFor(tnp_config_1.config.folder.node_modules);
|
|
1138
|
-
index_1.Helpers.remove(dest, true);
|
|
1139
|
-
index_1.Helpers.createSymLink(source, dest);
|
|
1140
|
-
//#endregion
|
|
1141
|
-
};
|
|
1142
|
-
//#endregion
|
|
1143
|
-
//#region methods & getters / reinstall node_modules
|
|
1144
|
-
BaseProject.prototype.reinstallNodeModules = function (forcerRemoveNodeModules) {
|
|
1145
|
-
if (forcerRemoveNodeModules === void 0) { forcerRemoveNodeModules = false; }
|
|
1146
|
-
//#region @backendFunc
|
|
1147
|
-
index_1.Helpers.taskStarted("Reinstalling node_modules in ".concat(this.genericName));
|
|
1148
|
-
var source = this.pathFor(tnp_config_1.config.folder.node_modules);
|
|
1149
|
-
if (forcerRemoveNodeModules) {
|
|
1150
|
-
index_1.Helpers.remove(source, true);
|
|
1151
|
-
}
|
|
1152
|
-
this.run('yarn install --ignore-engines').sync();
|
|
1153
|
-
index_1.Helpers.taskDone("Reinstalling done for ".concat(this.genericName));
|
|
1154
|
-
//#endregion
|
|
1155
|
-
};
|
|
1156
|
-
//#endregion
|
|
1157
|
-
//#region methods & getters / assign free port to project instance
|
|
555
|
+
//#region methods & getters / assign free port to project instance
|
|
1158
556
|
BaseProject.prototype.assignFreePort = function (startFrom, howManyFreePortsAfterThatPort) {
|
|
1159
557
|
if (startFrom === void 0) { startFrom = 4200; }
|
|
1160
558
|
if (howManyFreePortsAfterThatPort === void 0) { howManyFreePortsAfterThatPort = 0; }
|
|
@@ -1164,7 +562,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1164
562
|
switch (_a.label) {
|
|
1165
563
|
case 0:
|
|
1166
564
|
//#region @backendFunc
|
|
1167
|
-
if (
|
|
565
|
+
if (tnp_core_3._.isNumber(this.port) && this.port >= startFrom) {
|
|
1168
566
|
return [2 /*return*/, startFrom];
|
|
1169
567
|
}
|
|
1170
568
|
max = 2000;
|
|
@@ -1178,7 +576,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1178
576
|
_a.label = 2;
|
|
1179
577
|
case 2:
|
|
1180
578
|
_a.trys.push([2, 4, , 5]);
|
|
1181
|
-
return [4 /*yield*/,
|
|
579
|
+
return [4 /*yield*/, tnp_core_1.portfinder.getPortPromise({ port: startFrom })];
|
|
1182
580
|
case 3:
|
|
1183
581
|
port = _a.sent();
|
|
1184
582
|
takenPorts.push(port);
|
|
@@ -1202,14 +600,14 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1202
600
|
});
|
|
1203
601
|
};
|
|
1204
602
|
//#endregion
|
|
1205
|
-
//#region methods & getters
|
|
603
|
+
//#region methods & getters / remove project from disk/memory
|
|
1206
604
|
BaseProject.prototype.removeItself = function () {
|
|
1207
605
|
//#region @backend
|
|
1208
606
|
this.ins.remove(this);
|
|
1209
607
|
//#endregion
|
|
1210
608
|
};
|
|
1211
609
|
//#endregion
|
|
1212
|
-
//#region methods & getters
|
|
610
|
+
//#region methods & getters / define property
|
|
1213
611
|
/**
|
|
1214
612
|
* Purpose: not initializing all classes at the beginning
|
|
1215
613
|
* Only for BaseFeatureForProject class
|
|
@@ -1232,7 +630,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1232
630
|
}
|
|
1233
631
|
}
|
|
1234
632
|
else {
|
|
1235
|
-
index_1.Helpers.warn("[firedev-helpers] Cannot create dynamic instance of class \"".concat(
|
|
633
|
+
index_1.Helpers.warn("[firedev-helpers] Cannot create dynamic instance of class \"".concat(tnp_core_3._.kebabCase(prefixedName.replace('__', '')), "\"."));
|
|
1236
634
|
}
|
|
1237
635
|
// }
|
|
1238
636
|
}
|
|
@@ -1245,7 +643,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1245
643
|
//#endregion
|
|
1246
644
|
};
|
|
1247
645
|
//#endregion
|
|
1248
|
-
//#region methods & getters
|
|
646
|
+
//#region methods & getters / filter only copy
|
|
1249
647
|
/**
|
|
1250
648
|
* fs.copy option filter function for copying only selected folders from project
|
|
1251
649
|
*/
|
|
@@ -1255,7 +653,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1255
653
|
//#endregion
|
|
1256
654
|
};
|
|
1257
655
|
//#endregion
|
|
1258
|
-
//#region methods & getters
|
|
656
|
+
//#region methods & getters / filter don't copy
|
|
1259
657
|
/**
|
|
1260
658
|
* fs.copy option filter function for copying only not selected folders from project
|
|
1261
659
|
*/
|
|
@@ -1265,7 +663,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1265
663
|
//#endregion
|
|
1266
664
|
};
|
|
1267
665
|
//#endregion
|
|
1268
|
-
//#region methods & getters
|
|
666
|
+
//#region methods & getters / get default develop Branch
|
|
1269
667
|
/**
|
|
1270
668
|
* general default development branch for all kinds of projects
|
|
1271
669
|
*/
|
|
@@ -1273,7 +671,7 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1273
671
|
return 'develop';
|
|
1274
672
|
};
|
|
1275
673
|
//#endregion
|
|
1276
|
-
//#region methods & getters
|
|
674
|
+
//#region methods & getters / get main branches
|
|
1277
675
|
/**
|
|
1278
676
|
* main/default hardcoded branches
|
|
1279
677
|
*/
|
|
@@ -1281,29 +679,29 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1281
679
|
return ['master', 'develop', 'stage', 'prod', 'test'];
|
|
1282
680
|
};
|
|
1283
681
|
//#endregion
|
|
1284
|
-
//#region methods & getters
|
|
682
|
+
//#region methods & getters / is using aciton commit
|
|
1285
683
|
BaseProject.prototype.isUnsingActionCommit = function () {
|
|
1286
684
|
return false;
|
|
1287
685
|
};
|
|
1288
686
|
//#endregion
|
|
1289
|
-
//#region methods & getters
|
|
687
|
+
//#region methods & getters / reset process
|
|
1290
688
|
BaseProject.prototype.resetProcess = function (overrideBranch, recrusive) {
|
|
1291
689
|
var _a;
|
|
1292
690
|
if (recrusive === void 0) { recrusive = false; }
|
|
1293
691
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1294
|
-
var branchToReset, _b, _c, linked, child,
|
|
1295
|
-
var
|
|
692
|
+
var branchToReset, _b, _c, linked, child, e_5_1;
|
|
693
|
+
var e_5, _d;
|
|
1296
694
|
return tslib_1.__generator(this, function (_e) {
|
|
1297
695
|
switch (_e.label) {
|
|
1298
696
|
case 0:
|
|
1299
697
|
//#region @backend
|
|
1300
698
|
// console.log(`CORE PROJECT BRANCH ${this.name}: ${this.core?.branch}, overrideBranch: ${overrideBranch}`)
|
|
1301
699
|
index_1.Helpers.taskStarted("\n\n Starting reset process for ".concat(this.name || this.basename, "\n\n "));
|
|
1302
|
-
this._beforeAnyActionOnGitRoot();
|
|
700
|
+
this.git._beforeAnyActionOnGitRoot();
|
|
1303
701
|
branchToReset = overrideBranch || ((_a = this.core) === null || _a === void 0 ? void 0 : _a.branch) || this.getDefaultDevelopmentBranch();
|
|
1304
702
|
index_1.Helpers.info("fetch data in ".concat(this.genericName));
|
|
1305
703
|
this.git.fetch();
|
|
1306
|
-
if (!!this.getLinkedProjectsConfig().resetOnlyChildren) return [3 /*break*/, 3];
|
|
704
|
+
if (!!this.linkedProjects.getLinkedProjectsConfig().resetOnlyChildren) return [3 /*break*/, 3];
|
|
1307
705
|
index_1.Helpers.logInfo("reseting hard in ".concat(this.genericName));
|
|
1308
706
|
this.git.resetHard();
|
|
1309
707
|
index_1.Helpers.logInfo("checking out branch \"".concat(branchToReset, "\" in ").concat(this.genericName));
|
|
@@ -1316,18 +714,18 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1316
714
|
return [4 /*yield*/, this.struct()];
|
|
1317
715
|
case 2:
|
|
1318
716
|
_e.sent();
|
|
1319
|
-
index_1.Helpers.taskDone("RESET DONE BRANCH: ".concat(
|
|
717
|
+
index_1.Helpers.taskDone("RESET DONE BRANCH: ".concat(tnp_core_1.chalk.bold(branchToReset), " in ").concat(this.genericName));
|
|
1320
718
|
_e.label = 3;
|
|
1321
719
|
case 3:
|
|
1322
720
|
_e.trys.push([3, 8, 9, 10]);
|
|
1323
|
-
_b = tslib_1.__values(this.linkedProjects), _c = _b.next();
|
|
721
|
+
_b = tslib_1.__values(this.linkedProjects.linkedProjects), _c = _b.next();
|
|
1324
722
|
_e.label = 4;
|
|
1325
723
|
case 4:
|
|
1326
724
|
if (!!_c.done) return [3 /*break*/, 7];
|
|
1327
725
|
linked = _c.value;
|
|
1328
726
|
child = this.ins.From(this.pathFor([linked.relativeClonePath]));
|
|
1329
727
|
if (!child) return [3 /*break*/, 6];
|
|
1330
|
-
return [4 /*yield*/, child.resetProcess(child.resetLinkedProjectsOnlyToCoreBranches()
|
|
728
|
+
return [4 /*yield*/, child.resetProcess(child.linkedProjects.resetLinkedProjectsOnlyToCoreBranches()
|
|
1331
729
|
? void 0
|
|
1332
730
|
: branchToReset, true)];
|
|
1333
731
|
case 5:
|
|
@@ -1338,14 +736,14 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1338
736
|
return [3 /*break*/, 4];
|
|
1339
737
|
case 7: return [3 /*break*/, 10];
|
|
1340
738
|
case 8:
|
|
1341
|
-
|
|
1342
|
-
|
|
739
|
+
e_5_1 = _e.sent();
|
|
740
|
+
e_5 = { error: e_5_1 };
|
|
1343
741
|
return [3 /*break*/, 10];
|
|
1344
742
|
case 9:
|
|
1345
743
|
try {
|
|
1346
744
|
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
1347
745
|
}
|
|
1348
|
-
finally { if (
|
|
746
|
+
finally { if (e_5) throw e_5.error; }
|
|
1349
747
|
return [7 /*endfinally*/];
|
|
1350
748
|
case 10: return [2 /*return*/];
|
|
1351
749
|
}
|
|
@@ -1353,338 +751,21 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1353
751
|
});
|
|
1354
752
|
};
|
|
1355
753
|
//#endregion
|
|
1356
|
-
//#region methods & getters
|
|
1357
|
-
BaseProject.prototype.pullProcess = function (cloneChildren) {
|
|
1358
|
-
if (cloneChildren === void 0) { cloneChildren = false; }
|
|
1359
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1360
|
-
var uncommitedChanges, location, childrenRepos, childrenRepos_1, childrenRepos_1_1, child, e_9_1;
|
|
1361
|
-
var e_9, _a;
|
|
1362
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1363
|
-
switch (_b.label) {
|
|
1364
|
-
case 0:
|
|
1365
|
-
//#region @backendFunc
|
|
1366
|
-
return [4 /*yield*/, this._beforePullProcessAction(cloneChildren)];
|
|
1367
|
-
case 1:
|
|
1368
|
-
//#region @backendFunc
|
|
1369
|
-
_b.sent();
|
|
1370
|
-
uncommitedChanges = this.git.thereAreSomeUncommitedChange;
|
|
1371
|
-
if (uncommitedChanges) {
|
|
1372
|
-
index_1.Helpers.warn("Stashing uncommit changes... in ".concat(this.genericName));
|
|
1373
|
-
try {
|
|
1374
|
-
this.git.stageAllFiles();
|
|
1375
|
-
}
|
|
1376
|
-
catch (error) { }
|
|
1377
|
-
try {
|
|
1378
|
-
this.git.stash();
|
|
1379
|
-
}
|
|
1380
|
-
catch (error) { }
|
|
1381
|
-
}
|
|
1382
|
-
return [4 /*yield*/, this.git.pullCurrentBranch({ askToRetry: true })];
|
|
1383
|
-
case 2:
|
|
1384
|
-
_b.sent();
|
|
1385
|
-
location = this.location;
|
|
1386
|
-
this.ins.unload(this);
|
|
1387
|
-
this.ins.add(this.ins.From(location));
|
|
1388
|
-
return [4 /*yield*/, this.saveLocationToDB()];
|
|
1389
|
-
case 3:
|
|
1390
|
-
_b.sent();
|
|
1391
|
-
if (!(this.automaticallyAddAllChnagesWhenPushingToGit() || cloneChildren)) return [3 /*break*/, 11];
|
|
1392
|
-
childrenRepos = this.children.filter(function (f) { return f.git.isInsideGitRepo && f.git.isGitRoot; });
|
|
1393
|
-
_b.label = 4;
|
|
1394
|
-
case 4:
|
|
1395
|
-
_b.trys.push([4, 9, 10, 11]);
|
|
1396
|
-
childrenRepos_1 = tslib_1.__values(childrenRepos), childrenRepos_1_1 = childrenRepos_1.next();
|
|
1397
|
-
_b.label = 5;
|
|
1398
|
-
case 5:
|
|
1399
|
-
if (!!childrenRepos_1_1.done) return [3 /*break*/, 8];
|
|
1400
|
-
child = childrenRepos_1_1.value;
|
|
1401
|
-
return [4 /*yield*/, child.pullProcess()];
|
|
1402
|
-
case 6:
|
|
1403
|
-
_b.sent();
|
|
1404
|
-
_b.label = 7;
|
|
1405
|
-
case 7:
|
|
1406
|
-
childrenRepos_1_1 = childrenRepos_1.next();
|
|
1407
|
-
return [3 /*break*/, 5];
|
|
1408
|
-
case 8: return [3 /*break*/, 11];
|
|
1409
|
-
case 9:
|
|
1410
|
-
e_9_1 = _b.sent();
|
|
1411
|
-
e_9 = { error: e_9_1 };
|
|
1412
|
-
return [3 /*break*/, 11];
|
|
1413
|
-
case 10:
|
|
1414
|
-
try {
|
|
1415
|
-
if (childrenRepos_1_1 && !childrenRepos_1_1.done && (_a = childrenRepos_1.return)) _a.call(childrenRepos_1);
|
|
1416
|
-
}
|
|
1417
|
-
finally { if (e_9) throw e_9.error; }
|
|
1418
|
-
return [7 /*endfinally*/];
|
|
1419
|
-
case 11: return [4 /*yield*/, this.saveAllLinkedProjectsToDB()];
|
|
1420
|
-
case 12:
|
|
1421
|
-
_b.sent();
|
|
1422
|
-
return [2 /*return*/];
|
|
1423
|
-
}
|
|
1424
|
-
});
|
|
1425
|
-
});
|
|
1426
|
-
};
|
|
1427
|
-
//#endregion
|
|
1428
|
-
//#region methods & getters / push process
|
|
1429
|
-
BaseProject.prototype.pushProcess = function (options) {
|
|
1430
|
-
var _a, _b;
|
|
1431
|
-
if (options === void 0) { options = {}; }
|
|
1432
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1433
|
-
var force, typeofCommit, forcePushNoQuestion, origin, exitCallBack, args, commitMessageRequired, skipChildren, commitData, error_2, childrenRepos, childrenRepos_2, childrenRepos_2_1, child, e_10_1;
|
|
1434
|
-
var _c, _d, _e, e_10, _f;
|
|
1435
|
-
var _this = this;
|
|
1436
|
-
return tslib_1.__generator(this, function (_g) {
|
|
1437
|
-
switch (_g.label) {
|
|
1438
|
-
case 0:
|
|
1439
|
-
force = (_c = options.force, _c === void 0 ? false : _c), typeofCommit = options.typeofCommit, forcePushNoQuestion = options.forcePushNoQuestion, origin = (_d = options.origin, _d === void 0 ? 'origin' : _d), exitCallBack = options.exitCallBack, args = (_e = options.args, _e === void 0 ? [] : _e), commitMessageRequired = options.commitMessageRequired, skipChildren = options.skipChildren;
|
|
1440
|
-
return [4 /*yield*/, this._beforePushProcessAction()];
|
|
1441
|
-
case 1:
|
|
1442
|
-
_g.sent();
|
|
1443
|
-
return [4 /*yield*/, this.saveLocationToDB()];
|
|
1444
|
-
case 2:
|
|
1445
|
-
_g.sent();
|
|
1446
|
-
return [4 /*yield*/, this._getCommitMessage(typeofCommit, args, commitMessageRequired)];
|
|
1447
|
-
case 3:
|
|
1448
|
-
commitData = _g.sent();
|
|
1449
|
-
if (!this.automaticallyAddAllChnagesWhenPushingToGit()) {
|
|
1450
|
-
if ((_a = commitData.commitMessage) === null || _a === void 0 ? void 0 : _a.split(':').map(function (p) { return p.trim(); }).every(function (p) { return p === _this.git.currentBranchName; })) {
|
|
1451
|
-
// QUICK_FIX
|
|
1452
|
-
index_1.Helpers.error("\n\n Please provide more specific commit message than branch name\n\n\n ", false, true);
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
_g.label = 4;
|
|
1456
|
-
case 4:
|
|
1457
|
-
if (!true) return [3 /*break*/, 10];
|
|
1458
|
-
_g.label = 5;
|
|
1459
|
-
case 5:
|
|
1460
|
-
_g.trys.push([5, 7, , 9]);
|
|
1461
|
-
return [4 /*yield*/, this.lint()];
|
|
1462
|
-
case 6:
|
|
1463
|
-
_g.sent();
|
|
1464
|
-
return [3 /*break*/, 10];
|
|
1465
|
-
case 7:
|
|
1466
|
-
error_2 = _g.sent();
|
|
1467
|
-
index_1.Helpers.warn('Fix your code...');
|
|
1468
|
-
return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Try again lint before commit ?')];
|
|
1469
|
-
case 8:
|
|
1470
|
-
if (!(_g.sent())) {
|
|
1471
|
-
return [3 /*break*/, 10];
|
|
1472
|
-
}
|
|
1473
|
-
return [3 /*break*/, 9];
|
|
1474
|
-
case 9: return [3 /*break*/, 4];
|
|
1475
|
-
case 10:
|
|
1476
|
-
if (!!commitData.isActionCommit) return [3 /*break*/, 14];
|
|
1477
|
-
index_1.Helpers.info("\n\n PROJECT: ".concat(this.genericName, "\n\n Current commit:\n - message to include {").concat(commitData.commitMessage, "}\n - branch to checkout {").concat(commitData.branchName, "}\n "));
|
|
1478
|
-
if (!(this.git.lastCommitMessage() === commitData.commitMessage)) return [3 /*break*/, 12];
|
|
1479
|
-
return [4 /*yield*/, index_1.Helpers.questionYesNo('Soft reset last commit with same message ?')];
|
|
1480
|
-
case 11:
|
|
1481
|
-
if (_g.sent()) {
|
|
1482
|
-
this.git.resetSoftHEAD(1);
|
|
1483
|
-
}
|
|
1484
|
-
_g.label = 12;
|
|
1485
|
-
case 12: return [4 /*yield*/, index_1.Helpers.questionYesNo('Commit and push this ?')];
|
|
1486
|
-
case 13:
|
|
1487
|
-
if (!(_g.sent())) {
|
|
1488
|
-
exitCallBack();
|
|
1489
|
-
}
|
|
1490
|
-
_g.label = 14;
|
|
1491
|
-
case 14:
|
|
1492
|
-
if (this.automaticallyAddAllChnagesWhenPushingToGit()) {
|
|
1493
|
-
// my project
|
|
1494
|
-
this.git.stageAllFiles();
|
|
1495
|
-
}
|
|
1496
|
-
if (this.useGitBranchesAsMetadataForCommits()) {
|
|
1497
|
-
index_1.Helpers.info('Checkingout branches (if needed)...');
|
|
1498
|
-
if (((_b = this.git.currentBranchName) === null || _b === void 0 ? void 0 : _b.trim()) !== commitData.branchName) {
|
|
1499
|
-
try {
|
|
1500
|
-
this.git.checkout(commitData.branchName, {
|
|
1501
|
-
createBranchIfNotExists: true,
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
catch (error) {
|
|
1505
|
-
index_1.Helpers.error('Please modyfiy you commit message or delete branch,');
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
try {
|
|
1510
|
-
this.git.commit(commitData.commitMessage);
|
|
1511
|
-
}
|
|
1512
|
-
catch (error) {
|
|
1513
|
-
index_1.Helpers.warn("Not commiting anything... ");
|
|
1514
|
-
}
|
|
1515
|
-
return [4 /*yield*/, this.git.pushCurrentBranch({
|
|
1516
|
-
force: force,
|
|
1517
|
-
origin: origin,
|
|
1518
|
-
forcePushNoQuestion: forcePushNoQuestion,
|
|
1519
|
-
askToRetry: true,
|
|
1520
|
-
})];
|
|
1521
|
-
case 15:
|
|
1522
|
-
_g.sent();
|
|
1523
|
-
if (!(this.automaticallyAddAllChnagesWhenPushingToGit() && !skipChildren)) return [3 /*break*/, 23];
|
|
1524
|
-
if (this.getLinkedProjectsConfig().skipRecrusivePush) {
|
|
1525
|
-
index_1.Helpers.warn("Skipping recrusive (children) push for ".concat(this.genericName));
|
|
1526
|
-
return [2 /*return*/];
|
|
1527
|
-
}
|
|
1528
|
-
childrenRepos = this.children.filter(function (f) { return f.git.isInsideGitRepo && f.git.isGitRoot; });
|
|
1529
|
-
_g.label = 16;
|
|
1530
|
-
case 16:
|
|
1531
|
-
_g.trys.push([16, 21, 22, 23]);
|
|
1532
|
-
childrenRepos_2 = tslib_1.__values(childrenRepos), childrenRepos_2_1 = childrenRepos_2.next();
|
|
1533
|
-
_g.label = 17;
|
|
1534
|
-
case 17:
|
|
1535
|
-
if (!!childrenRepos_2_1.done) return [3 /*break*/, 20];
|
|
1536
|
-
child = childrenRepos_2_1.value;
|
|
1537
|
-
return [4 /*yield*/, child.pushProcess(options)];
|
|
1538
|
-
case 18:
|
|
1539
|
-
_g.sent();
|
|
1540
|
-
_g.label = 19;
|
|
1541
|
-
case 19:
|
|
1542
|
-
childrenRepos_2_1 = childrenRepos_2.next();
|
|
1543
|
-
return [3 /*break*/, 17];
|
|
1544
|
-
case 20: return [3 /*break*/, 23];
|
|
1545
|
-
case 21:
|
|
1546
|
-
e_10_1 = _g.sent();
|
|
1547
|
-
e_10 = { error: e_10_1 };
|
|
1548
|
-
return [3 /*break*/, 23];
|
|
1549
|
-
case 22:
|
|
1550
|
-
try {
|
|
1551
|
-
if (childrenRepos_2_1 && !childrenRepos_2_1.done && (_f = childrenRepos_2.return)) _f.call(childrenRepos_2);
|
|
1552
|
-
}
|
|
1553
|
-
finally { if (e_10) throw e_10.error; }
|
|
1554
|
-
return [7 /*endfinally*/];
|
|
1555
|
-
case 23: return [4 /*yield*/, this.saveAllLinkedProjectsToDB()];
|
|
1556
|
-
case 24:
|
|
1557
|
-
_g.sent();
|
|
1558
|
-
return [2 /*return*/];
|
|
1559
|
-
}
|
|
1560
|
-
});
|
|
1561
|
-
});
|
|
1562
|
-
};
|
|
1563
|
-
//#endregion
|
|
1564
|
-
//#region methods & getters / before any action on git root
|
|
1565
|
-
BaseProject.prototype._beforeAnyActionOnGitRoot = function () {
|
|
1566
|
-
//#region @backendFunc
|
|
1567
|
-
if (!this.git.isInsideGitRepo) {
|
|
1568
|
-
index_1.Helpers.error("Project ".concat(tnp_core_3.chalk.bold(this.name), " is not a git repository\n locaiton: ").concat(this.location), false, true);
|
|
1569
|
-
}
|
|
1570
|
-
if (!this.git.isGitRoot) {
|
|
1571
|
-
index_1.Helpers.error("Project ".concat(tnp_core_3.chalk.bold(this.name), " is not a git root\n locaiton: ").concat(this.location), false, true);
|
|
1572
|
-
}
|
|
1573
|
-
//#endregion
|
|
1574
|
-
};
|
|
1575
|
-
//#endregion
|
|
1576
|
-
//#region before push action
|
|
1577
|
-
BaseProject.prototype._beforePushProcessAction = function () {
|
|
1578
|
-
var _a;
|
|
1579
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1580
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1581
|
-
switch (_b.label) {
|
|
1582
|
-
case 0:
|
|
1583
|
-
//#region @backendFunc
|
|
1584
|
-
this._beforeAnyActionOnGitRoot();
|
|
1585
|
-
if (!(this.git.isInsideGitRepo &&
|
|
1586
|
-
this.git.isGitRoot &&
|
|
1587
|
-
!((_a = this.git.currentBranchName) === null || _a === void 0 ? void 0 : _a.trim()))) return [3 /*break*/, 2];
|
|
1588
|
-
return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Repository is empty...Commit "master" branch and commit all as "first commit" ?')];
|
|
1589
|
-
case 1:
|
|
1590
|
-
if (_b.sent()) {
|
|
1591
|
-
this.git.checkout('master');
|
|
1592
|
-
this.git.stageAllFiles();
|
|
1593
|
-
this.git.commit('first commit ');
|
|
1594
|
-
}
|
|
1595
|
-
_b.label = 2;
|
|
1596
|
-
case 2: return [4 /*yield*/, this.cloneUnexistedLinkedProjects('push')];
|
|
1597
|
-
case 3:
|
|
1598
|
-
_b.sent();
|
|
1599
|
-
return [2 /*return*/];
|
|
1600
|
-
}
|
|
1601
|
-
});
|
|
1602
|
-
});
|
|
1603
|
-
};
|
|
1604
|
-
//#endregion
|
|
1605
|
-
//#region before push action
|
|
1606
|
-
BaseProject.prototype._beforePullProcessAction = function (cloneChildren) {
|
|
1607
|
-
if (cloneChildren === void 0) { cloneChildren = false; }
|
|
1608
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1609
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1610
|
-
switch (_a.label) {
|
|
1611
|
-
case 0:
|
|
1612
|
-
//#region @backendFunc
|
|
1613
|
-
this._beforeAnyActionOnGitRoot();
|
|
1614
|
-
return [4 /*yield*/, this.cloneUnexistedLinkedProjects('pull', cloneChildren)];
|
|
1615
|
-
case 1:
|
|
1616
|
-
_a.sent();
|
|
1617
|
-
return [2 /*return*/];
|
|
1618
|
-
}
|
|
1619
|
-
});
|
|
1620
|
-
});
|
|
1621
|
-
};
|
|
1622
|
-
//#endregion
|
|
1623
|
-
//#region resovle commit message
|
|
1624
|
-
BaseProject.prototype._getCommitMessage = function (typeofCommit, args, commitMessageRequired) {
|
|
1625
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1626
|
-
var commitData, argsCommitData, commitDataBranch, argsCommitData, from, to, _a, _b, _c;
|
|
1627
|
-
var _d;
|
|
1628
|
-
return tslib_1.__generator(this, function (_e) {
|
|
1629
|
-
switch (_e.label) {
|
|
1630
|
-
case 0:
|
|
1631
|
-
if (!this.useGitBranchesWhenCommitingAndPushing()) return [3 /*break*/, 5];
|
|
1632
|
-
return [4 /*yield*/, index_1.CommitData.getFromArgs(args, typeofCommit)];
|
|
1633
|
-
case 1:
|
|
1634
|
-
argsCommitData = _e.sent();
|
|
1635
|
-
if (!argsCommitData.message) return [3 /*break*/, 2];
|
|
1636
|
-
commitData = argsCommitData;
|
|
1637
|
-
return [3 /*break*/, 4];
|
|
1638
|
-
case 2: return [4 /*yield*/, index_1.CommitData.getFromBranch(this.git.currentBranchName)];
|
|
1639
|
-
case 3:
|
|
1640
|
-
commitDataBranch = _e.sent();
|
|
1641
|
-
commitData = commitDataBranch;
|
|
1642
|
-
_e.label = 4;
|
|
1643
|
-
case 4: return [3 /*break*/, 7];
|
|
1644
|
-
case 5: return [4 /*yield*/, index_1.CommitData.getFromArgs(args, typeofCommit)];
|
|
1645
|
-
case 6:
|
|
1646
|
-
argsCommitData = _e.sent();
|
|
1647
|
-
// console.log({ argsCommitData })
|
|
1648
|
-
// console.log(argsCommitData)
|
|
1649
|
-
if (!argsCommitData.message && commitMessageRequired) {
|
|
1650
|
-
index_1.Helpers.error('Please provide message in argument', false, true);
|
|
1651
|
-
}
|
|
1652
|
-
if (!argsCommitData.message) {
|
|
1653
|
-
argsCommitData.message = index_1.Helpers.git.ACTION_MSG_RESET_GIT_HARD_COMMIT;
|
|
1654
|
-
}
|
|
1655
|
-
commitData = argsCommitData;
|
|
1656
|
-
_e.label = 7;
|
|
1657
|
-
case 7:
|
|
1658
|
-
if (!(commitData.message !== index_1.Helpers.git.ACTION_MSG_RESET_GIT_HARD_COMMIT)) return [3 /*break*/, 9];
|
|
1659
|
-
from = (_d = this.transalteGitCommitFromArgs(), _d.from), to = _d.to;
|
|
1660
|
-
if (!(from && to)) return [3 /*break*/, 9];
|
|
1661
|
-
_a = commitData;
|
|
1662
|
-
_c = (_b = tnp_core_2._).kebabCase;
|
|
1663
|
-
return [4 /*yield*/, (0, translate_1.translate)(commitData.message, { from: from, to: to })];
|
|
1664
|
-
case 8:
|
|
1665
|
-
_a.message = _c.apply(_b, [_e.sent()]);
|
|
1666
|
-
_e.label = 9;
|
|
1667
|
-
case 9: return [2 /*return*/, commitData];
|
|
1668
|
-
}
|
|
1669
|
-
});
|
|
1670
|
-
});
|
|
1671
|
-
};
|
|
1672
|
-
//#endregion
|
|
1673
|
-
//#region methods & getters / link project to
|
|
754
|
+
//#region methods & getters / link project to
|
|
1674
755
|
BaseProject.prototype.linkTo = function (destPackageLocation) {
|
|
1675
756
|
//#region @backend
|
|
1676
757
|
index_1.Helpers.createSymLink(this.location, destPackageLocation);
|
|
1677
758
|
//#endregion
|
|
1678
759
|
};
|
|
1679
760
|
//#endregion
|
|
1680
|
-
//#region methods & getters
|
|
761
|
+
//#region methods & getters / write file
|
|
1681
762
|
BaseProject.prototype.writeFile = function (relativePath, content) {
|
|
1682
763
|
//#region @backend
|
|
1683
764
|
index_1.Helpers.writeFile([this.location, relativePath], content);
|
|
1684
765
|
//#endregion
|
|
1685
766
|
};
|
|
1686
767
|
//#endregion
|
|
1687
|
-
//#region getters & methods /
|
|
768
|
+
//#region getters & methods / run command and get string
|
|
1688
769
|
BaseProject.prototype.runCommandGetString = function (command) {
|
|
1689
770
|
//#region @backendFunc
|
|
1690
771
|
return index_1.Helpers.commnadOutputAsString(command, this.location, {
|
|
@@ -1692,332 +773,6 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
1692
773
|
});
|
|
1693
774
|
//#endregion
|
|
1694
775
|
};
|
|
1695
|
-
Object.defineProperty(BaseProject.prototype, "git", {
|
|
1696
|
-
//#endregion
|
|
1697
|
-
//#region getters & methods / git
|
|
1698
|
-
get: function () {
|
|
1699
|
-
var self = this;
|
|
1700
|
-
return {
|
|
1701
|
-
unstageAllFiles: function () {
|
|
1702
|
-
//#region @backendFunc
|
|
1703
|
-
index_1.Helpers.git.unstageAllFiles(self.location);
|
|
1704
|
-
//#endregion
|
|
1705
|
-
},
|
|
1706
|
-
revertFileChanges: function (fileReletivePath) {
|
|
1707
|
-
//#region @backendFunc
|
|
1708
|
-
index_1.Helpers.git.revertFileChanges(self.location, fileReletivePath);
|
|
1709
|
-
//#endregion
|
|
1710
|
-
},
|
|
1711
|
-
clone: function (url, destinationFolderName, branchName) {
|
|
1712
|
-
if (destinationFolderName === void 0) { destinationFolderName = ''; }
|
|
1713
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1714
|
-
var clondeFolderpath, error_3;
|
|
1715
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1716
|
-
switch (_a.label) {
|
|
1717
|
-
case 0:
|
|
1718
|
-
clondeFolderpath = index_1.Helpers.git.clone({
|
|
1719
|
-
cwd: self.location,
|
|
1720
|
-
url: url,
|
|
1721
|
-
destinationFolderName: destinationFolderName,
|
|
1722
|
-
});
|
|
1723
|
-
if (!branchName) return [3 /*break*/, 4];
|
|
1724
|
-
_a.label = 1;
|
|
1725
|
-
case 1:
|
|
1726
|
-
_a.trys.push([1, 3, , 4]);
|
|
1727
|
-
index_1.Helpers.git.checkout(clondeFolderpath, branchName);
|
|
1728
|
-
return [4 /*yield*/, index_1.Helpers.git.pullCurrentBranch(clondeFolderpath, {
|
|
1729
|
-
askToRetry: true,
|
|
1730
|
-
})];
|
|
1731
|
-
case 2:
|
|
1732
|
-
_a.sent();
|
|
1733
|
-
return [3 /*break*/, 4];
|
|
1734
|
-
case 3:
|
|
1735
|
-
error_3 = _a.sent();
|
|
1736
|
-
return [3 /*break*/, 4];
|
|
1737
|
-
case 4: return [2 /*return*/, (0, tnp_core_1.crossPlatformPath)([
|
|
1738
|
-
clondeFolderpath,
|
|
1739
|
-
destinationFolderName || '',
|
|
1740
|
-
]).replace(/\/$/g, '')];
|
|
1741
|
-
}
|
|
1742
|
-
});
|
|
1743
|
-
});
|
|
1744
|
-
},
|
|
1745
|
-
restoreLastVersion: function (localFilePath) {
|
|
1746
|
-
//#region @backendFunc
|
|
1747
|
-
return index_1.Helpers.git.restoreLastVersion(self.location, localFilePath);
|
|
1748
|
-
//#endregion
|
|
1749
|
-
},
|
|
1750
|
-
stageAllFiles: function () {
|
|
1751
|
-
//#region @backendFunc
|
|
1752
|
-
index_1.Helpers.git.stageAllFiles(self.location);
|
|
1753
|
-
//#endregion
|
|
1754
|
-
},
|
|
1755
|
-
stash: function (optinos) {
|
|
1756
|
-
//#region @backendFunc
|
|
1757
|
-
index_1.Helpers.git.stash(self.location, optinos);
|
|
1758
|
-
//#endregion
|
|
1759
|
-
},
|
|
1760
|
-
stashApply: function () {
|
|
1761
|
-
//#region @backendFunc
|
|
1762
|
-
index_1.Helpers.git.stashApply(self.location);
|
|
1763
|
-
//#endregion
|
|
1764
|
-
},
|
|
1765
|
-
fetch: function () {
|
|
1766
|
-
//#region @backendFunc
|
|
1767
|
-
index_1.Helpers.git.fetch(self.location);
|
|
1768
|
-
//#endregion
|
|
1769
|
-
},
|
|
1770
|
-
resetFiles: function () {
|
|
1771
|
-
var _a;
|
|
1772
|
-
var relativePathes = [];
|
|
1773
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1774
|
-
relativePathes[_i] = arguments[_i];
|
|
1775
|
-
}
|
|
1776
|
-
//#region @backendFunc
|
|
1777
|
-
return (_a = index_1.Helpers.git).resetFiles.apply(_a, tslib_1.__spreadArray([self.location], tslib_1.__read(relativePathes), false));
|
|
1778
|
-
//#endregion
|
|
1779
|
-
},
|
|
1780
|
-
get isInsideGitRepo() {
|
|
1781
|
-
//#region @backendFunc
|
|
1782
|
-
return index_1.Helpers.git.isInsideGitRepo(self.location);
|
|
1783
|
-
//#endregion
|
|
1784
|
-
},
|
|
1785
|
-
get isGitRoot() {
|
|
1786
|
-
//#region @backendFunc
|
|
1787
|
-
return index_1.Helpers.git.isGitRoot(self.location);
|
|
1788
|
-
//#endregion
|
|
1789
|
-
},
|
|
1790
|
-
get originURL() {
|
|
1791
|
-
//#region @backendFunc
|
|
1792
|
-
return index_1.Helpers.git.getOriginURL(self.location);
|
|
1793
|
-
//#endregion
|
|
1794
|
-
},
|
|
1795
|
-
commit: function (commitMessage) {
|
|
1796
|
-
//#region @backendFunc
|
|
1797
|
-
return index_1.Helpers.git.commit(self.location, commitMessage);
|
|
1798
|
-
//#endregion
|
|
1799
|
-
},
|
|
1800
|
-
/**
|
|
1801
|
-
* alias to stage all and commit
|
|
1802
|
-
*/
|
|
1803
|
-
addAndCommit: function (commitMessage) {
|
|
1804
|
-
//#region @backendFunc
|
|
1805
|
-
return index_1.Helpers.git.stageAllAndCommit(self.location, commitMessage);
|
|
1806
|
-
//#endregion
|
|
1807
|
-
},
|
|
1808
|
-
stageAllAndCommit: function (commitMessage) {
|
|
1809
|
-
//#region @backendFunc
|
|
1810
|
-
return index_1.Helpers.git.stageAllAndCommit(self.location, commitMessage);
|
|
1811
|
-
//#endregion
|
|
1812
|
-
},
|
|
1813
|
-
pushCurrentBranch: function (options) {
|
|
1814
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1815
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1816
|
-
switch (_a.label) {
|
|
1817
|
-
case 0: return [4 /*yield*/, index_1.Helpers.git.pushCurrentBranch(self.location, options)];
|
|
1818
|
-
case 1:
|
|
1819
|
-
//#region @backendFunc
|
|
1820
|
-
return [2 /*return*/, _a.sent()];
|
|
1821
|
-
}
|
|
1822
|
-
});
|
|
1823
|
-
});
|
|
1824
|
-
},
|
|
1825
|
-
get allOrigins() {
|
|
1826
|
-
//#region @backendFunc
|
|
1827
|
-
return index_1.Helpers.git.allOrigins(self.location);
|
|
1828
|
-
//#endregion
|
|
1829
|
-
},
|
|
1830
|
-
get uncommitedFiles() {
|
|
1831
|
-
//#region @backendFunc
|
|
1832
|
-
return index_1.Helpers.git.uncommitedFiles(self.location);
|
|
1833
|
-
//#endregion
|
|
1834
|
-
},
|
|
1835
|
-
get thereAreSomeUncommitedChange() {
|
|
1836
|
-
//#region @backendFunc
|
|
1837
|
-
return index_1.Helpers.git.checkIfthereAreSomeUncommitedChange(self.location);
|
|
1838
|
-
//#endregion
|
|
1839
|
-
},
|
|
1840
|
-
thereAreSomeUncommitedChangeExcept: function (filesList) {
|
|
1841
|
-
if (filesList === void 0) { filesList = []; }
|
|
1842
|
-
//#region @backendFunc
|
|
1843
|
-
return index_1.Helpers.git.thereAreSomeUncommitedChangeExcept(filesList, self.location);
|
|
1844
|
-
//#endregion
|
|
1845
|
-
},
|
|
1846
|
-
meltActionCommits: function (soft) {
|
|
1847
|
-
if (soft === void 0) { soft = false; }
|
|
1848
|
-
//#region @backend
|
|
1849
|
-
return index_1.Helpers.git.meltActionCommits(self.location, soft);
|
|
1850
|
-
//#endregion
|
|
1851
|
-
},
|
|
1852
|
-
pullCurrentBranch: function (options) {
|
|
1853
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1854
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1855
|
-
switch (_a.label) {
|
|
1856
|
-
case 0:
|
|
1857
|
-
//#region @backendFunc
|
|
1858
|
-
return [4 /*yield*/, index_1.Helpers.git.pullCurrentBranch(self.location, tslib_1.__assign({}, options))];
|
|
1859
|
-
case 1:
|
|
1860
|
-
//#region @backendFunc
|
|
1861
|
-
_a.sent();
|
|
1862
|
-
return [2 /*return*/];
|
|
1863
|
-
}
|
|
1864
|
-
});
|
|
1865
|
-
});
|
|
1866
|
-
},
|
|
1867
|
-
get currentBranchName() {
|
|
1868
|
-
//#region @backendFunc
|
|
1869
|
-
return index_1.Helpers.git.currentBranchName(self.location);
|
|
1870
|
-
//#endregion
|
|
1871
|
-
},
|
|
1872
|
-
get listOfCurrentGitChanges() {
|
|
1873
|
-
//#region @backendFunc
|
|
1874
|
-
return index_1.Helpers.git.getListOfCurrentGitChanges(self.location);
|
|
1875
|
-
//#endregion
|
|
1876
|
-
},
|
|
1877
|
-
getBranchesNamesBy: function (pattern) {
|
|
1878
|
-
//#region @backendFunc
|
|
1879
|
-
return index_1.Helpers.git.getBranchesNames(self.location, pattern);
|
|
1880
|
-
//#endregion
|
|
1881
|
-
},
|
|
1882
|
-
resetSoftHEAD: function (HEAD) {
|
|
1883
|
-
if (HEAD === void 0) { HEAD = 1; }
|
|
1884
|
-
//#region @backendFunc
|
|
1885
|
-
index_1.Helpers.git.resetSoftHEAD(self.location, HEAD);
|
|
1886
|
-
//#endregion
|
|
1887
|
-
},
|
|
1888
|
-
resetHard: function (options) {
|
|
1889
|
-
//#region @backendFunc
|
|
1890
|
-
index_1.Helpers.git.resetHard(self.location, options);
|
|
1891
|
-
//#endregion
|
|
1892
|
-
},
|
|
1893
|
-
countComits: function () {
|
|
1894
|
-
//#region @backendFunc
|
|
1895
|
-
return index_1.Helpers.git.countCommits(self.location);
|
|
1896
|
-
//#endregion
|
|
1897
|
-
},
|
|
1898
|
-
hasAnyCommits: function () {
|
|
1899
|
-
//#region @backendFunc
|
|
1900
|
-
return index_1.Helpers.git.hasAnyCommits(self.location);
|
|
1901
|
-
//#endregion
|
|
1902
|
-
},
|
|
1903
|
-
get isInMergeProcess() {
|
|
1904
|
-
//#region @backendFunc
|
|
1905
|
-
return index_1.Helpers.git.isInMergeProcess(self.location);
|
|
1906
|
-
//#endregion
|
|
1907
|
-
},
|
|
1908
|
-
lastCommitDate: function () {
|
|
1909
|
-
//#region @backendFunc
|
|
1910
|
-
return index_1.Helpers.git.lastCommitDate(self.location);
|
|
1911
|
-
//#endregion
|
|
1912
|
-
},
|
|
1913
|
-
lastCommitHash: function () {
|
|
1914
|
-
//#region @backendFunc
|
|
1915
|
-
return index_1.Helpers.git.lastCommitHash(self.location);
|
|
1916
|
-
//#endregion
|
|
1917
|
-
},
|
|
1918
|
-
lastCommitMessage: function () {
|
|
1919
|
-
//#region @backendFunc
|
|
1920
|
-
return index_1.Helpers.git.lastCommitMessage(self.location);
|
|
1921
|
-
//#endregion
|
|
1922
|
-
},
|
|
1923
|
-
penultimageCommitHash: function () {
|
|
1924
|
-
//#region @backendFunc
|
|
1925
|
-
return index_1.Helpers.git.penultimageCommitHash(self.location);
|
|
1926
|
-
//#endregion
|
|
1927
|
-
},
|
|
1928
|
-
checkTagExists: function (tag) {
|
|
1929
|
-
//#region @backendFunc
|
|
1930
|
-
return index_1.Helpers.git.checkTagExists(tag, self.location);
|
|
1931
|
-
//#endregion
|
|
1932
|
-
},
|
|
1933
|
-
checkout: function (branchName, options) {
|
|
1934
|
-
//#region @backendFunc
|
|
1935
|
-
return index_1.Helpers.git.checkout(self.location, branchName, options);
|
|
1936
|
-
//#endregion
|
|
1937
|
-
},
|
|
1938
|
-
checkoutFromTo: function (checkoutFromBranch, branch, origin) {
|
|
1939
|
-
if (origin === void 0) { origin = 'origin'; }
|
|
1940
|
-
//#region @backendFunc
|
|
1941
|
-
return index_1.Helpers.git.checkoutFromTo(checkoutFromBranch, branch, origin, self.location);
|
|
1942
|
-
//#endregion
|
|
1943
|
-
},
|
|
1944
|
-
/**
|
|
1945
|
-
*
|
|
1946
|
-
* @param majorVersion example: v1, v2 etc.
|
|
1947
|
-
* @returns tag name
|
|
1948
|
-
*/
|
|
1949
|
-
lastTagNameForMajorVersion: function (majorVersion) {
|
|
1950
|
-
//#region @backendFunc
|
|
1951
|
-
return index_1.Helpers.git.lastTagNameForMajorVersion(self.location, majorVersion);
|
|
1952
|
-
//#endregion
|
|
1953
|
-
},
|
|
1954
|
-
lastTagHash: function () {
|
|
1955
|
-
//#region @backendFunc
|
|
1956
|
-
return index_1.Helpers.git.lastTagHash(self.location);
|
|
1957
|
-
//#endregion
|
|
1958
|
-
},
|
|
1959
|
-
get remoteOriginUrl() {
|
|
1960
|
-
//#region @backendFunc
|
|
1961
|
-
return index_1.Helpers.git.getOriginURL(self.location);
|
|
1962
|
-
//#endregion
|
|
1963
|
-
},
|
|
1964
|
-
get lastTagVersionName() {
|
|
1965
|
-
//#region @backendFunc
|
|
1966
|
-
return index_1.Helpers.git.lastTagVersionName(self.location) || '';
|
|
1967
|
-
//#endregion
|
|
1968
|
-
},
|
|
1969
|
-
get stagedFiles() {
|
|
1970
|
-
//#region @backendFunc
|
|
1971
|
-
return index_1.Helpers.git.stagedFiles(self.location);
|
|
1972
|
-
//#endregion
|
|
1973
|
-
},
|
|
1974
|
-
/**
|
|
1975
|
-
* TODO does this make any sense
|
|
1976
|
-
*/
|
|
1977
|
-
renameOrigin: function (newNameOrUlr) {
|
|
1978
|
-
//#region @backendFunc
|
|
1979
|
-
if (!newNameOrUlr.endsWith('.git')) {
|
|
1980
|
-
newNameOrUlr = newNameOrUlr + '.git';
|
|
1981
|
-
}
|
|
1982
|
-
var oldOrigin = self.git.originURL;
|
|
1983
|
-
if (!newNameOrUlr.startsWith('git@') &&
|
|
1984
|
-
!newNameOrUlr.startsWith('https://')) {
|
|
1985
|
-
newNameOrUlr = oldOrigin.replace(tnp_core_1.path.basename(oldOrigin), newNameOrUlr);
|
|
1986
|
-
}
|
|
1987
|
-
try {
|
|
1988
|
-
self.run("git remote rm origin").sync();
|
|
1989
|
-
}
|
|
1990
|
-
catch (error) { }
|
|
1991
|
-
try {
|
|
1992
|
-
self.run("git remote add origin ".concat(newNameOrUlr)).sync();
|
|
1993
|
-
index_1.Helpers.info("Origin changed:\n from: ".concat(oldOrigin, "\n to: ").concat(newNameOrUlr, "\n"));
|
|
1994
|
-
}
|
|
1995
|
-
catch (e) {
|
|
1996
|
-
index_1.Helpers.error("Not able to change origin.. reverting to old", true, true);
|
|
1997
|
-
self.run("git remote add origin ".concat(oldOrigin)).sync();
|
|
1998
|
-
}
|
|
1999
|
-
//#endregion
|
|
2000
|
-
},
|
|
2001
|
-
};
|
|
2002
|
-
},
|
|
2003
|
-
enumerable: false,
|
|
2004
|
-
configurable: true
|
|
2005
|
-
});
|
|
2006
|
-
//#endregion
|
|
2007
|
-
//#region getters & methods / check if loggin in to npm
|
|
2008
|
-
BaseProject.prototype.checkIfLogginInToNpm = function () {
|
|
2009
|
-
//#region @backendFunc
|
|
2010
|
-
// if (!this.canBePublishToNpmRegistry) {
|
|
2011
|
-
// return;
|
|
2012
|
-
// }
|
|
2013
|
-
try {
|
|
2014
|
-
this.run('npm whoami').sync();
|
|
2015
|
-
}
|
|
2016
|
-
catch (e) {
|
|
2017
|
-
index_1.Helpers.error("Please login in to npm.", false, true);
|
|
2018
|
-
}
|
|
2019
|
-
//#endregion
|
|
2020
|
-
};
|
|
2021
776
|
Object.defineProperty(BaseProject.prototype, "parentsNames", {
|
|
2022
777
|
//#endregion
|
|
2023
778
|
//#region getters & methods / find partners names
|
|
@@ -2140,403 +895,12 @@ var BaseProject = exports.BaseProject = /** @class */ (function () {
|
|
|
2140
895
|
var proj;
|
|
2141
896
|
return tslib_1.__generator(this, function (_d) {
|
|
2142
897
|
proj = this;
|
|
2143
|
-
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 core project name: '").concat((_a = proj === null || proj === void 0 ? void 0 : proj.core) === null || _a === void 0 ? void 0 : _a.name, "'\n embedded project: ").concat(((_b = proj === null || proj === void 0 ? void 0 : proj.embeddedProject) === null || _b === void 0 ? void 0 : _b.genericName) || '< none >', "\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") +
|
|
2144
|
-
"\nlinked porject prefix: \"".concat(this.linkedProjectsPrefix, "\"\n\nlinked projects from json (").concat(((_c = this.linkedProjects) === null || _c === void 0 ? void 0 : _c.length) || 0, "):\n").concat((this.linkedProjects || []).map(function (c) { return '- ' + c.relativeClonePath; }).join('\n'), "\n\n "));
|
|
898
|
+
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 core project name: '").concat((_a = proj === null || proj === void 0 ? void 0 : proj.core) === null || _a === void 0 ? void 0 : _a.name, "'\n embedded project: ").concat(((_b = proj === null || proj === void 0 ? void 0 : proj.linkedProjects.embeddedProject) === null || _b === void 0 ? void 0 : _b.genericName) || '< none >', "\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") +
|
|
899
|
+
"\nlinked porject prefix: \"".concat(this.linkedProjects.linkedProjectsPrefix, "\"\n\nlinked projects from json (").concat(((_c = this.linkedProjects.linkedProjects) === null || _c === void 0 ? void 0 : _c.length) || 0, "):\n").concat((this.linkedProjects.linkedProjects || []).map(function (c) { return '- ' + c.relativeClonePath; }).join('\n'), "\n\n "));
|
|
2145
900
|
return [2 /*return*/];
|
|
2146
901
|
});
|
|
2147
902
|
});
|
|
2148
903
|
};
|
|
2149
|
-
//#endregion
|
|
2150
|
-
//#region getters & methods / translate git commit from args
|
|
2151
|
-
/**
|
|
2152
|
-
* By default no translation of commit
|
|
2153
|
-
*/
|
|
2154
|
-
BaseProject.prototype.transalteGitCommitFromArgs = function () {
|
|
2155
|
-
return { from: void 0, to: void 0 };
|
|
2156
|
-
};
|
|
2157
|
-
//#endregion
|
|
2158
|
-
//#region getters & methods / us git branches when commiting and pushing
|
|
2159
|
-
/**
|
|
2160
|
-
* By defult true.. when commit branches will not function.
|
|
2161
|
-
* (false is better for simple projects)
|
|
2162
|
-
*/
|
|
2163
|
-
BaseProject.prototype.useGitBranchesWhenCommitingAndPushing = function () {
|
|
2164
|
-
return true;
|
|
2165
|
-
};
|
|
2166
|
-
//#endregion
|
|
2167
|
-
//#region getters & methods / automatically add all changes when pushing to git
|
|
2168
|
-
/**
|
|
2169
|
-
* usefull when pushing in project with childrens as git repos
|
|
2170
|
-
*/
|
|
2171
|
-
BaseProject.prototype.automaticallyAddAllChnagesWhenPushingToGit = function () {
|
|
2172
|
-
return false;
|
|
2173
|
-
};
|
|
2174
|
-
//#endregion
|
|
2175
|
-
//#region getters & methods / use git branches as metadata for commits
|
|
2176
|
-
/**
|
|
2177
|
-
* usefull when pushing in project with childrens as git repos
|
|
2178
|
-
*/
|
|
2179
|
-
BaseProject.prototype.useGitBranchesAsMetadataForCommits = function () {
|
|
2180
|
-
return true;
|
|
2181
|
-
};
|
|
2182
|
-
Object.defineProperty(BaseProject.prototype, "libraries", {
|
|
2183
|
-
//#endregion
|
|
2184
|
-
//#region getters & methods / angular libraries
|
|
2185
|
-
/**
|
|
2186
|
-
* angular libraries from angular.json
|
|
2187
|
-
*/
|
|
2188
|
-
get: function () {
|
|
2189
|
-
var _this = this;
|
|
2190
|
-
var _a;
|
|
2191
|
-
//#region @backendFunc
|
|
2192
|
-
if (!this.pathExists(tnp_config_1.config.file.angular_json)) {
|
|
2193
|
-
return [];
|
|
2194
|
-
}
|
|
2195
|
-
var projects = Object.values(((_a = index_1.Helpers.readJson(this.pathFor(tnp_config_1.config.file.angular_json))) === null || _a === void 0 ? void 0 : _a.projects) ||
|
|
2196
|
-
{}).filter(function (f) { return f.projectType === 'library'; });
|
|
2197
|
-
var libraries = projects.map(function (c) {
|
|
2198
|
-
return _this.ins.From(tnp_core_1.path.join(_this.location, c.root));
|
|
2199
|
-
});
|
|
2200
|
-
return libraries;
|
|
2201
|
-
//#endregion
|
|
2202
|
-
},
|
|
2203
|
-
enumerable: false,
|
|
2204
|
-
configurable: true
|
|
2205
|
-
});
|
|
2206
|
-
Object.defineProperty(BaseProject.prototype, "sortedLibrariesByDeps", {
|
|
2207
|
-
//#endregion
|
|
2208
|
-
//#region getters & methods / sorted libraries by deps
|
|
2209
|
-
get: function () {
|
|
2210
|
-
//#region @backendFunc
|
|
2211
|
-
var libs = this.libraries;
|
|
2212
|
-
var sorted = BaseProject.sortGroupOfProject(libs, function (proj) {
|
|
2213
|
-
if (!tnp_core_2._.isUndefined(proj.cache['deps'])) {
|
|
2214
|
-
return proj.cache['deps'];
|
|
2215
|
-
}
|
|
2216
|
-
var uiJsonPath = proj.pathFor('ui-module.json');
|
|
2217
|
-
if (index_1.Helpers.exists(uiJsonPath)) {
|
|
2218
|
-
var uiModuleJson = index_1.Helpers.readJson(uiJsonPath);
|
|
2219
|
-
var allLibs = (uiModuleJson.dependencies || []);
|
|
2220
|
-
proj.cache['deps'] = allLibs.filter(function (f) { return !tnp_core_2._.isUndefined(libs.find(function (c) { return c.basename === f; })); });
|
|
2221
|
-
}
|
|
2222
|
-
else {
|
|
2223
|
-
var allLibs = Object.keys(proj.allDependencies);
|
|
2224
|
-
proj.cache['deps'] = allLibs.filter(function (f) { return !tnp_core_2._.isUndefined(libs.find(function (c) { return c.name === f; })); });
|
|
2225
|
-
}
|
|
2226
|
-
// console.log(`${proj.name} => all libs`, proj.cache['deps'])
|
|
2227
|
-
return proj.cache['deps'];
|
|
2228
|
-
}, function (proj) {
|
|
2229
|
-
if (!tnp_core_2._.isUndefined(proj.cache['nameToCompare'])) {
|
|
2230
|
-
// console.log(`CACHE ${proj.basename} => name: ` + proj.cache['nameToCompare'])
|
|
2231
|
-
return proj.cache['nameToCompare'];
|
|
2232
|
-
}
|
|
2233
|
-
proj.cache['nameToCompare'] = index_1.Helpers.exists(proj.pathFor('ui-module.json'))
|
|
2234
|
-
? proj.basename
|
|
2235
|
-
: proj.name;
|
|
2236
|
-
return proj.cache['nameToCompare'];
|
|
2237
|
-
});
|
|
2238
|
-
return sorted;
|
|
2239
|
-
//#endregion
|
|
2240
|
-
},
|
|
2241
|
-
enumerable: false,
|
|
2242
|
-
configurable: true
|
|
2243
|
-
});
|
|
2244
|
-
//#endregion
|
|
2245
|
-
//#region getters & methods / get sorted libraries by deps for build
|
|
2246
|
-
BaseProject.prototype.getSortedLibrariesByDepsForBuild = function (libs, dontSugestBuildAll) {
|
|
2247
|
-
var _a;
|
|
2248
|
-
if (dontSugestBuildAll === void 0) { dontSugestBuildAll = false; }
|
|
2249
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2250
|
-
var buildAll, lastSelectedJsonFile, lastSelected, selected, selectedLibs, selected;
|
|
2251
|
-
return tslib_1.__generator(this, function (_b) {
|
|
2252
|
-
switch (_b.label) {
|
|
2253
|
-
case 0:
|
|
2254
|
-
buildAll = false;
|
|
2255
|
-
lastSelectedJsonFile = 'tmp-last-selected.json';
|
|
2256
|
-
lastSelected = ((_a = index_1.Helpers.readJson(this.pathFor(lastSelectedJsonFile))) === null || _a === void 0 ? void 0 : _a.lastSelected) || [];
|
|
2257
|
-
if (!(tnp_core_2._.isArray(lastSelected) && lastSelected.length > 0)) return [3 /*break*/, 2];
|
|
2258
|
-
selected = lastSelected.map(function (c) { return libs.find(function (l) { return l.basename == c; }); });
|
|
2259
|
-
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_3.chalk.bold(c.name)); }).join('\n'), "\n\n "));
|
|
2260
|
-
return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo("Continue build with last selected ?")];
|
|
2261
|
-
case 1:
|
|
2262
|
-
if (_b.sent()) {
|
|
2263
|
-
libs = selected;
|
|
2264
|
-
return [2 /*return*/, libs];
|
|
2265
|
-
}
|
|
2266
|
-
_b.label = 2;
|
|
2267
|
-
case 2:
|
|
2268
|
-
if (!(libs.length < 6 && !dontSugestBuildAll)) return [3 /*break*/, 4];
|
|
2269
|
-
return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Should all libraries be included in build ?')];
|
|
2270
|
-
case 3:
|
|
2271
|
-
buildAll = _b.sent();
|
|
2272
|
-
_b.label = 4;
|
|
2273
|
-
case 4:
|
|
2274
|
-
if (buildAll) {
|
|
2275
|
-
return [2 /*return*/, libs];
|
|
2276
|
-
}
|
|
2277
|
-
_b.label = 5;
|
|
2278
|
-
case 5:
|
|
2279
|
-
if (!true) return [3 /*break*/, 8];
|
|
2280
|
-
return [4 /*yield*/, index_1.Helpers.consoleGui.multiselect("Select libraries to build ", libs.map(function (c) {
|
|
2281
|
-
return { name: c.name, value: c.name, selected: true };
|
|
2282
|
-
}), true)];
|
|
2283
|
-
case 6:
|
|
2284
|
-
selectedLibs = _b.sent();
|
|
2285
|
-
selected = selectedLibs.map(function (c) { return libs.find(function (l) { return l.name == c; }); });
|
|
2286
|
-
index_1.Helpers.info("\n\n".concat(selected.map(function (c, i) { return "".concat(i + 1, ". ").concat(c.basename, " ").concat(tnp_core_3.chalk.bold(c.name)); }).join('\n'), "\n\n "));
|
|
2287
|
-
return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo("Continue build with ".concat(selected.length, " selected ?"))];
|
|
2288
|
-
case 7:
|
|
2289
|
-
if (_b.sent()) {
|
|
2290
|
-
libs = selected;
|
|
2291
|
-
return [3 /*break*/, 8];
|
|
2292
|
-
}
|
|
2293
|
-
return [3 /*break*/, 5];
|
|
2294
|
-
case 8:
|
|
2295
|
-
index_1.Helpers.writeJson(this.pathFor(lastSelectedJsonFile), {
|
|
2296
|
-
lastSelected: libs.map(function (c) { return c.basename; }),
|
|
2297
|
-
});
|
|
2298
|
-
return [2 /*return*/, libs];
|
|
2299
|
-
}
|
|
2300
|
-
});
|
|
2301
|
-
});
|
|
2302
|
-
};
|
|
2303
|
-
Object.defineProperty(BaseProject.prototype, "getLibraryBuildSuccessComamnd", {
|
|
2304
|
-
//#endregion
|
|
2305
|
-
//#region getters & methods / get library build success command
|
|
2306
|
-
get: function () {
|
|
2307
|
-
//#region @backendFunc
|
|
2308
|
-
var isAngularLib = index_1.Helpers.exists(this.pathFor('ng-package.json'));
|
|
2309
|
-
if (isAngularLib) {
|
|
2310
|
-
return "Trace: Build complete";
|
|
2311
|
-
}
|
|
2312
|
-
else {
|
|
2313
|
-
return "Found 0 errors. Watching for file change";
|
|
2314
|
-
}
|
|
2315
|
-
//#endregion
|
|
2316
|
-
},
|
|
2317
|
-
enumerable: false,
|
|
2318
|
-
configurable: true
|
|
2319
|
-
});
|
|
2320
|
-
//#endregion
|
|
2321
|
-
//#region getters & methods / build libraries
|
|
2322
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
2323
|
-
BaseProject.prototype.buildLibraries = function (_a) {
|
|
2324
|
-
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;
|
|
2325
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2326
|
-
var allLibs, allLibsToBuild, libsToWatch, _e, locationsForNodeModules, _loop_1, this_1, _f, _g, _h, index, lib, _loop_2, _j, _k, _l, index, lib, e_11_1;
|
|
2327
|
-
var e_12, _m, e_11, _o;
|
|
2328
|
-
var _this = this;
|
|
2329
|
-
return tslib_1.__generator(this, function (_p) {
|
|
2330
|
-
switch (_p.label) {
|
|
2331
|
-
case 0:
|
|
2332
|
-
//#region @backend
|
|
2333
|
-
return [4 /*yield*/, this.saveAllLinkedProjectsToDB()];
|
|
2334
|
-
case 1:
|
|
2335
|
-
//#region @backend
|
|
2336
|
-
_p.sent();
|
|
2337
|
-
if (!strategy) {
|
|
2338
|
-
strategy = 'link';
|
|
2339
|
-
}
|
|
2340
|
-
allLibs = this.libraries;
|
|
2341
|
-
allLibsToBuild = this.sortedLibrariesByDeps.filter(function (f) {
|
|
2342
|
-
if (!onlySelectedLibs) {
|
|
2343
|
-
return true;
|
|
2344
|
-
}
|
|
2345
|
-
var nameMatchesPattern = onlySelectedLibs.find(function (c) { return f.name.includes(c); });
|
|
2346
|
-
var basenameMatchesPattern = onlySelectedLibs.find(function (c) {
|
|
2347
|
-
return f.basename.includes(c);
|
|
2348
|
-
});
|
|
2349
|
-
return nameMatchesPattern || basenameMatchesPattern;
|
|
2350
|
-
});
|
|
2351
|
-
if (!(allLibsToBuild.length == 1)) return [3 /*break*/, 2];
|
|
2352
|
-
_e = [tnp_core_2._.first(allLibsToBuild)];
|
|
2353
|
-
return [3 /*break*/, 4];
|
|
2354
|
-
case 2: return [4 /*yield*/, this.getSortedLibrariesByDepsForBuild(allLibsToBuild, allLibs.length != allLibsToBuild.length)];
|
|
2355
|
-
case 3:
|
|
2356
|
-
_e = _p.sent();
|
|
2357
|
-
_p.label = 4;
|
|
2358
|
-
case 4:
|
|
2359
|
-
libsToWatch = _e;
|
|
2360
|
-
locationsForNodeModules = [
|
|
2361
|
-
this.location,
|
|
2362
|
-
// this.parent.location,
|
|
2363
|
-
// ...this.parent.children.map(c => c.location),
|
|
2364
|
-
].map(function (l) { return (0, tnp_core_1.crossPlatformPath)([l, tnp_config_1.config.folder.node_modules]); });
|
|
2365
|
-
return [4 /*yield*/, this.makeSureNodeModulesInstalled()];
|
|
2366
|
-
case 5:
|
|
2367
|
-
_p.sent();
|
|
2368
|
-
_loop_1 = function (index, lib) {
|
|
2369
|
-
index_1.Helpers.info("Building (".concat(index + 1, "/").concat(allLibs.length, ") ").concat(lib.basename, " (").concat(tnp_core_3.chalk.bold(lib.name), ")"));
|
|
2370
|
-
if (strategy === 'link') {
|
|
2371
|
-
(function () {
|
|
2372
|
-
var e_13, _a;
|
|
2373
|
-
var sourceDist = _this.pathFor([tnp_config_1.config.folder.dist, lib.basename]);
|
|
2374
|
-
try {
|
|
2375
|
-
for (var locationsForNodeModules_1 = (e_13 = void 0, tslib_1.__values(locationsForNodeModules)), locationsForNodeModules_1_1 = locationsForNodeModules_1.next(); !locationsForNodeModules_1_1.done; locationsForNodeModules_1_1 = locationsForNodeModules_1.next()) {
|
|
2376
|
-
var node_modules = locationsForNodeModules_1_1.value;
|
|
2377
|
-
var dest = (0, tnp_core_1.crossPlatformPath)([node_modules, lib.name]);
|
|
2378
|
-
if (!index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
|
|
2379
|
-
index_1.Helpers.remove(dest);
|
|
2380
|
-
}
|
|
2381
|
-
console.log('linking from ', sourceDist);
|
|
2382
|
-
console.log('linking to ', dest);
|
|
2383
|
-
// Helpers.remove(dest);
|
|
2384
|
-
index_1.Helpers.createSymLink(sourceDist, dest, {
|
|
2385
|
-
continueWhenExistedFolderDoesntExists: true,
|
|
2386
|
-
});
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
|
-
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
2390
|
-
finally {
|
|
2391
|
-
try {
|
|
2392
|
-
if (locationsForNodeModules_1_1 && !locationsForNodeModules_1_1.done && (_a = locationsForNodeModules_1.return)) _a.call(locationsForNodeModules_1);
|
|
2393
|
-
}
|
|
2394
|
-
finally { if (e_13) throw e_13.error; }
|
|
2395
|
-
}
|
|
2396
|
-
if (rebuild || !index_1.Helpers.exists(sourceDist)) {
|
|
2397
|
-
index_1.Helpers.info("Compiling ".concat(lib.name, " ..."));
|
|
2398
|
-
_this.run(lib.getLibraryBuildComamnd({ watch: false }), {
|
|
2399
|
-
output: true,
|
|
2400
|
-
}).sync();
|
|
2401
|
-
}
|
|
2402
|
-
})();
|
|
2403
|
-
(function () {
|
|
2404
|
-
var sourceDist = _this.pathFor([tnp_config_1.config.folder.dist, lib.basename]);
|
|
2405
|
-
var dest = _this.pathFor([tnp_config_1.config.folder.node_modules, lib.name]);
|
|
2406
|
-
if (!index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
|
|
2407
|
-
index_1.Helpers.remove(dest);
|
|
2408
|
-
}
|
|
2409
|
-
index_1.Helpers.createSymLink(sourceDist, dest, {
|
|
2410
|
-
continueWhenExistedFolderDoesntExists: true,
|
|
2411
|
-
});
|
|
2412
|
-
})();
|
|
2413
|
-
}
|
|
2414
|
-
else if (strategy === 'copy') {
|
|
2415
|
-
var sourceDist = this_1.pathFor([tnp_config_1.config.folder.dist, lib.basename]);
|
|
2416
|
-
var dest = this_1.pathFor([tnp_config_1.config.folder.node_modules, lib.name]);
|
|
2417
|
-
if (rebuild || !index_1.Helpers.exists(sourceDist)) {
|
|
2418
|
-
index_1.Helpers.info("Compiling ".concat(lib.name, " ..."));
|
|
2419
|
-
this_1.run(lib.getLibraryBuildComamnd({ watch: false }), {
|
|
2420
|
-
output: true,
|
|
2421
|
-
}).sync();
|
|
2422
|
-
}
|
|
2423
|
-
if (index_1.Helpers.isSymlinkFileExitedOrUnexisted(dest)) {
|
|
2424
|
-
index_1.Helpers.remove(dest);
|
|
2425
|
-
}
|
|
2426
|
-
index_1.Helpers.copy(sourceDist, dest);
|
|
2427
|
-
}
|
|
2428
|
-
};
|
|
2429
|
-
this_1 = this;
|
|
2430
|
-
try {
|
|
2431
|
-
for (_f = tslib_1.__values(this.sortedLibrariesByDeps.entries()), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
2432
|
-
_h = tslib_1.__read(_g.value, 2), index = _h[0], lib = _h[1];
|
|
2433
|
-
_loop_1(index, lib);
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
2437
|
-
finally {
|
|
2438
|
-
try {
|
|
2439
|
-
if (_g && !_g.done && (_m = _f.return)) _m.call(_f);
|
|
2440
|
-
}
|
|
2441
|
-
finally { if (e_12) throw e_12.error; }
|
|
2442
|
-
}
|
|
2443
|
-
if (!watch) return [3 /*break*/, 14];
|
|
2444
|
-
_loop_2 = function (index, lib) {
|
|
2445
|
-
return tslib_1.__generator(this, function (_q) {
|
|
2446
|
-
switch (_q.label) {
|
|
2447
|
-
case 0:
|
|
2448
|
-
index_1.Helpers.info("Building for watch (".concat(index + 1, "/").concat(libsToWatch.length, ") ").concat(lib.basename, " (").concat(tnp_core_3.chalk.bold(lib.name), ")"));
|
|
2449
|
-
return [4 /*yield*/, (function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
2450
|
-
var _this = this;
|
|
2451
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2452
|
-
switch (_a.label) {
|
|
2453
|
-
case 0: return [4 /*yield*/, this.run(lib.getLibraryBuildComamnd({ watch: true }), {
|
|
2454
|
-
output: true,
|
|
2455
|
-
}).unitlOutputContains(lib.getLibraryBuildSuccessComamnd, [], 0, function () {
|
|
2456
|
-
var sourceDist = _this.pathFor([
|
|
2457
|
-
tnp_config_1.config.folder.dist,
|
|
2458
|
-
lib.basename,
|
|
2459
|
-
]);
|
|
2460
|
-
var dest = _this.pathFor([tnp_config_1.config.folder.node_modules, lib.name]);
|
|
2461
|
-
index_1.Helpers.copy(sourceDist, dest);
|
|
2462
|
-
console.log("Sync done for ".concat(lib.basename, " to ").concat(lib.name));
|
|
2463
|
-
})];
|
|
2464
|
-
case 1:
|
|
2465
|
-
_a.sent();
|
|
2466
|
-
return [2 /*return*/];
|
|
2467
|
-
}
|
|
2468
|
-
});
|
|
2469
|
-
}); })()];
|
|
2470
|
-
case 1:
|
|
2471
|
-
_q.sent();
|
|
2472
|
-
return [2 /*return*/];
|
|
2473
|
-
}
|
|
2474
|
-
});
|
|
2475
|
-
};
|
|
2476
|
-
_p.label = 6;
|
|
2477
|
-
case 6:
|
|
2478
|
-
_p.trys.push([6, 11, 12, 13]);
|
|
2479
|
-
_j = tslib_1.__values(libsToWatch.entries()), _k = _j.next();
|
|
2480
|
-
_p.label = 7;
|
|
2481
|
-
case 7:
|
|
2482
|
-
if (!!_k.done) return [3 /*break*/, 10];
|
|
2483
|
-
_l = tslib_1.__read(_k.value, 2), index = _l[0], lib = _l[1];
|
|
2484
|
-
return [5 /*yield**/, _loop_2(index, lib)];
|
|
2485
|
-
case 8:
|
|
2486
|
-
_p.sent();
|
|
2487
|
-
_p.label = 9;
|
|
2488
|
-
case 9:
|
|
2489
|
-
_k = _j.next();
|
|
2490
|
-
return [3 /*break*/, 7];
|
|
2491
|
-
case 10: return [3 /*break*/, 13];
|
|
2492
|
-
case 11:
|
|
2493
|
-
e_11_1 = _p.sent();
|
|
2494
|
-
e_11 = { error: e_11_1 };
|
|
2495
|
-
return [3 /*break*/, 13];
|
|
2496
|
-
case 12:
|
|
2497
|
-
try {
|
|
2498
|
-
if (_k && !_k.done && (_o = _j.return)) _o.call(_j);
|
|
2499
|
-
}
|
|
2500
|
-
finally { if (e_11) throw e_11.error; }
|
|
2501
|
-
return [7 /*endfinally*/];
|
|
2502
|
-
case 13:
|
|
2503
|
-
// await this.__indexRebuilder.startAndWatch({ taskName: 'index rebuild watch' });
|
|
2504
|
-
index_1.Helpers.success('BUILD DONE.. watching..');
|
|
2505
|
-
return [3 /*break*/, 15];
|
|
2506
|
-
case 14:
|
|
2507
|
-
// await this.__indexRebuilder.start({ taskName: 'index rebuild watch' });
|
|
2508
|
-
index_1.Helpers.success('BUILD DONE');
|
|
2509
|
-
_p.label = 15;
|
|
2510
|
-
case 15: return [2 /*return*/];
|
|
2511
|
-
}
|
|
2512
|
-
});
|
|
2513
|
-
});
|
|
2514
|
-
};
|
|
2515
|
-
//#endregion
|
|
2516
|
-
//#region getters & methods / get library build success command
|
|
2517
|
-
BaseProject.prototype.getLibraryBuildComamnd = function (options) {
|
|
2518
|
-
//#region @backendFunc
|
|
2519
|
-
var watch = options.watch;
|
|
2520
|
-
var isAngularLib = index_1.Helpers.exists(this.pathFor('ng-package.json')) ||
|
|
2521
|
-
index_1.Helpers.exists(this.pathFor('tsconfig.app.json'));
|
|
2522
|
-
if (isAngularLib) {
|
|
2523
|
-
return "npm-run ng build ".concat(this.basename, " ").concat(watch ? '--watch' : '');
|
|
2524
|
-
}
|
|
2525
|
-
else {
|
|
2526
|
-
return "npm-run tsc -p libraries/".concat(this.basename, "/tsconfig.lib.json ").concat(watch ? '--watch' : '', " --preserveWatchOutput");
|
|
2527
|
-
}
|
|
2528
|
-
//#endregion
|
|
2529
|
-
};
|
|
2530
|
-
//#endregion
|
|
2531
|
-
//#region getters & methods / start npm task
|
|
2532
|
-
BaseProject.prototype.startNpmTask = function (taskName, additionalArguments) {
|
|
2533
|
-
if (tnp_core_2._.isObject(additionalArguments)) {
|
|
2534
|
-
additionalArguments = Object.keys(additionalArguments)
|
|
2535
|
-
.map(function (k) { return "--".concat(k, " ").concat(additionalArguments[k]); })
|
|
2536
|
-
.join(' ');
|
|
2537
|
-
}
|
|
2538
|
-
return this.run("npm run ".concat(taskName, " ").concat(additionalArguments ? ' -- ' + additionalArguments : ''), { output: true });
|
|
2539
|
-
};
|
|
2540
904
|
//#region static
|
|
2541
905
|
//#region static / instance of resovle
|
|
2542
906
|
BaseProject.ins = new base_project_resolver_1.BaseProjectResolver(BaseProject);
|