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