tnp-helpers 16.5.15 → 16.5.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-feature-for-project.mjs +8 -0
- package/browser/esm2022/lib/base/base-project-resolver.mjs +204 -0
- package/browser/esm2022/lib/base/base-project.mjs +1007 -0
- package/browser/esm2022/lib/base/commit-data.mjs +145 -0
- package/browser/esm2022/lib/base/index.mjs +11 -0
- package/browser/esm2022/lib/base/translate.mjs +42 -0
- package/browser/esm2022/lib/helpers.mjs +6 -3
- package/browser/esm2022/lib/index.mjs +2 -3
- package/browser/esm2022/lib/models.mjs +1 -1
- package/browser/fesm2022/tnp-helpers.mjs +860 -84
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/base-feature-for-project.d.ts +6 -0
- package/{client/lib → browser/lib/base}/base-project-resolver.d.ts +4 -7
- package/browser/lib/base/base-project.d.ts +287 -0
- package/browser/lib/base/commit-data.d.ts +31 -0
- package/browser/lib/base/index.d.ts +5 -0
- package/browser/lib/base/translate.d.ts +2 -0
- package/browser/lib/index.d.ts +2 -3
- package/browser/lib/models.d.ts +1 -1
- package/client/esm2022/lib/base/base-feature-for-project.mjs +8 -0
- package/client/esm2022/lib/base/base-project-resolver.mjs +204 -0
- package/client/esm2022/lib/base/base-project.mjs +1007 -0
- package/client/esm2022/lib/base/commit-data.mjs +145 -0
- package/client/esm2022/lib/base/index.mjs +11 -0
- package/client/esm2022/lib/base/translate.mjs +42 -0
- package/client/esm2022/lib/helpers.mjs +6 -3
- package/client/esm2022/lib/index.mjs +2 -3
- package/client/esm2022/lib/models.mjs +1 -1
- package/client/fesm2022/tnp-helpers.mjs +860 -84
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/base-feature-for-project.d.ts +6 -0
- package/{browser/lib → client/lib/base}/base-project-resolver.d.ts +4 -7
- package/client/lib/base/base-project.d.ts +287 -0
- package/client/lib/base/commit-data.d.ts +31 -0
- package/client/lib/base/index.d.ts +5 -0
- package/client/lib/base/translate.d.ts +2 -0
- package/client/lib/index.d.ts +2 -3
- package/client/lib/models.d.ts +1 -1
- package/client/package.json +37 -34
- package/lib/base/base-command-line.backend.d.ts +79 -0
- package/lib/base/base-command-line.backend.js +674 -0
- package/lib/base/base-command-line.backend.js.map +1 -0
- package/lib/base/base-feature-for-project.d.ts +5 -0
- package/lib/base/base-feature-for-project.js +11 -0
- package/lib/base/base-feature-for-project.js.map +1 -0
- package/lib/{base-project-resolver.d.ts → base/base-project-resolver.d.ts} +4 -7
- package/lib/{base-project-resolver.js → base/base-project-resolver.js} +33 -28
- package/lib/base/base-project-resolver.js.map +1 -0
- package/lib/base/base-project.d.ts +297 -0
- package/lib/base/base-project.js +1451 -0
- package/lib/base/base-project.js.map +1 -0
- package/lib/base/base-start-config.backend.d.ts +35 -0
- package/lib/base/base-start-config.backend.js +126 -0
- package/lib/base/base-start-config.backend.js.map +1 -0
- package/lib/base/command-line-feature.backend.d.ts +32 -0
- package/lib/base/command-line-feature.backend.js +89 -0
- package/lib/base/command-line-feature.backend.js.map +1 -0
- package/lib/base/commit-data.d.ts +30 -0
- package/lib/base/commit-data.js +200 -0
- package/lib/base/commit-data.js.map +1 -0
- package/lib/base/index.d.ts +7 -0
- package/lib/base/index.js +13 -0
- package/lib/base/index.js.map +1 -0
- package/lib/base/translate.d.ts +1 -0
- package/lib/base/translate.js +80 -0
- package/lib/base/translate.js.map +1 -0
- package/lib/for-backend/helpers-cli-tool.backend.d.ts +42 -22
- package/lib/for-backend/helpers-cli-tool.backend.js +129 -180
- package/lib/for-backend/helpers-cli-tool.backend.js.map +1 -1
- package/lib/for-backend/helpers-file-folders.backend.d.ts +2 -8
- package/lib/for-backend/helpers-file-folders.backend.js +4 -14
- package/lib/for-backend/helpers-file-folders.backend.js.map +1 -1
- package/lib/for-backend/helpers-git.backend.d.ts +48 -12
- package/lib/for-backend/helpers-git.backend.js +227 -142
- package/lib/for-backend/helpers-git.backend.js.map +1 -1
- package/lib/for-backend/helpers-process.backend.d.ts +5 -11
- package/lib/for-backend/helpers-process.backend.js +77 -39
- package/lib/for-backend/helpers-process.backend.js.map +1 -1
- package/lib/for-backend/helpers-vscode.backend.d.ts +3 -3
- package/lib/for-backend/helpers-vscode.backend.js.map +1 -1
- package/lib/for-browser/angular.helper.js +3 -3
- package/lib/helpers.d.ts +2 -3
- package/lib/helpers.js +5 -2
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/models.d.ts +1 -1
- 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 +8 -5
- package/package.json_tnp.json5 +4 -1
- package/tmp-environment.json +41 -45
- package/websql/esm2022/lib/base/base-feature-for-project.mjs +8 -0
- package/websql/esm2022/lib/base/base-project-resolver.mjs +203 -0
- package/websql/esm2022/lib/base/base-project.mjs +994 -0
- package/websql/esm2022/lib/base/commit-data.mjs +145 -0
- package/websql/esm2022/lib/base/index.mjs +11 -0
- package/websql/esm2022/lib/base/translate.mjs +42 -0
- package/websql/esm2022/lib/helpers.mjs +6 -3
- package/websql/esm2022/lib/index.mjs +2 -3
- package/websql/esm2022/lib/models.mjs +1 -1
- package/websql/fesm2022/tnp-helpers.mjs +861 -85
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/base-feature-for-project.d.ts +6 -0
- package/websql/lib/{base-project-resolver.d.ts → base/base-project-resolver.d.ts} +4 -7
- package/websql/lib/base/base-project.d.ts +287 -0
- package/websql/lib/base/commit-data.d.ts +31 -0
- package/websql/lib/base/index.d.ts +5 -0
- package/websql/lib/base/translate.d.ts +2 -0
- package/websql/lib/index.d.ts +2 -3
- package/websql/lib/models.d.ts +1 -1
- package/browser/esm2022/lib/base-project-resolver.mjs +0 -223
- package/browser/esm2022/lib/base-project.mjs +0 -374
- package/browser/lib/base-project.d.ts +0 -94
- package/client/esm2022/lib/base-project-resolver.mjs +0 -223
- package/client/esm2022/lib/base-project.mjs +0 -374
- package/client/lib/base-project.d.ts +0 -94
- package/lib/base-project-resolver.js.map +0 -1
- package/lib/base-project.d.ts +0 -103
- package/lib/base-project.js +0 -482
- package/lib/base-project.js.map +0 -1
- package/lib/git-project.d.ts +0 -57
- package/lib/git-project.js +0 -224
- package/lib/git-project.js.map +0 -1
- package/websql/esm2022/lib/base-project-resolver.mjs +0 -222
- package/websql/esm2022/lib/base-project.mjs +0 -361
- package/websql/lib/base-project.d.ts +0 -94
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseCommandLine = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var index_1 = require("../index");
|
|
6
|
+
var command_line_feature_backend_1 = require("./command-line-feature.backend");
|
|
7
|
+
var tnp_core_1 = require("tnp-core");
|
|
8
|
+
var BaseCommandLine = /** @class */ (function (_super) {
|
|
9
|
+
tslib_1.__extends(BaseCommandLine, _super);
|
|
10
|
+
function BaseCommandLine() {
|
|
11
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
12
|
+
}
|
|
13
|
+
BaseCommandLine.prototype._ = function () {
|
|
14
|
+
index_1.Helpers.error('Please select git command');
|
|
15
|
+
};
|
|
16
|
+
//#region commands / pull
|
|
17
|
+
BaseCommandLine.prototype.pull = function () {
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
19
|
+
return tslib_1.__generator(this, function (_a) {
|
|
20
|
+
switch (_a.label) {
|
|
21
|
+
case 0: return [4 /*yield*/, this.project.pullProcess()];
|
|
22
|
+
case 1:
|
|
23
|
+
_a.sent();
|
|
24
|
+
this._exit();
|
|
25
|
+
return [2 /*return*/];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region commands / reset
|
|
32
|
+
BaseCommandLine.prototype.reset = function () {
|
|
33
|
+
var _a;
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
35
|
+
var branchPatternOrBranchName, overrideBranchToReset, branches, childrentMsg, res, _b, _c, child, e_1_1;
|
|
36
|
+
var e_1, _d;
|
|
37
|
+
return tslib_1.__generator(this, function (_e) {
|
|
38
|
+
switch (_e.label) {
|
|
39
|
+
case 0:
|
|
40
|
+
branchPatternOrBranchName = this.firstArg || this.project.getDefaultDevelopmentBranch();
|
|
41
|
+
branches = this.__filterBranchesByPattern(branchPatternOrBranchName);
|
|
42
|
+
if (!(branches.length > 0)) return [3 /*break*/, 2];
|
|
43
|
+
return [4 /*yield*/, this.__selectBrach(branches)];
|
|
44
|
+
case 1:
|
|
45
|
+
overrideBranchToReset = _e.sent();
|
|
46
|
+
return [3 /*break*/, 3];
|
|
47
|
+
case 2:
|
|
48
|
+
index_1.Helpers.error("No branch found by name \"".concat(overrideBranchToReset, "\""), false, true);
|
|
49
|
+
_e.label = 3;
|
|
50
|
+
case 3:
|
|
51
|
+
childrentMsg = (tnp_core_1._.isArray(this.project.children) && this.project.children.length > 0) ?
|
|
52
|
+
"- external modules:\n".concat(this.project.children.map(function (c) { return "".concat(c.basename, " (").concat(tnp_core_1.chalk.yellow(c.name), ")"); }).join('\n')) : '';
|
|
53
|
+
if (!(((_a = this.project.children) === null || _a === void 0 ? void 0 : _a.length) > 0)) return [3 /*break*/, 14];
|
|
54
|
+
index_1.Helpers.info("\n\n YOU ARE RESETING EVERYTHING TO BRANCH: ".concat(tnp_core_1.chalk.bold(overrideBranchToReset ? overrideBranchToReset
|
|
55
|
+
: this.project.getDefaultDevelopmentBranch()), "\n\n "));
|
|
56
|
+
return [4 /*yield*/, index_1.Helpers.questionYesNo("Are you sure you wanna reset hard and pull latest changes for:\n- curret project (".concat(this.project.name, ")\n").concat(childrentMsg, "\n"))];
|
|
57
|
+
case 4:
|
|
58
|
+
res = _e.sent();
|
|
59
|
+
if (!res) return [3 /*break*/, 13];
|
|
60
|
+
return [4 /*yield*/, this.project.resetProcess(overrideBranchToReset)];
|
|
61
|
+
case 5:
|
|
62
|
+
_e.sent();
|
|
63
|
+
_e.label = 6;
|
|
64
|
+
case 6:
|
|
65
|
+
_e.trys.push([6, 11, 12, 13]);
|
|
66
|
+
_b = tslib_1.__values(this.project.children), _c = _b.next();
|
|
67
|
+
_e.label = 7;
|
|
68
|
+
case 7:
|
|
69
|
+
if (!!_c.done) return [3 /*break*/, 10];
|
|
70
|
+
child = _c.value;
|
|
71
|
+
return [4 /*yield*/, child.resetProcess(overrideBranchToReset)];
|
|
72
|
+
case 8:
|
|
73
|
+
_e.sent();
|
|
74
|
+
_e.label = 9;
|
|
75
|
+
case 9:
|
|
76
|
+
_c = _b.next();
|
|
77
|
+
return [3 /*break*/, 7];
|
|
78
|
+
case 10: return [3 /*break*/, 13];
|
|
79
|
+
case 11:
|
|
80
|
+
e_1_1 = _e.sent();
|
|
81
|
+
e_1 = { error: e_1_1 };
|
|
82
|
+
return [3 /*break*/, 13];
|
|
83
|
+
case 12:
|
|
84
|
+
try {
|
|
85
|
+
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
86
|
+
}
|
|
87
|
+
finally { if (e_1) throw e_1.error; }
|
|
88
|
+
return [7 /*endfinally*/];
|
|
89
|
+
case 13: return [3 /*break*/, 16];
|
|
90
|
+
case 14: return [4 /*yield*/, this.project.resetProcess(overrideBranchToReset)];
|
|
91
|
+
case 15:
|
|
92
|
+
_e.sent();
|
|
93
|
+
_e.label = 16;
|
|
94
|
+
case 16: return [2 /*return*/];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region commands / soft
|
|
101
|
+
BaseCommandLine.prototype.soft = function () {
|
|
102
|
+
// TODO when aciton commit
|
|
103
|
+
this.project.git.resetSoftHEAD(1);
|
|
104
|
+
this._exit();
|
|
105
|
+
};
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region commands / rebase
|
|
108
|
+
BaseCommandLine.prototype.rebase = function () {
|
|
109
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
110
|
+
var currentBranch, safeReset, rebaseBranch, branches, error_1;
|
|
111
|
+
return tslib_1.__generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0:
|
|
114
|
+
currentBranch = this.project.git.currentBranchName;
|
|
115
|
+
safeReset = 10;
|
|
116
|
+
rebaseBranch = this.firstArg || this.project.getDefaultDevelopmentBranch();
|
|
117
|
+
branches = this.__filterBranchesByPattern(rebaseBranch);
|
|
118
|
+
if (!(branches.length > 0)) return [3 /*break*/, 2];
|
|
119
|
+
return [4 /*yield*/, this.__selectBrach(branches)];
|
|
120
|
+
case 1:
|
|
121
|
+
rebaseBranch = _a.sent();
|
|
122
|
+
return [3 /*break*/, 3];
|
|
123
|
+
case 2:
|
|
124
|
+
index_1.Helpers.error("No branch found by name \"".concat(rebaseBranch, "\""), false, true);
|
|
125
|
+
_a.label = 3;
|
|
126
|
+
case 3:
|
|
127
|
+
_a.trys.push([3, 5, , 7]);
|
|
128
|
+
this.project.run("git reset --hard && git checkout ".concat(rebaseBranch, " && git reset --hard HEAD~").concat(safeReset, " && git pull origin ").concat(rebaseBranch, " ")
|
|
129
|
+
+ "&& git checkout ".concat(currentBranch, " && git reset --soft HEAD~1 && git stash && git reset --hard HEAD~").concat(safeReset, " && git rebase ").concat(rebaseBranch, " && git stash apply"), { output: false, silence: true }).sync();
|
|
130
|
+
return [4 /*yield*/, this.project.init()];
|
|
131
|
+
case 4:
|
|
132
|
+
_a.sent();
|
|
133
|
+
index_1.Helpers.info('REBASE DONE');
|
|
134
|
+
return [3 /*break*/, 7];
|
|
135
|
+
case 5:
|
|
136
|
+
error_1 = _a.sent();
|
|
137
|
+
return [4 /*yield*/, this.project.init()];
|
|
138
|
+
case 6:
|
|
139
|
+
_a.sent();
|
|
140
|
+
index_1.Helpers.warn('PLEASE MERGE YOUR CHANGES');
|
|
141
|
+
return [3 /*break*/, 7];
|
|
142
|
+
case 7:
|
|
143
|
+
this._exit();
|
|
144
|
+
return [2 /*return*/];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region commands / stash
|
|
151
|
+
/**
|
|
152
|
+
* stash only staged files
|
|
153
|
+
*/
|
|
154
|
+
BaseCommandLine.prototype.stash = function () {
|
|
155
|
+
this.project.git.stash({ onlyStaged: true });
|
|
156
|
+
this._exit();
|
|
157
|
+
};
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region commands / stash all
|
|
160
|
+
/**
|
|
161
|
+
* stash all files
|
|
162
|
+
*/
|
|
163
|
+
BaseCommandLine.prototype.stashAll = function () {
|
|
164
|
+
this.project.git.stageAllFiles();
|
|
165
|
+
this.project.git.stash({ onlyStaged: false });
|
|
166
|
+
this._exit();
|
|
167
|
+
};
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region commands / push all origins
|
|
170
|
+
/**
|
|
171
|
+
* push force to all orgins
|
|
172
|
+
*/
|
|
173
|
+
BaseCommandLine.prototype.pushAllForce = function () {
|
|
174
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
175
|
+
return tslib_1.__generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0: return [4 /*yield*/, this.pushALl(true)];
|
|
178
|
+
case 1:
|
|
179
|
+
_a.sent();
|
|
180
|
+
return [2 /*return*/];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* push to all origins
|
|
187
|
+
*/
|
|
188
|
+
BaseCommandLine.prototype.pushALl = function (force) {
|
|
189
|
+
if (force === void 0) { force = false; }
|
|
190
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
191
|
+
var remotes, index, _a, origin_1, url;
|
|
192
|
+
return tslib_1.__generator(this, function (_b) {
|
|
193
|
+
switch (_b.label) {
|
|
194
|
+
case 0:
|
|
195
|
+
remotes = this.project.git.allOrigins;
|
|
196
|
+
index_1.Helpers.info("\n Remotes for repo:\n ".concat(remotes.map(function (r, i) { return "".concat(i + 1, ". ").concat(r.origin, " ").concat(r.url); }).join('\n'), "\n\n "));
|
|
197
|
+
index = 0;
|
|
198
|
+
_b.label = 1;
|
|
199
|
+
case 1:
|
|
200
|
+
if (!(index < remotes.length)) return [3 /*break*/, 4];
|
|
201
|
+
_a = remotes[index], origin_1 = _a.origin, url = _a.url;
|
|
202
|
+
return [4 /*yield*/, this.push({ force: force, origin: origin_1 })];
|
|
203
|
+
case 2:
|
|
204
|
+
_b.sent();
|
|
205
|
+
_b.label = 3;
|
|
206
|
+
case 3:
|
|
207
|
+
index++;
|
|
208
|
+
return [3 /*break*/, 1];
|
|
209
|
+
case 4:
|
|
210
|
+
this._exit();
|
|
211
|
+
return [2 /*return*/];
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region commands / push force
|
|
218
|
+
BaseCommandLine.prototype.forcePush = function () {
|
|
219
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
220
|
+
return tslib_1.__generator(this, function (_a) {
|
|
221
|
+
switch (_a.label) {
|
|
222
|
+
case 0: return [4 /*yield*/, this.push({ force: true, typeofCommit: 'feature' })];
|
|
223
|
+
case 1:
|
|
224
|
+
_a.sent();
|
|
225
|
+
return [2 /*return*/];
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
BaseCommandLine.prototype.pushForce = function () {
|
|
231
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
232
|
+
return tslib_1.__generator(this, function (_a) {
|
|
233
|
+
switch (_a.label) {
|
|
234
|
+
case 0: return [4 /*yield*/, this.push({ force: true, typeofCommit: 'feature' })];
|
|
235
|
+
case 1:
|
|
236
|
+
_a.sent();
|
|
237
|
+
return [2 /*return*/];
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region commands / push
|
|
244
|
+
BaseCommandLine.prototype.push = function (options) {
|
|
245
|
+
if (options === void 0) { options = {}; }
|
|
246
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
247
|
+
var _this = this;
|
|
248
|
+
return tslib_1.__generator(this, function (_a) {
|
|
249
|
+
switch (_a.label) {
|
|
250
|
+
case 0: return [4 /*yield*/, this.project.pushProcess(tslib_1.__assign(tslib_1.__assign({}, options), { forcePushNoQuestion: options.force, args: this.args, exitCallBack: function () {
|
|
251
|
+
_this._exit();
|
|
252
|
+
} }))];
|
|
253
|
+
case 1:
|
|
254
|
+
_a.sent();
|
|
255
|
+
this._exit();
|
|
256
|
+
return [2 /*return*/];
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region melt updat ecommits
|
|
263
|
+
BaseCommandLine.prototype.meltUpdateCommits = function () {
|
|
264
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
265
|
+
return tslib_1.__generator(this, function (_a) {
|
|
266
|
+
switch (_a.label) {
|
|
267
|
+
case 0:
|
|
268
|
+
if (!(this.project.git.meltActionCommits(true) > 0)) return [3 /*break*/, 2];
|
|
269
|
+
this.project.git.stageAllFiles();
|
|
270
|
+
return [4 /*yield*/, index_1.Helpers.consoleGui.question.yesNo('Update commits has been reset. Continue with changes ?')];
|
|
271
|
+
case 1:
|
|
272
|
+
if (!(_a.sent())) {
|
|
273
|
+
this._exit();
|
|
274
|
+
}
|
|
275
|
+
_a.label = 2;
|
|
276
|
+
case 2: return [2 /*return*/];
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region commands / push feature
|
|
283
|
+
BaseCommandLine.prototype.pf = function () {
|
|
284
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
285
|
+
return tslib_1.__generator(this, function (_a) {
|
|
286
|
+
switch (_a.label) {
|
|
287
|
+
case 0: return [4 /*yield*/, this.pushFeature()];
|
|
288
|
+
case 1:
|
|
289
|
+
_a.sent();
|
|
290
|
+
return [2 /*return*/];
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
BaseCommandLine.prototype.pushFeature = function () {
|
|
296
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
297
|
+
return tslib_1.__generator(this, function (_a) {
|
|
298
|
+
switch (_a.label) {
|
|
299
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
300
|
+
case 1:
|
|
301
|
+
_a.sent();
|
|
302
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'feature', commitMessageRequired: true })];
|
|
303
|
+
case 2:
|
|
304
|
+
_a.sent();
|
|
305
|
+
return [2 /*return*/];
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region commands / push fix
|
|
312
|
+
BaseCommandLine.prototype.pushFix = function () {
|
|
313
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
314
|
+
return tslib_1.__generator(this, function (_a) {
|
|
315
|
+
switch (_a.label) {
|
|
316
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
317
|
+
case 1:
|
|
318
|
+
_a.sent();
|
|
319
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'bugfix', commitMessageRequired: true })];
|
|
320
|
+
case 2:
|
|
321
|
+
_a.sent();
|
|
322
|
+
return [2 /*return*/];
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
BaseCommandLine.prototype.pfix = function () {
|
|
328
|
+
this.pushFix();
|
|
329
|
+
};
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region commands / push chore
|
|
332
|
+
BaseCommandLine.prototype.pushChore = function () {
|
|
333
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
334
|
+
return tslib_1.__generator(this, function (_a) {
|
|
335
|
+
switch (_a.label) {
|
|
336
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
337
|
+
case 1:
|
|
338
|
+
_a.sent();
|
|
339
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'chore', commitMessageRequired: true })];
|
|
340
|
+
case 2:
|
|
341
|
+
_a.sent();
|
|
342
|
+
return [2 /*return*/];
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
BaseCommandLine.prototype.pc = function () {
|
|
348
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
349
|
+
return tslib_1.__generator(this, function (_a) {
|
|
350
|
+
switch (_a.label) {
|
|
351
|
+
case 0: return [4 /*yield*/, this.pushChore()];
|
|
352
|
+
case 1:
|
|
353
|
+
_a.sent();
|
|
354
|
+
return [2 /*return*/];
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region commands / push refactor
|
|
361
|
+
BaseCommandLine.prototype.pushRefactor = function () {
|
|
362
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
363
|
+
return tslib_1.__generator(this, function (_a) {
|
|
364
|
+
switch (_a.label) {
|
|
365
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
366
|
+
case 1:
|
|
367
|
+
_a.sent();
|
|
368
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'refactor', commitMessageRequired: true })];
|
|
369
|
+
case 2:
|
|
370
|
+
_a.sent();
|
|
371
|
+
return [2 /*return*/];
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
BaseCommandLine.prototype.pushref = function () {
|
|
377
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
378
|
+
return tslib_1.__generator(this, function (_a) {
|
|
379
|
+
switch (_a.label) {
|
|
380
|
+
case 0: return [4 /*yield*/, this.pushRefactor()];
|
|
381
|
+
case 1:
|
|
382
|
+
_a.sent();
|
|
383
|
+
return [2 /*return*/];
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
BaseCommandLine.prototype.pref = function () {
|
|
389
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
390
|
+
return tslib_1.__generator(this, function (_a) {
|
|
391
|
+
switch (_a.label) {
|
|
392
|
+
case 0: return [4 /*yield*/, this.pushRefactor()];
|
|
393
|
+
case 1:
|
|
394
|
+
_a.sent();
|
|
395
|
+
return [2 /*return*/];
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
};
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region commands / push style
|
|
402
|
+
BaseCommandLine.prototype.pushStyle = function () {
|
|
403
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
404
|
+
return tslib_1.__generator(this, function (_a) {
|
|
405
|
+
switch (_a.label) {
|
|
406
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
407
|
+
case 1:
|
|
408
|
+
_a.sent();
|
|
409
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'style', commitMessageRequired: true })];
|
|
410
|
+
case 2:
|
|
411
|
+
_a.sent();
|
|
412
|
+
return [2 /*return*/];
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
};
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region commands / push docs
|
|
419
|
+
BaseCommandLine.prototype.pushDocs = function () {
|
|
420
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
421
|
+
return tslib_1.__generator(this, function (_a) {
|
|
422
|
+
switch (_a.label) {
|
|
423
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
424
|
+
case 1:
|
|
425
|
+
_a.sent();
|
|
426
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'docs', commitMessageRequired: true })];
|
|
427
|
+
case 2:
|
|
428
|
+
_a.sent();
|
|
429
|
+
return [2 /*return*/];
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region commands / push test
|
|
436
|
+
BaseCommandLine.prototype.pushTest = function () {
|
|
437
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
438
|
+
return tslib_1.__generator(this, function (_a) {
|
|
439
|
+
switch (_a.label) {
|
|
440
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
441
|
+
case 1:
|
|
442
|
+
_a.sent();
|
|
443
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'test', commitMessageRequired: true })];
|
|
444
|
+
case 2:
|
|
445
|
+
_a.sent();
|
|
446
|
+
return [2 /*return*/];
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region commands / push perf
|
|
453
|
+
BaseCommandLine.prototype.pushPerf = function () {
|
|
454
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
455
|
+
return tslib_1.__generator(this, function (_a) {
|
|
456
|
+
switch (_a.label) {
|
|
457
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
458
|
+
case 1:
|
|
459
|
+
_a.sent();
|
|
460
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'performance', commitMessageRequired: true })];
|
|
461
|
+
case 2:
|
|
462
|
+
_a.sent();
|
|
463
|
+
return [2 /*return*/];
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
};
|
|
468
|
+
//#endregion
|
|
469
|
+
//#region commands / push ci
|
|
470
|
+
BaseCommandLine.prototype.pushCi = function () {
|
|
471
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
472
|
+
return tslib_1.__generator(this, function (_a) {
|
|
473
|
+
switch (_a.label) {
|
|
474
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
475
|
+
case 1:
|
|
476
|
+
_a.sent();
|
|
477
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'ci', commitMessageRequired: true })];
|
|
478
|
+
case 2:
|
|
479
|
+
_a.sent();
|
|
480
|
+
return [2 /*return*/];
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
};
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region commands / push build
|
|
487
|
+
BaseCommandLine.prototype.pushBuild = function () {
|
|
488
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
489
|
+
return tslib_1.__generator(this, function (_a) {
|
|
490
|
+
switch (_a.label) {
|
|
491
|
+
case 0: return [4 /*yield*/, this.meltUpdateCommits()];
|
|
492
|
+
case 1:
|
|
493
|
+
_a.sent();
|
|
494
|
+
return [4 /*yield*/, this.push({ typeofCommit: 'build', commitMessageRequired: true })];
|
|
495
|
+
case 2:
|
|
496
|
+
_a.sent();
|
|
497
|
+
return [2 /*return*/];
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
});
|
|
501
|
+
};
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region commands / set origin
|
|
504
|
+
BaseCommandLine.prototype.SET_ORIGIN = function () {
|
|
505
|
+
var newOriginNameOrUrl = this.firstArg;
|
|
506
|
+
var proj = this.project;
|
|
507
|
+
if (proj && proj.git.isGitRepo) {
|
|
508
|
+
proj.run("git remote rm origin").sync();
|
|
509
|
+
proj.run("git remote add origin ".concat(newOriginNameOrUrl)).sync();
|
|
510
|
+
index_1.Helpers.info("Done");
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
index_1.Helpers.error("This folder is not a git repo... ", false, true);
|
|
514
|
+
}
|
|
515
|
+
this._exit();
|
|
516
|
+
};
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region commands / rename origin
|
|
519
|
+
BaseCommandLine.prototype.RENAME_ORIGIN = function () {
|
|
520
|
+
var newOriginNameOrUrl = this.firstArg;
|
|
521
|
+
var proj = this.project;
|
|
522
|
+
if (proj && proj.git.isGitRepo) {
|
|
523
|
+
proj.git.renameOrigin(newOriginNameOrUrl);
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
index_1.Helpers.error("This folder is not a git repo... ", false, true);
|
|
527
|
+
}
|
|
528
|
+
this._exit();
|
|
529
|
+
};
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region commands / last hash tag
|
|
532
|
+
BaseCommandLine.prototype.LAST_TAG_HASH = function () {
|
|
533
|
+
index_1.Helpers.info(this.project.git.lastTagHash());
|
|
534
|
+
this._exit();
|
|
535
|
+
};
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region commands / last tag
|
|
538
|
+
BaseCommandLine.prototype.LAST_TAG = function () {
|
|
539
|
+
var proj = this.project;
|
|
540
|
+
index_1.Helpers.info("\n\n last tag: ".concat(proj.git.lastTagVersionName, "\n last tag hash: ").concat(proj.git.lastTagHash(), "\n\n "));
|
|
541
|
+
this._exit();
|
|
542
|
+
};
|
|
543
|
+
//#endregion
|
|
544
|
+
//#region commands / check tag exists
|
|
545
|
+
BaseCommandLine.prototype.CHECK_TAG_EXISTS = function () {
|
|
546
|
+
index_1.Helpers.info("tag \"".concat(this.firstArg, "\" exits = ").concat(index_1.Helpers.git.checkTagExists(this.firstArg), " "));
|
|
547
|
+
this._exit();
|
|
548
|
+
};
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region commands / lint
|
|
551
|
+
/**
|
|
552
|
+
* TODO move somewhere
|
|
553
|
+
*/
|
|
554
|
+
BaseCommandLine.prototype.lint = function () {
|
|
555
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
556
|
+
return tslib_1.__generator(this, function (_a) {
|
|
557
|
+
switch (_a.label) {
|
|
558
|
+
case 0: return [4 /*yield*/, this.project.lint()];
|
|
559
|
+
case 1:
|
|
560
|
+
_a.sent();
|
|
561
|
+
return [2 /*return*/];
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
};
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region commands / version
|
|
568
|
+
/**
|
|
569
|
+
* TODO move somewhere
|
|
570
|
+
*/
|
|
571
|
+
BaseCommandLine.prototype.version = function () {
|
|
572
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
573
|
+
return tslib_1.__generator(this, function (_a) {
|
|
574
|
+
console.log(this.project.version);
|
|
575
|
+
return [2 /*return*/];
|
|
576
|
+
});
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region commands / init
|
|
581
|
+
/**
|
|
582
|
+
* TODO move somewhere
|
|
583
|
+
*/
|
|
584
|
+
BaseCommandLine.prototype.init = function () {
|
|
585
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
586
|
+
return tslib_1.__generator(this, function (_a) {
|
|
587
|
+
switch (_a.label) {
|
|
588
|
+
case 0: return [4 /*yield*/, this.project.init()];
|
|
589
|
+
case 1:
|
|
590
|
+
_a.sent();
|
|
591
|
+
return [2 /*return*/];
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
});
|
|
595
|
+
};
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region commands / struct
|
|
598
|
+
/**
|
|
599
|
+
* TODO move somewhere
|
|
600
|
+
*/
|
|
601
|
+
BaseCommandLine.prototype.struct = function () {
|
|
602
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
603
|
+
return tslib_1.__generator(this, function (_a) {
|
|
604
|
+
switch (_a.label) {
|
|
605
|
+
case 0: return [4 /*yield*/, this.project.struct()];
|
|
606
|
+
case 1:
|
|
607
|
+
_a.sent();
|
|
608
|
+
return [2 /*return*/];
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
});
|
|
612
|
+
};
|
|
613
|
+
//#endregion
|
|
614
|
+
//#region commands / info
|
|
615
|
+
/**
|
|
616
|
+
* TODO move somewhere
|
|
617
|
+
*/
|
|
618
|
+
BaseCommandLine.prototype.info = function () {
|
|
619
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
620
|
+
return tslib_1.__generator(this, function (_a) {
|
|
621
|
+
switch (_a.label) {
|
|
622
|
+
case 0: return [4 /*yield*/, this.project.info()];
|
|
623
|
+
case 1:
|
|
624
|
+
_a.sent();
|
|
625
|
+
return [2 /*return*/];
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
};
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region commands / branch name
|
|
632
|
+
BaseCommandLine.prototype.BRANCH_NAME = function () {
|
|
633
|
+
console.log("current branch name: \"".concat(index_1.Helpers.git.currentBranchName(process.cwd()), "\""));
|
|
634
|
+
this._exit();
|
|
635
|
+
};
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region commands / remotes
|
|
638
|
+
BaseCommandLine.prototype.REMOTES = function () {
|
|
639
|
+
var folders = index_1.Helpers.foldersFrom(this.project.location);
|
|
640
|
+
folders
|
|
641
|
+
.filter(function (c) { return !tnp_core_1.path.basename(c).startsWith('.'); })
|
|
642
|
+
.forEach(function (cwd) {
|
|
643
|
+
index_1.Helpers.run("git config --get remote.origin.url", { cwd: cwd }).sync();
|
|
644
|
+
});
|
|
645
|
+
this._exit();
|
|
646
|
+
};
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region filter all project branches by pattern
|
|
649
|
+
BaseCommandLine.prototype.__filterBranchesByPattern = function (branchPatternOrBranchName) {
|
|
650
|
+
return index_1.Helpers.arrays.uniqArray(this.project.git.getBranchesNamesBy(branchPatternOrBranchName).map(function (a) {
|
|
651
|
+
return a.replace("remotes/origin/", '');
|
|
652
|
+
}) || this.project.getMainBranches());
|
|
653
|
+
};
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region select branch from list of branches
|
|
656
|
+
BaseCommandLine.prototype.__selectBrach = function (branches) {
|
|
657
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
658
|
+
var childrenMsg;
|
|
659
|
+
return tslib_1.__generator(this, function (_a) {
|
|
660
|
+
switch (_a.label) {
|
|
661
|
+
case 0:
|
|
662
|
+
childrenMsg = this.project.children.length == 0 ? '(no children in project)' : '(with children)';
|
|
663
|
+
return [4 /*yield*/, index_1.Helpers.autocompleteAsk("Choose branch to reset in this project ".concat(childrenMsg, ":"), branches.map(function (b) {
|
|
664
|
+
return { name: b, value: b };
|
|
665
|
+
}))];
|
|
666
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
});
|
|
670
|
+
};
|
|
671
|
+
return BaseCommandLine;
|
|
672
|
+
}(command_line_feature_backend_1.CommandLineFeature));
|
|
673
|
+
exports.BaseCommandLine = BaseCommandLine;
|
|
674
|
+
//# sourceMappingURL=base-command-line.backend.js.map
|