tnp-helpers 18.0.6 → 18.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/browser/esm2022/lib/base/base-git.mjs +4 -4
- package/browser/esm2022/lib/base/base-library-build.mjs +96 -10
- package/browser/esm2022/lib/base/base-npm-helpers.mjs +3 -3
- package/browser/esm2022/lib/base/base-project-resolver.mjs +2 -2
- package/browser/esm2022/lib/base/base-project.mjs +1 -1
- package/browser/esm2022/lib/base/commit-data.mjs +2 -2
- package/browser/esm2022/lib/helpers/for-browser/helpers-browser.mjs +2 -2
- package/browser/esm2022/lib/helpers/helpers-strings.mjs +3 -3
- package/browser/esm2022/lib/helpers/helpers.mjs +6 -6
- package/browser/esm2022/lib/index.mjs +3 -3
- package/browser/esm2022/lib/models.mjs +1 -1
- package/browser/esm2022/lib/utils.mjs +141 -1
- package/browser/fesm2022/tnp-helpers.mjs +254 -28
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/base-git.d.ts +5 -5
- package/browser/lib/base/base-library-build.d.ts +21 -8
- package/browser/lib/base/base-npm-helpers.d.ts +5 -4
- package/browser/lib/base/base-project.d.ts +4 -3
- package/browser/lib/base/commit-data.d.ts +5 -5
- package/browser/lib/base/core-project.d.ts +2 -2
- package/browser/lib/helpers/helpers.d.ts +3 -3
- package/browser/lib/index.d.ts +2 -2
- package/browser/lib/models.d.ts +12 -1
- package/browser/lib/utils.d.ts +32 -0
- package/client/README.md +24 -24
- package/client/esm2022/lib/base/base-git.mjs +4 -4
- package/client/esm2022/lib/base/base-library-build.mjs +96 -10
- package/client/esm2022/lib/base/base-npm-helpers.mjs +3 -3
- package/client/esm2022/lib/base/base-project-resolver.mjs +2 -2
- package/client/esm2022/lib/base/base-project.mjs +1 -1
- package/client/esm2022/lib/base/commit-data.mjs +2 -2
- package/client/esm2022/lib/helpers/for-browser/helpers-browser.mjs +2 -2
- package/client/esm2022/lib/helpers/helpers-strings.mjs +3 -3
- package/client/esm2022/lib/helpers/helpers.mjs +6 -6
- package/client/esm2022/lib/index.mjs +3 -3
- package/client/esm2022/lib/models.mjs +1 -1
- package/client/esm2022/lib/utils.mjs +141 -1
- package/client/fesm2022/tnp-helpers.mjs +254 -28
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/base-git.d.ts +5 -5
- package/client/lib/base/base-library-build.d.ts +21 -8
- package/client/lib/base/base-npm-helpers.d.ts +5 -4
- package/client/lib/base/base-project.d.ts +4 -3
- package/client/lib/base/commit-data.d.ts +5 -5
- package/client/lib/base/core-project.d.ts +2 -2
- package/client/lib/helpers/helpers.d.ts +3 -3
- package/client/lib/index.d.ts +2 -2
- package/client/lib/models.d.ts +12 -1
- package/client/lib/utils.d.ts +32 -0
- package/lib/base/base-command-line.backend.js +1 -1
- package/lib/base/base-command-line.backend.js.map +1 -1
- package/lib/base/base-db.js +2 -2
- package/lib/base/base-db.js.map +1 -1
- package/lib/base/base-git.d.ts +5 -5
- package/lib/base/base-git.js +3 -3
- package/lib/base/base-git.js.map +1 -1
- package/lib/base/base-library-build.d.ts +23 -20
- package/lib/base/base-library-build.js +384 -281
- package/lib/base/base-library-build.js.map +1 -1
- package/lib/base/base-linked-projects.js +1 -1
- package/lib/base/base-linked-projects.js.map +1 -1
- package/lib/base/base-npm-helpers.d.ts +5 -4
- package/lib/base/base-npm-helpers.js +25 -25
- package/lib/base/base-npm-helpers.js.map +1 -1
- package/lib/base/base-project-resolver.js +4 -4
- package/lib/base/base-project-resolver.js.map +1 -1
- package/lib/base/base-project.d.ts +4 -3
- package/lib/base/base-project.js +6 -6
- package/lib/base/base-project.js.map +1 -1
- package/lib/base/base-start-config.backend.js +1 -1
- package/lib/base/base-start-config.backend.js.map +1 -1
- package/lib/base/command-line-feature.backend.js +1 -1
- package/lib/base/command-line-feature.backend.js.map +1 -1
- package/lib/base/commit-data.d.ts +5 -5
- package/lib/base/commit-data.js +1 -1
- package/lib/base/core-project.d.ts +2 -2
- package/lib/base/linked-project.js +1 -1
- package/lib/base/linked-project.js.map +1 -1
- package/lib/helpers/for-backend/helpers-console-gui.d.ts +6 -0
- package/lib/helpers/for-backend/helpers-console-gui.js +12 -4
- package/lib/helpers/for-backend/helpers-console-gui.js.map +1 -1
- package/lib/helpers/for-backend/helpers-file-folders.backend.d.ts +1 -1
- package/lib/helpers/for-backend/helpers-file-folders.backend.js +14 -14
- package/lib/helpers/for-backend/helpers-file-folders.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-git.backend.js +91 -76
- package/lib/helpers/for-backend/helpers-git.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-process.backend.d.ts +7 -0
- package/lib/helpers/for-backend/helpers-process.backend.js +13 -37
- package/lib/helpers/for-backend/helpers-process.backend.js.map +1 -1
- package/lib/helpers/for-browser/angular.helper.js +2 -2
- package/lib/helpers/for-browser/helpers-browser.js +1 -1
- package/lib/helpers/for-browser/helpers-browser.js.map +1 -1
- package/lib/helpers/helpers-strings.js +2 -2
- package/lib/helpers/helpers-strings.js.map +1 -1
- package/lib/helpers/helpers.d.ts +3 -3
- package/lib/helpers/helpers.js +28 -28
- package/lib/helpers/helpers.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/models.d.ts +12 -1
- package/lib/models.js.map +1 -1
- package/lib/old/base-component.js +2 -2
- package/lib/old/base-formly-component.js +2 -2
- package/lib/old/dual-component-ctrl.js +2 -2
- package/lib/utils.d.ts +32 -0
- package/lib/utils.js +113 -1
- package/lib/utils.js.map +1 -1
- package/lib/validators/validators-firedev.d.ts +1 -1
- package/lib/validators/validators-firedev.js +5 -5
- package/lib/validators/validators-firedev.js.map +1 -1
- package/package.json +5 -5
- package/src.d.ts +1 -1
- package/{firedev.jsonc → taon.jsonc} +48 -42
- package/tmp-environment.json +32 -37
- package/websql/README.md +24 -24
- package/websql/esm2022/lib/base/base-git.mjs +4 -4
- package/websql/esm2022/lib/base/base-library-build.mjs +96 -10
- package/websql/esm2022/lib/base/base-npm-helpers.mjs +3 -3
- package/websql/esm2022/lib/base/base-project-resolver.mjs +2 -2
- package/websql/esm2022/lib/base/base-project.mjs +1 -1
- package/websql/esm2022/lib/base/commit-data.mjs +2 -2
- package/websql/esm2022/lib/helpers/for-browser/helpers-browser.mjs +2 -2
- package/websql/esm2022/lib/helpers/helpers-strings.mjs +3 -3
- package/websql/esm2022/lib/helpers/helpers.mjs +6 -6
- package/websql/esm2022/lib/index.mjs +3 -3
- package/websql/esm2022/lib/models.mjs +1 -1
- package/websql/esm2022/lib/utils.mjs +141 -1
- package/websql/fesm2022/tnp-helpers.mjs +254 -28
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/base-git.d.ts +5 -5
- package/websql/lib/base/base-library-build.d.ts +21 -8
- package/websql/lib/base/base-npm-helpers.d.ts +5 -4
- package/websql/lib/base/base-project.d.ts +5 -8
- package/websql/lib/base/commit-data.d.ts +5 -5
- package/websql/lib/base/core-project.d.ts +2 -2
- package/websql/lib/helpers/helpers.d.ts +3 -3
- package/websql/lib/index.d.ts +2 -2
- package/websql/lib/models.d.ts +12 -1
- package/websql/lib/utils.d.ts +32 -0
|
@@ -24,7 +24,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region get last commit hash
|
|
26
26
|
HelpersGit.prototype.lastCommitHash = function (cwd) {
|
|
27
|
-
index_1.Helpers.log('[
|
|
27
|
+
index_1.Helpers.log('[taon-helpers][lastcommithash] ' + cwd, 1);
|
|
28
28
|
try {
|
|
29
29
|
var hash = this.isInsideGitRepo(cwd) &&
|
|
30
30
|
tnp_core_1.child_process
|
|
@@ -35,7 +35,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
37
|
index_1.Helpers.log(e, 1);
|
|
38
|
-
index_1.Helpers.log("[
|
|
38
|
+
index_1.Helpers.log("[taon-helpers][lastCommitHash] Not able to get last commit hash for repository in ".concat(cwd), 1);
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
41
|
};
|
|
@@ -101,7 +101,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
101
101
|
* @returns name of trag
|
|
102
102
|
*/
|
|
103
103
|
HelpersGit.prototype.lastTagNameForMajorVersion = function (cwd, majorVersion) {
|
|
104
|
-
index_1.Helpers.log('[
|
|
104
|
+
index_1.Helpers.log('[taon-helpers][lastTagNameForMajorVersion] ' +
|
|
105
105
|
cwd +
|
|
106
106
|
' major ver:' +
|
|
107
107
|
majorVersion);
|
|
@@ -188,14 +188,14 @@ var HelpersGit = /** @class */ (function () {
|
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
catch (error) {
|
|
191
|
-
index_1.Helpers.error('[
|
|
191
|
+
index_1.Helpers.error('[taon-helpers][git] Error:' + error.message, false, true);
|
|
192
192
|
}
|
|
193
193
|
//#endregion
|
|
194
194
|
};
|
|
195
195
|
//#endregion
|
|
196
196
|
//#region get last tag hash
|
|
197
197
|
HelpersGit.prototype.lastTagHash = function (cwd) {
|
|
198
|
-
index_1.Helpers.log('[
|
|
198
|
+
index_1.Helpers.log('[taon-helpers][lastTagHash] ' + cwd, 1);
|
|
199
199
|
try {
|
|
200
200
|
var tag = index_1.Helpers.git.lastTagVersionName(cwd);
|
|
201
201
|
if (!tag) {
|
|
@@ -209,14 +209,14 @@ var HelpersGit = /** @class */ (function () {
|
|
|
209
209
|
}
|
|
210
210
|
catch (e) {
|
|
211
211
|
index_1.Helpers.log(e, 1);
|
|
212
|
-
index_1.Helpers.log("[
|
|
212
|
+
index_1.Helpers.log("[taon-helpers][lastCommitHash] Not able to get last commit hash for repository in ".concat(cwd), 1);
|
|
213
213
|
return null;
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
//#endregion
|
|
217
217
|
//#region get last commit date
|
|
218
218
|
HelpersGit.prototype.lastCommitDate = function (cwd) {
|
|
219
|
-
index_1.Helpers.log('[
|
|
219
|
+
index_1.Helpers.log('[taon-helpers][lastCommitDate] ' + cwd, 1);
|
|
220
220
|
try {
|
|
221
221
|
var unixTimestamp = this.isInsideGitRepo(cwd) &&
|
|
222
222
|
tnp_core_1.child_process
|
|
@@ -227,7 +227,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
227
227
|
}
|
|
228
228
|
catch (e) {
|
|
229
229
|
index_1.Helpers.log(e, 1);
|
|
230
|
-
index_1.Helpers.log("[
|
|
230
|
+
index_1.Helpers.log("[taon-helpers][lastCommitDate] Cannot counts commits in branch in: ".concat(cwd), 1);
|
|
231
231
|
return null;
|
|
232
232
|
}
|
|
233
233
|
};
|
|
@@ -249,7 +249,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
249
249
|
case 1:
|
|
250
250
|
log = _b.sent();
|
|
251
251
|
if (log.total === 0) {
|
|
252
|
-
console.warn("[
|
|
252
|
+
console.warn("[taon-helpers][getCommitMessageByHash] No commit found with hash \"".concat(hash, "\""));
|
|
253
253
|
return [2 /*return*/, ''];
|
|
254
254
|
}
|
|
255
255
|
return [2 /*return*/, ((_a = log.all.find(function (f) { return f.hash === hash; })) === null || _a === void 0 ? void 0 : _a.message) || ''];
|
|
@@ -282,7 +282,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
282
282
|
log = _a.sent();
|
|
283
283
|
commitMessages = log.all;
|
|
284
284
|
if (index < 0 || index >= commitMessages.length) {
|
|
285
|
-
console.warn("[
|
|
285
|
+
console.warn("[taon-helpers][getCommitMessageByIndex] Index (".concat(index, ") out of bounds"));
|
|
286
286
|
return [2 /*return*/, ''];
|
|
287
287
|
}
|
|
288
288
|
// Return the commit message by index
|
|
@@ -316,7 +316,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
316
316
|
log = _a.sent();
|
|
317
317
|
commits = log.all;
|
|
318
318
|
if (index < 0 || index >= commits.length) {
|
|
319
|
-
console.warn("[
|
|
319
|
+
console.warn("[taon-helpers][getCommitMessageByIndex] Index (".concat(index, ") out of bounds"));
|
|
320
320
|
return [2 /*return*/, ''];
|
|
321
321
|
}
|
|
322
322
|
// Return the commit message by index
|
|
@@ -333,7 +333,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
333
333
|
//#endregion
|
|
334
334
|
//#region get last commit date
|
|
335
335
|
HelpersGit.prototype.lastCommitMessage = function (cwd) {
|
|
336
|
-
index_1.Helpers.log('[
|
|
336
|
+
index_1.Helpers.log('[taon-helpers][lastCommitMessage] ' + cwd, 1);
|
|
337
337
|
try {
|
|
338
338
|
var unixTimestamp = tnp_core_1.child_process
|
|
339
339
|
.execSync("git log -1 --pretty=%B", { cwd: cwd })
|
|
@@ -343,7 +343,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
343
343
|
}
|
|
344
344
|
catch (e) {
|
|
345
345
|
index_1.Helpers.log(e, 1);
|
|
346
|
-
index_1.Helpers.log("[
|
|
346
|
+
index_1.Helpers.log("[taon-helpers]lastCommitMessage] Cannot display last commit message in branch in: ".concat(cwd), 1);
|
|
347
347
|
return null;
|
|
348
348
|
}
|
|
349
349
|
};
|
|
@@ -362,12 +362,12 @@ var HelpersGit = /** @class */ (function () {
|
|
|
362
362
|
//#endregion
|
|
363
363
|
//#region get number of commit in repository
|
|
364
364
|
HelpersGit.prototype.countCommits = function (cwd) {
|
|
365
|
-
index_1.Helpers.log('[
|
|
365
|
+
index_1.Helpers.log('[taon-helpers][countCommits] ' + cwd, 1);
|
|
366
366
|
if (!index_1.Helpers.git.hasAnyCommits(cwd)) {
|
|
367
367
|
return 0;
|
|
368
368
|
}
|
|
369
369
|
try {
|
|
370
|
-
index_1.Helpers.log('[
|
|
370
|
+
index_1.Helpers.log('[taon-helpers] RUNNING COUNT COMMITS');
|
|
371
371
|
// git rev-parse HEAD &> /dev/null check if any commits
|
|
372
372
|
var currentLocalBranch = this.currentBranchName(cwd);
|
|
373
373
|
var value = Number(this.isInsideGitRepo(cwd) &&
|
|
@@ -376,14 +376,14 @@ var HelpersGit = /** @class */ (function () {
|
|
|
376
376
|
}
|
|
377
377
|
catch (e) {
|
|
378
378
|
index_1.Helpers.log(e, 1);
|
|
379
|
-
index_1.Helpers.log("[
|
|
379
|
+
index_1.Helpers.log("[taon-helpers][countCommits] Cannot counts commits in branch in: ".concat(cwd), 1);
|
|
380
380
|
return 0;
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
383
|
//#endregion
|
|
384
384
|
//#region get number of commit in repository
|
|
385
385
|
HelpersGit.prototype.hasAnyCommits = function (cwd) {
|
|
386
|
-
// con.log('[
|
|
386
|
+
// con.log('[taon-helpers][hasAnyCommits] ' + cwd, 1)
|
|
387
387
|
try {
|
|
388
388
|
if (process.platform === 'win32') {
|
|
389
389
|
index_1.Helpers.run('git rev-parse HEAD', {
|
|
@@ -408,7 +408,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
408
408
|
//#endregion
|
|
409
409
|
//#region get number of commit in repository
|
|
410
410
|
HelpersGit.prototype.isInMergeProcess = function (cwd) {
|
|
411
|
-
index_1.Helpers.log('[
|
|
411
|
+
index_1.Helpers.log('[taon-helpers][hasAnyCommits] ' + cwd, 1);
|
|
412
412
|
try {
|
|
413
413
|
var message = (tnp_core_1.child_process.execSync("git status", { cwd: cwd }) || '')
|
|
414
414
|
.toString()
|
|
@@ -422,7 +422,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
422
422
|
//#endregion
|
|
423
423
|
//#region get branches names
|
|
424
424
|
HelpersGit.prototype.getBranchesNames = function (cwd, pattern) {
|
|
425
|
-
index_1.Helpers.log('[
|
|
425
|
+
index_1.Helpers.log('[taon-helpers][getBranchesNames] ' + cwd, 1);
|
|
426
426
|
try {
|
|
427
427
|
var branchPattern_1 = pattern;
|
|
428
428
|
if (tnp_core_1._.isString(pattern)) {
|
|
@@ -458,7 +458,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
458
458
|
}
|
|
459
459
|
catch (e) {
|
|
460
460
|
index_1.Helpers.log(e);
|
|
461
|
-
index_1.Helpers.log('[
|
|
461
|
+
index_1.Helpers.log('[taon-helpers][getBranchesNames] not able to get branches names');
|
|
462
462
|
return [];
|
|
463
463
|
}
|
|
464
464
|
};
|
|
@@ -488,7 +488,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
488
488
|
//#endregion
|
|
489
489
|
//#region get current branch name
|
|
490
490
|
HelpersGit.prototype.currentBranchName = function (cwd) {
|
|
491
|
-
index_1.Helpers.log('[
|
|
491
|
+
index_1.Helpers.log('[taon-helpers][currentBranchName] ' + cwd, 1);
|
|
492
492
|
try {
|
|
493
493
|
var branchName = tnp_core_1.child_process
|
|
494
494
|
.execSync("git branch | sed -n '/* /s///p'", { cwd: cwd })
|
|
@@ -509,7 +509,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
509
509
|
//#endregion
|
|
510
510
|
//#region commit
|
|
511
511
|
HelpersGit.prototype.commit = function (cwd, commitMessage) {
|
|
512
|
-
index_1.Helpers.log('[
|
|
512
|
+
index_1.Helpers.log('[taon-helpers][commit] ' + cwd, 1);
|
|
513
513
|
if (!tnp_core_1._.isString(commitMessage)) {
|
|
514
514
|
commitMessage = 'update';
|
|
515
515
|
}
|
|
@@ -536,7 +536,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
536
536
|
commitMessage = commitMessage.replace(/\"\"/g, "\"");
|
|
537
537
|
commitMessage = commitMessage.replace(/\'\'/g, "'");
|
|
538
538
|
try {
|
|
539
|
-
index_1.Helpers.info("[
|
|
539
|
+
index_1.Helpers.info("[taon-helpers][git][commit] trying to commit what it with argument:\n \"".concat(commitMessage, "\"\n location: ").concat(cwd, "\n "));
|
|
540
540
|
var commandToExecute = "git commit --no-verify ".concat(commitMessage);
|
|
541
541
|
// Helpers.info(`COMMITING WITH COMMAND: ${commandToExecute}`);
|
|
542
542
|
// process.exit(0)
|
|
@@ -544,7 +544,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
544
544
|
}
|
|
545
545
|
catch (error) {
|
|
546
546
|
index_1.Helpers.log(error);
|
|
547
|
-
index_1.Helpers.log("[
|
|
547
|
+
index_1.Helpers.log("[taon-helpers][git][commit] not able to commit with command: ".concat(commandToExecute));
|
|
548
548
|
}
|
|
549
549
|
};
|
|
550
550
|
//#endregion
|
|
@@ -557,7 +557,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
557
557
|
*/
|
|
558
558
|
HelpersGit.prototype.getOriginURL = function (cwd, differentOriginName) {
|
|
559
559
|
if (differentOriginName === void 0) { differentOriginName = ''; }
|
|
560
|
-
index_1.Helpers.log('[
|
|
560
|
+
index_1.Helpers.log('[taon-helpers][getOriginURL] ' + cwd, 1);
|
|
561
561
|
if (!this.isInsideGitRepo(cwd)) {
|
|
562
562
|
return;
|
|
563
563
|
}
|
|
@@ -621,11 +621,11 @@ var HelpersGit = /** @class */ (function () {
|
|
|
621
621
|
//#region is git root
|
|
622
622
|
HelpersGit.prototype.isGitRoot = function (cwd) {
|
|
623
623
|
var _a, _b;
|
|
624
|
-
index_1.Helpers.log('[
|
|
624
|
+
index_1.Helpers.log('[taon-helpers][isGitRoot] ' + cwd, 1);
|
|
625
625
|
if (!tnp_core_1.fse.existsSync((0, tnp_core_1.crossPlatformPath)([cwd, '.git']))) {
|
|
626
626
|
return false;
|
|
627
627
|
}
|
|
628
|
-
index_1.Helpers.log('[
|
|
628
|
+
index_1.Helpers.log('[taon-helpers][isGitRepo] ' + cwd, 1);
|
|
629
629
|
try {
|
|
630
630
|
var rootGitCwd = (_b = (_a = index_1.Helpers.run('git rev-parse --show-toplevel', {
|
|
631
631
|
biggerBuffer: false,
|
|
@@ -646,7 +646,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
646
646
|
//#endregion
|
|
647
647
|
//#region is git repo
|
|
648
648
|
HelpersGit.prototype.isInsideGitRepo = function (cwd) {
|
|
649
|
-
index_1.Helpers.log('[
|
|
649
|
+
index_1.Helpers.log('[taon-helpers][isGitRepo] ' + cwd, 1);
|
|
650
650
|
if (!index_1.Helpers.git.hasAnyCommits(cwd)) {
|
|
651
651
|
return false;
|
|
652
652
|
}
|
|
@@ -689,7 +689,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
689
689
|
//#endregion
|
|
690
690
|
//#region pull
|
|
691
691
|
HelpersGit.prototype._pull = function (cwd, options) {
|
|
692
|
-
var _a = options || {}, branchName = _a.branchName, defaultHardResetCommits = _a.defaultHardResetCommits
|
|
692
|
+
var _a = options || {}, branchName = _a.branchName, defaultHardResetCommits = _a.defaultHardResetCommits;
|
|
693
693
|
if (tnp_core_1._.isNumber(defaultHardResetCommits)) {
|
|
694
694
|
this.resetHard(cwd, { HEAD: defaultHardResetCommits });
|
|
695
695
|
}
|
|
@@ -702,14 +702,13 @@ var HelpersGit = /** @class */ (function () {
|
|
|
702
702
|
};
|
|
703
703
|
HelpersGit.prototype.pullCurrentBranch = function (cwd, options) {
|
|
704
704
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
705
|
-
var askToRetry, currentLocalBranch, e_1;
|
|
706
|
-
var _this = this;
|
|
705
|
+
var askToRetry, currentLocalBranch, e_1, pullOptions, whatToDo;
|
|
707
706
|
return tslib_1.__generator(this, function (_a) {
|
|
708
707
|
switch (_a.label) {
|
|
709
708
|
case 0:
|
|
710
709
|
options = options || {};
|
|
711
710
|
askToRetry = (options || {}).askToRetry;
|
|
712
|
-
index_1.Helpers.log('[
|
|
711
|
+
index_1.Helpers.log('[taon-helpers][pullCurrentBranch] ' + cwd, 1);
|
|
713
712
|
if (global['tnpNonInteractive']) {
|
|
714
713
|
askToRetry = false;
|
|
715
714
|
}
|
|
@@ -719,39 +718,52 @@ var HelpersGit = /** @class */ (function () {
|
|
|
719
718
|
"remote origin url.... in folder ".concat(tnp_core_1.path.basename(cwd)));
|
|
720
719
|
return [2 /*return*/];
|
|
721
720
|
}
|
|
722
|
-
index_1.Helpers.info("[
|
|
721
|
+
index_1.Helpers.info("[taon-helpers][".concat((0, tnp_core_1.dateformat)(new Date(), 'dd-mm-yyyy HH:MM:ss'), "] Pulling git changes in \"").concat(cwd, "\", origin=").concat(index_1.Helpers.git.getOriginURL(cwd), " "));
|
|
723
722
|
_a.label = 1;
|
|
724
723
|
case 1:
|
|
725
|
-
|
|
724
|
+
if (!true) return [3 /*break*/, 7];
|
|
725
|
+
_a.label = 2;
|
|
726
|
+
case 2:
|
|
727
|
+
_a.trys.push([2, 3, , 6]);
|
|
726
728
|
currentLocalBranch = tnp_core_1.child_process
|
|
727
729
|
.execSync("git branch | sed -n '/* /s///p'", { cwd: cwd })
|
|
728
730
|
.toString()
|
|
729
731
|
.trim();
|
|
730
732
|
index_1.Helpers.git._pull(cwd, tslib_1.__assign(tslib_1.__assign({}, options), { branchName: currentLocalBranch }));
|
|
731
|
-
index_1.Helpers.info("[
|
|
732
|
-
return [3 /*break*/,
|
|
733
|
-
case
|
|
733
|
+
index_1.Helpers.info("[taon-helpers] Branch \"".concat(currentLocalBranch, "\" updated successfully in ").concat(tnp_core_1.path.basename(cwd)));
|
|
734
|
+
return [3 /*break*/, 7];
|
|
735
|
+
case 3:
|
|
734
736
|
e_1 = _a.sent();
|
|
735
737
|
// console.log(e)
|
|
736
|
-
index_1.Helpers.error("[
|
|
737
|
-
if (!askToRetry) return [3 /*break*/,
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
}
|
|
748
|
-
|
|
738
|
+
index_1.Helpers.error("[taon-helpers] Cannot update current branch in: ".concat(cwd), askToRetry, true);
|
|
739
|
+
if (!askToRetry) return [3 /*break*/, 5];
|
|
740
|
+
pullOptions = {
|
|
741
|
+
again: {
|
|
742
|
+
name: 'Try pull again',
|
|
743
|
+
},
|
|
744
|
+
skip: {
|
|
745
|
+
name: 'Skip pulling',
|
|
746
|
+
},
|
|
747
|
+
exit: {
|
|
748
|
+
name: 'Exit process',
|
|
749
|
+
},
|
|
750
|
+
};
|
|
751
|
+
return [4 /*yield*/, index_1.UtilsTerminal.select({
|
|
752
|
+
question: 'What to do ?',
|
|
753
|
+
choices: pullOptions,
|
|
749
754
|
})];
|
|
750
|
-
case
|
|
751
|
-
_a.sent();
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
+
case 4:
|
|
756
|
+
whatToDo = _a.sent();
|
|
757
|
+
if (whatToDo === 'skip') {
|
|
758
|
+
return [3 /*break*/, 7];
|
|
759
|
+
}
|
|
760
|
+
if (whatToDo === 'exit') {
|
|
761
|
+
process.exit(0);
|
|
762
|
+
}
|
|
763
|
+
_a.label = 5;
|
|
764
|
+
case 5: return [3 /*break*/, 6];
|
|
765
|
+
case 6: return [3 /*break*/, 1];
|
|
766
|
+
case 7:
|
|
755
767
|
index_1.Helpers.info("[".concat((0, tnp_core_1.dateformat)(new Date(), 'dd-mm-yyyy HH:MM:ss'), "] DONE PULLING"));
|
|
756
768
|
return [2 /*return*/];
|
|
757
769
|
}
|
|
@@ -807,7 +819,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
807
819
|
}
|
|
808
820
|
_b.label = 2;
|
|
809
821
|
case 2:
|
|
810
|
-
index_1.Helpers.log('[
|
|
822
|
+
index_1.Helpers.log('[taon-helpers][pushCurrentBranch] ' + cwd, 1);
|
|
811
823
|
currentBranchName = index_1.Helpers.git.currentBranchName(cwd);
|
|
812
824
|
_b.label = 3;
|
|
813
825
|
case 3:
|
|
@@ -825,7 +837,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
825
837
|
return [3 /*break*/, 8];
|
|
826
838
|
case 5:
|
|
827
839
|
err_1 = _b.sent();
|
|
828
|
-
index_1.Helpers.error("[
|
|
840
|
+
index_1.Helpers.error("[taon-helpers] Not able to push branch ".concat(currentBranchName, " in (origin=").concat(origin, "):\n ").concat(cwd), true, true);
|
|
829
841
|
if (!askToRetry) {
|
|
830
842
|
return [2 /*return*/];
|
|
831
843
|
}
|
|
@@ -840,7 +852,10 @@ var HelpersGit = /** @class */ (function () {
|
|
|
840
852
|
name: 'Exit process',
|
|
841
853
|
},
|
|
842
854
|
};
|
|
843
|
-
return [4 /*yield*/, index_1.
|
|
855
|
+
return [4 /*yield*/, index_1.UtilsTerminal.select({
|
|
856
|
+
question: 'What to do ?',
|
|
857
|
+
choices: pushOptions,
|
|
858
|
+
})];
|
|
844
859
|
case 6:
|
|
845
860
|
whatToDo = _b.sent();
|
|
846
861
|
if (whatToDo === 'exit') {
|
|
@@ -1016,16 +1031,16 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1016
1031
|
index_1.Helpers.log('[clone] ' + cwd, 1);
|
|
1017
1032
|
// const ALWAYS_HTTPS = true;
|
|
1018
1033
|
if (!url) {
|
|
1019
|
-
index_1.Helpers.error("[
|
|
1034
|
+
index_1.Helpers.error("[taon-helpers] no url provided for cloning");
|
|
1020
1035
|
}
|
|
1021
1036
|
if (url.split(' ').length > 2) {
|
|
1022
1037
|
// const [rUrl, rDest] = url.split(' ');
|
|
1023
|
-
index_1.Helpers.error("[
|
|
1038
|
+
index_1.Helpers.error("[taon-helpers]incorrect clone url \"".concat(url, "\""));
|
|
1024
1039
|
}
|
|
1025
1040
|
if (url.split(' ').length === 2) {
|
|
1026
1041
|
_c = tslib_1.__read(url.split(' '), 2), rUrl = _c[0], rDest = _c[1];
|
|
1027
1042
|
if (destinationFolderName) {
|
|
1028
|
-
index_1.Helpers.error("[
|
|
1043
|
+
index_1.Helpers.error("[taon-helpers] wrong cloning argument\n\n url = \"".concat(url, "\"\n destinationFolderName = \"").concat(destinationFolderName, "\"\n\n cant use both at the same time\n "));
|
|
1029
1044
|
}
|
|
1030
1045
|
else {
|
|
1031
1046
|
destinationFolderName = rDest;
|
|
@@ -1047,10 +1062,10 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1047
1062
|
}
|
|
1048
1063
|
else if (index_1.Helpers.exists(cloneFolderPath) &&
|
|
1049
1064
|
index_1.Helpers.exists(tnp_core_1.path.join(cloneFolderPath, '.git'))) {
|
|
1050
|
-
index_1.Helpers.warn("[
|
|
1065
|
+
index_1.Helpers.warn("[taon-helpers] Already cloned ".concat(tnp_core_1.path.basename(cloneFolderPath), "..."));
|
|
1051
1066
|
return [2 /*return*/, cloneFolderPath];
|
|
1052
1067
|
}
|
|
1053
|
-
commnad =
|
|
1068
|
+
commnad = url.startsWith("https://") || url.startsWith("http://")
|
|
1054
1069
|
? "git -c http.sslVerify=false clone ".concat(url, " ").concat(tnp_core_1.path.basename(cloneFolderPath))
|
|
1055
1070
|
: "git clone ".concat(url, " ").concat(tnp_core_1.path.basename(cloneFolderPath));
|
|
1056
1071
|
index_1.Helpers.info("\n\n Cloning:\n ".concat(commnad, "\n\n "));
|
|
@@ -1067,10 +1082,10 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1067
1082
|
case 3:
|
|
1068
1083
|
error_4 = _g.sent();
|
|
1069
1084
|
if (((_e = (_d = error_4 === null || error_4 === void 0 ? void 0 : error_4.stderr) === null || _d === void 0 ? void 0 : _d.toString()) === null || _e === void 0 ? void 0 : _e.search('remote: Not Found')) !== -1) {
|
|
1070
|
-
index_1.Helpers.error("[
|
|
1085
|
+
index_1.Helpers.error("[taon-helpers][git] Project not found :".concat(url), true, true);
|
|
1071
1086
|
}
|
|
1072
1087
|
else {
|
|
1073
|
-
index_1.Helpers.error("[
|
|
1088
|
+
index_1.Helpers.error("[taon-helpers] Can't clone from url: ".concat(tnp_cli_1.CLI.chalk.bold(url), ".."), true, true);
|
|
1074
1089
|
}
|
|
1075
1090
|
cloneLinkOpt = {
|
|
1076
1091
|
again: {
|
|
@@ -1105,14 +1120,14 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1105
1120
|
//#endregion
|
|
1106
1121
|
//#region check if there are some uncommited changes
|
|
1107
1122
|
HelpersGit.prototype.checkIfthereAreSomeUncommitedChange = function (cwd) {
|
|
1108
|
-
index_1.Helpers.log('[
|
|
1123
|
+
index_1.Helpers.log('[taon-helpers][checkIfthereAreSomeUncommitedChange] ' + cwd, 1);
|
|
1109
1124
|
return index_1.Helpers.git.thereAreSomeUncommitedChangeExcept([], cwd);
|
|
1110
1125
|
};
|
|
1111
1126
|
//#endregion
|
|
1112
1127
|
//#region check if there are some uncommited changes except
|
|
1113
1128
|
HelpersGit.prototype.thereAreSomeUncommitedChangeExcept = function (filesList, cwd) {
|
|
1114
1129
|
if (filesList === void 0) { filesList = []; }
|
|
1115
|
-
index_1.Helpers.log('[
|
|
1130
|
+
index_1.Helpers.log('[taon-helpers][thereAreSomeUncommitedChangeExcept] ' + cwd, 1);
|
|
1116
1131
|
filesList = filesList.map(function (f) { return (0, tnp_core_1.crossPlatformPath)(f); });
|
|
1117
1132
|
try {
|
|
1118
1133
|
var res = index_1.Helpers.run("git ls-files --deleted --modified --others --exclude-standard", { output: false, cwd: cwd })
|
|
@@ -1134,7 +1149,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1134
1149
|
//#endregion
|
|
1135
1150
|
//#region check if there are some uncommited changes except
|
|
1136
1151
|
HelpersGit.prototype.uncommitedFiles = function (cwd) {
|
|
1137
|
-
index_1.Helpers.log('[
|
|
1152
|
+
index_1.Helpers.log('[taon-helpers][thereAreSomeUncommitedChangeExcept] ' + cwd, 1);
|
|
1138
1153
|
try {
|
|
1139
1154
|
var res = index_1.Helpers.run("git ls-files --deleted --modified --others --exclude-standard", { output: false, cwd: cwd })
|
|
1140
1155
|
.sync()
|
|
@@ -1155,16 +1170,16 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1155
1170
|
//#endregion
|
|
1156
1171
|
//#region restore last version
|
|
1157
1172
|
HelpersGit.prototype.restoreLastVersion = function (cwd, relativeFilePath) {
|
|
1158
|
-
index_1.Helpers.log('[
|
|
1173
|
+
index_1.Helpers.log('[taon-helpers][restoreLastVersion] ' + cwd, 1);
|
|
1159
1174
|
if (!index_1.Helpers.exists([cwd, relativeFilePath])) {
|
|
1160
1175
|
return;
|
|
1161
1176
|
}
|
|
1162
1177
|
try {
|
|
1163
|
-
index_1.Helpers.log("[
|
|
1178
|
+
index_1.Helpers.log("[taon-helpers][git] restoring last verion of file ".concat(tnp_core_1.path.basename(cwd), "/").concat(relativeFilePath));
|
|
1164
1179
|
index_1.Helpers.run("git checkout -- ".concat(relativeFilePath), { cwd: cwd }).sync();
|
|
1165
1180
|
}
|
|
1166
1181
|
catch (error) {
|
|
1167
|
-
index_1.Helpers.warn("[
|
|
1182
|
+
index_1.Helpers.warn("[taon-helpers][git] Not able to resotre last version of file ".concat(relativeFilePath));
|
|
1168
1183
|
}
|
|
1169
1184
|
};
|
|
1170
1185
|
//#endregion
|
|
@@ -1174,13 +1189,13 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1174
1189
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1175
1190
|
relativePathes[_i - 1] = arguments[_i];
|
|
1176
1191
|
}
|
|
1177
|
-
index_1.Helpers.log('[
|
|
1192
|
+
index_1.Helpers.log('[taon-helpers][resetFiles] ' + cwd, 1);
|
|
1178
1193
|
relativePathes.forEach(function (p) {
|
|
1179
1194
|
try {
|
|
1180
1195
|
index_1.Helpers.run("git checkout HEAD -- ".concat(p), { cwd: cwd }).sync();
|
|
1181
1196
|
}
|
|
1182
1197
|
catch (err) {
|
|
1183
|
-
index_1.Helpers.error("[
|
|
1198
|
+
index_1.Helpers.error("[taon-helpers][git] Not able to reset files: ".concat(p, " inside project ").concat(tnp_core_1.path.basename(cwd), "."), true, true);
|
|
1184
1199
|
}
|
|
1185
1200
|
});
|
|
1186
1201
|
};
|
|
@@ -1222,7 +1237,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1222
1237
|
var httpsPattern = /^https:\/\/(.+?)\/(.+?\/.+?)(\.git)?$/;
|
|
1223
1238
|
var match = originHttp.match(httpsPattern);
|
|
1224
1239
|
if (originHttp === 'undefined' || tnp_core_1._.isNil(originHttp)) {
|
|
1225
|
-
index_1.Helpers.error('[
|
|
1240
|
+
index_1.Helpers.error('[taon-helpers][originHttpToSsh] Origin URL is not defined');
|
|
1226
1241
|
return originHttp;
|
|
1227
1242
|
}
|
|
1228
1243
|
if (!match) {
|
|
@@ -1272,7 +1287,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1272
1287
|
var sshPattern = /^git@(.+?):(.+?\/.+?)(\.git)?$/;
|
|
1273
1288
|
var match = originSsh.match(sshPattern);
|
|
1274
1289
|
if (originSsh === 'undefined' || tnp_core_1._.isNil(originSsh)) {
|
|
1275
|
-
index_1.Helpers.error('[
|
|
1290
|
+
index_1.Helpers.error('[taon-helpers][originSshToHttp] Origin URL is not defined');
|
|
1276
1291
|
return originSsh;
|
|
1277
1292
|
}
|
|
1278
1293
|
if (!match) {
|
|
@@ -1371,7 +1386,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1371
1386
|
case 1:
|
|
1372
1387
|
log = _a.sent();
|
|
1373
1388
|
if (index >= log.total) {
|
|
1374
|
-
console.warn('[
|
|
1389
|
+
console.warn('[taon-helpers][getChangedFilesInCommitByIndex] Index out of range');
|
|
1375
1390
|
return [2 /*return*/, []];
|
|
1376
1391
|
}
|
|
1377
1392
|
hash = log.all[index].hash;
|