tnp-helpers 16.100.25 → 16.100.31

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.
Files changed (65) hide show
  1. package/assets/shared/shared_folder_info.txt +1 -1
  2. package/browser/esm2022/lib/base/base-project.mjs +20 -1
  3. package/browser/esm2022/lib/base/linked-project.mjs +1 -1
  4. package/browser/esm2022/lib/helpers/helpers.mjs +26 -2
  5. package/browser/esm2022/lib/index.mjs +1 -1
  6. package/browser/fesm2022/tnp-helpers.mjs +44 -1
  7. package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
  8. package/browser/lib/base/base-project.d.ts +13 -2
  9. package/browser/lib/base/core-project.d.ts +1 -1
  10. package/browser/lib/base/linked-project.d.ts +1 -0
  11. package/browser/lib/helpers/helpers.d.ts +3 -3
  12. package/browser/lib/index.d.ts +2 -1
  13. package/client/esm2022/lib/base/base-project.mjs +20 -1
  14. package/client/esm2022/lib/base/linked-project.mjs +1 -1
  15. package/client/esm2022/lib/helpers/helpers.mjs +26 -2
  16. package/client/esm2022/lib/index.mjs +1 -1
  17. package/client/fesm2022/tnp-helpers.mjs +44 -1
  18. package/client/fesm2022/tnp-helpers.mjs.map +1 -1
  19. package/client/lib/base/base-project.d.ts +13 -2
  20. package/client/lib/base/core-project.d.ts +1 -1
  21. package/client/lib/base/linked-project.d.ts +1 -0
  22. package/client/lib/helpers/helpers.d.ts +3 -3
  23. package/client/lib/index.d.ts +2 -1
  24. package/client/package.json +3 -3
  25. package/lib/base/base-command-line.backend.d.ts +8 -2
  26. package/lib/base/base-command-line.backend.js +154 -45
  27. package/lib/base/base-command-line.backend.js.map +1 -1
  28. package/lib/base/base-project.d.ts +58 -40
  29. package/lib/base/base-project.js +28 -12
  30. package/lib/base/base-project.js.map +1 -1
  31. package/lib/base/command-line-feature.backend.js +1 -0
  32. package/lib/base/command-line-feature.backend.js.map +1 -1
  33. package/lib/base/core-project.d.ts +1 -1
  34. package/lib/base/linked-project.d.ts +1 -0
  35. package/lib/base/linked-project.js.map +1 -1
  36. package/lib/helpers/for-backend/helpers-console-gui.d.ts +3 -3
  37. package/lib/helpers/for-backend/helpers-file-folders.backend.d.ts +1 -1
  38. package/lib/helpers/for-backend/helpers-git.backend.d.ts +4 -4
  39. package/lib/helpers/for-backend/helpers-git.backend.js +131 -71
  40. package/lib/helpers/for-backend/helpers-git.backend.js.map +1 -1
  41. package/lib/helpers/for-backend/helpers-path.backend.d.ts +2 -2
  42. package/lib/helpers/for-backend/helpers-process.backend.d.ts +1 -1
  43. package/lib/helpers/for-backend/helpers-system-terminal.backend.d.ts +1 -1
  44. package/lib/helpers/for-browser/angular.helper.js +3 -3
  45. package/lib/helpers/helpers.d.ts +4 -4
  46. package/lib/helpers/helpers.js +12 -9
  47. package/lib/helpers/helpers.js.map +1 -1
  48. package/lib/index.d.ts +2 -1
  49. package/lib/index.js.map +1 -1
  50. package/lib/old/base-component.js +3 -3
  51. package/lib/old/base-formly-component.js +3 -3
  52. package/lib/old/dual-component-ctrl.js +3 -3
  53. package/package.json +2 -2
  54. package/tmp-environment.json +7 -7
  55. package/websql/esm2022/lib/base/base-project.mjs +20 -1
  56. package/websql/esm2022/lib/base/linked-project.mjs +1 -1
  57. package/websql/esm2022/lib/helpers/helpers.mjs +26 -2
  58. package/websql/esm2022/lib/index.mjs +1 -1
  59. package/websql/fesm2022/tnp-helpers.mjs +44 -1
  60. package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
  61. package/websql/lib/base/base-project.d.ts +13 -2
  62. package/websql/lib/base/core-project.d.ts +1 -1
  63. package/websql/lib/base/linked-project.d.ts +1 -0
  64. package/websql/lib/helpers/helpers.d.ts +3 -3
  65. package/websql/lib/index.d.ts +2 -1
@@ -1,4 +1,5 @@
1
1
  // @ts-nocheck
2
+ /// <reference types="node" />
2
3
  import { CoreModels } from 'tnp-core/browser';
3
4
  import { CommitData, CoreProject, LinkedPorjectsConfig, LinkedProject, TypeOfCommit } from '../index';
4
5
  import { BaseProjectResolver } from './base-project-resolver';
@@ -141,7 +142,12 @@ export declare abstract class BaseProject<PROJCET extends BaseProject = any, TYP
141
142
  * @deprecated us execute instead
142
143
  * use output from or more preciese crafted api
143
144
  */
144
- run(command: string, options?: Omit<CoreModels.RunOptions, 'cwd'>): any;
145
+ run(command: string, options?: Omit<CoreModels.RunOptions, 'cwd'>): {
146
+ sync(): any;
147
+ async(detach?: boolean, mockFun?: (stdoutCallback: (dataForStdout: any) => any, stdErrcCallback: (dataForStder: any) => any, shouldProcesBeDead?: () => boolean) => number | Promise<number>): import("child_process").ChildProcess;
148
+ asyncAsPromise(): Promise<void>;
149
+ unitlOutputContains(stdoutMsg: string | string[], stderMsg?: string | string[], timeout?: number, stdoutOutputContainsCallback?: () => any): any;
150
+ };
145
151
  /**
146
152
  * same as run but async
147
153
  */
@@ -345,5 +351,10 @@ export declare abstract class BaseProject<PROJCET extends BaseProject = any, TYP
345
351
  getLibraryBuildComamnd(options?: {
346
352
  watch: boolean;
347
353
  }): string | undefined;
348
- startNpmTask(taskName: string, additionalArguments?: string | object): any;
354
+ startNpmTask(taskName: string, additionalArguments?: string | object): {
355
+ sync(): any;
356
+ async(detach?: boolean, mockFun?: (stdoutCallback: (dataForStdout: any) => any, stdErrcCallback: (dataForStder: any) => any, shouldProcesBeDead?: () => boolean) => number | Promise<number>): import("child_process").ChildProcess;
357
+ asyncAsPromise(): Promise<void>;
358
+ unitlOutputContains(stdoutMsg: string | string[], stderMsg?: string | string[], timeout?: number, stdoutOutputContainsCallback?: () => any): any;
359
+ };
349
360
  }
@@ -63,7 +63,7 @@ export declare class CoreProject<PROJECT extends BaseProject = BaseProject> {
63
63
  /**
64
64
  * core porject name from repo basename
65
65
  */
66
- get name(): any;
66
+ get name(): string;
67
67
  /**
68
68
  * main (default for reset) branch
69
69
  */
@@ -32,5 +32,6 @@ export declare class LinkedPorjectsConfig {
32
32
  static from(options: Partial<LinkedPorjectsConfig>): any;
33
33
  prefix?: string;
34
34
  skipRecrusivePush?: boolean;
35
+ resetOnlyChildren?: boolean;
35
36
  projects: LinkedProject[];
36
37
  }
@@ -29,12 +29,12 @@ export declare class HelpersFiredev extends CoreHelpers {
29
29
  browser: HelpersBrowser;
30
30
  ng: typeof HelpersAngular;
31
31
  private static _instance;
32
- static get Instance(): HelpersFiredev & CoreHelpers;
32
+ static get Instance(): HelpersFiredev;
33
33
  private constructor();
34
34
  CLIWRAP(f: Function, name: string): Function;
35
35
  ncc(pathToJsFile: string, outputFile: any): Promise<any>;
36
- uniqArray<T = any>(array: any[], uniqueProperty?: (keyof T)): T[];
37
- urlParse(portOrHost: (number | string | URL), forceDomain?: boolean): URL;
36
+ uniqArray<T = any>(array: any[], uniqueProperty?: keyof T): T[];
37
+ urlParse(portOrHost: number | string | URL, forceDomain?: boolean): URL;
38
38
  slash(pathFromWindowsOrUnixType: string): any;
39
39
  isElevated(): Promise<void>;
40
40
  /**
@@ -1,8 +1,9 @@
1
1
  // @ts-nocheck
2
2
  export * from './validators/validators';
3
3
  export { HelpersAngular } from './helpers/for-browser/angular.helper';
4
+ import { HelpersFiredev as Base } from './helpers/helpers';
4
5
  /**
5
6
  * Firedev helpers
6
- */ export declare const Helpers: any;
7
+ */ export declare const Helpers: Base;
7
8
  export * from './base';
8
9
  export * from './models';
@@ -43,7 +43,7 @@
43
43
  "firedev-helpers"
44
44
  ]
45
45
  },
46
- "version": "16.100.25",
46
+ "version": "16.100.31",
47
47
  "dependencies": {
48
48
  "json10-writer": "16.100.10",
49
49
  "lowdb": "7.0.1",
@@ -328,7 +328,7 @@
328
328
  "tnp-config": "16.100.10",
329
329
  "tnp-core": "16.100.23",
330
330
  "tnp-db": "16.100.9",
331
- "tnp-helpers": "16.100.23",
331
+ "tnp-helpers": "16.100.27",
332
332
  "ts-debug": "1.3.0",
333
333
  "ts-json-schema-generator": "2.1.1",
334
334
  "ts-loader": "2.3.1",
@@ -350,6 +350,6 @@
350
350
  "yup": "1.1.1",
351
351
  "zone.js": "~0.13.0"
352
352
  },
353
- "lastBuildTagHash": "16a0d11d7cfb7db8d93662d28ff060d7ac71002d",
353
+ "lastBuildTagHash": "3b07ed7b4c3d8f2b5461091854d0fefc414c75ad",
354
354
  "main": "dist/app.electron.js"
355
355
  }
@@ -1,9 +1,15 @@
1
- import { CommandLineFeature } from "./command-line-feature.backend";
2
- import { BaseProject } from "./base-project";
1
+ import { CommandLineFeature } from './command-line-feature.backend';
2
+ import { BaseProject } from './base-project';
3
3
  import { TypeOfCommit } from './commit-data';
4
4
  export declare class BaseCommandLine<PARAMS = any, PROJECT extends BaseProject<any, any> = BaseProject> extends CommandLineFeature<PARAMS, PROJECT> {
5
5
  _(): void;
6
+ prevennCwdIsNotProject(): void;
6
7
  setEditor(): Promise<void>;
8
+ /**
9
+ * quick git update push
10
+ */
11
+ update(): Promise<void>;
12
+ up(): Promise<void>;
7
13
  develop(): Promise<void>;
8
14
  dev(): Promise<void>;
9
15
  pull(): Promise<void>;
@@ -15,6 +15,11 @@ var BaseCommandLine = /** @class */ (function (_super) {
15
15
  BaseCommandLine.prototype._ = function () {
16
16
  index_1.Helpers.error('Please select git command');
17
17
  };
18
+ BaseCommandLine.prototype.prevennCwdIsNotProject = function () {
19
+ if (!this.project) {
20
+ index_1.Helpers.error('This is not a project folder', false, true);
21
+ }
22
+ };
18
23
  //#region commands / set editor
19
24
  BaseCommandLine.prototype.setEditor = function () {
20
25
  return tslib_1.__awaiter(this, void 0, void 0, function () {
@@ -30,6 +35,47 @@ var BaseCommandLine = /** @class */ (function (_super) {
30
35
  });
31
36
  };
32
37
  //#endregion
38
+ //#region commands / quick git update
39
+ /**
40
+ * quick git update push
41
+ */
42
+ BaseCommandLine.prototype.update = function () {
43
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
44
+ return tslib_1.__generator(this, function (_a) {
45
+ switch (_a.label) {
46
+ case 0:
47
+ this.prevennCwdIsNotProject();
48
+ index_1.Helpers.info('Updating & push project...');
49
+ try {
50
+ this.project.git.addAndCommit('chore: update');
51
+ }
52
+ catch (error) { }
53
+ return [4 /*yield*/, this.project.git.pushCurrentBranch({
54
+ askToRetry: true,
55
+ forcePushNoQuestion: true,
56
+ })];
57
+ case 1:
58
+ _a.sent();
59
+ index_1.Helpers.info('Done');
60
+ this._exit();
61
+ return [2 /*return*/];
62
+ }
63
+ });
64
+ });
65
+ };
66
+ BaseCommandLine.prototype.up = function () {
67
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
68
+ return tslib_1.__generator(this, function (_a) {
69
+ switch (_a.label) {
70
+ case 0: return [4 /*yield*/, this.update()];
71
+ case 1:
72
+ _a.sent();
73
+ return [2 /*return*/];
74
+ }
75
+ });
76
+ });
77
+ };
78
+ //#endregion
33
79
  //#region commands / develop
34
80
  BaseCommandLine.prototype.develop = function () {
35
81
  return tslib_1.__awaiter(this, void 0, void 0, function () {
@@ -62,7 +108,10 @@ var BaseCommandLine = /** @class */ (function (_super) {
62
108
  .filter(function (p) { return !!p; });
63
109
  index_1.Helpers.taskDone("found ".concat(founded.length, " projects..."));
64
110
  index_1.Helpers.taskStarted("searching for project...");
65
- results = index_1.Helpers.uniqArray(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(index_1.Helpers.arrays.fuzzy(this.args.join(' '), founded, function (p) { return p.name; }).results), false), tslib_1.__read(index_1.Helpers.arrays.fuzzy(this.args.join(' '), founded, function (p) { return p.basename; }).results), false), tslib_1.__read(index_1.Helpers.arrays.fuzzy(this.args.join(' '), founded, function (p) { return p.location; }).results), false), 'location').reverse();
111
+ results = index_1.Helpers.uniqArray(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(index_1.Helpers.arrays.fuzzy(this.args.join(' '), founded, function (p) { return p.name; })
112
+ .results), false), tslib_1.__read(index_1.Helpers.arrays.fuzzy(this.args.join(' '), founded, function (p) { return p.basename; })
113
+ .results), false), tslib_1.__read(index_1.Helpers.arrays.fuzzy(this.args.join(' '), founded, function (p) { return p.location; })
114
+ .results), false), 'location').reverse();
66
115
  index_1.Helpers.taskDone("found ".concat(results.length, " projects..."));
67
116
  openInEditor = function (proj) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
68
117
  var editor, embededProject, porjToOpen, locaitonFolderToOpen, error_1;
@@ -108,7 +157,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
108
157
  return [4 /*yield*/, index_1.Helpers.consoleGui.select('Select project to open', results.map(function (p) {
109
158
  return {
110
159
  name: p.genericName,
111
- value: p.location
160
+ value: p.location,
112
161
  };
113
162
  }), true)];
114
163
  case 5:
@@ -118,7 +167,6 @@ var BaseCommandLine = /** @class */ (function (_super) {
118
167
  _a.sent();
119
168
  _a.label = 7;
120
169
  case 7:
121
- ;
122
170
  this._exit();
123
171
  return [2 /*return*/];
124
172
  }
@@ -141,7 +189,9 @@ var BaseCommandLine = /** @class */ (function (_super) {
141
189
  return tslib_1.__awaiter(this, void 0, void 0, function () {
142
190
  return tslib_1.__generator(this, function (_a) {
143
191
  switch (_a.label) {
144
- case 0: return [4 /*yield*/, this.project.pullProcess()];
192
+ case 0:
193
+ this.prevennCwdIsNotProject();
194
+ return [4 /*yield*/, this.project.pullProcess()];
145
195
  case 1:
146
196
  _a.sent();
147
197
  this._exit();
@@ -153,20 +203,26 @@ var BaseCommandLine = /** @class */ (function (_super) {
153
203
  //#endregion
154
204
  //#region commands / reset
155
205
  BaseCommandLine.prototype.__resetInfo = function (branchToReset) {
156
- index_1.Helpers.info("\n\n YOU ARE RESETING EVERYTHING TO BRANCH: ".concat(tnp_core_1.chalk.bold(branchToReset), "\n\n- curret project (").concat(this.project.name, ")\n").concat((tnp_core_1._.isArray(this.project.children) && this.project.children.length > 0) ?
157
- "- modules:\n".concat(this.project.children.map(function (c) { return "\t".concat(c.basename, " (").concat(tnp_core_1.chalk.yellow(c.name), ")"); }).join('\n')) : '', "\n "));
206
+ index_1.Helpers.info("\n\n YOU ARE RESETING EVERYTHING TO BRANCH: ".concat(tnp_core_1.chalk.bold(branchToReset), "\n\n- curret project (").concat(this.project.name, ")\n").concat(tnp_core_1._.isArray(this.project.children) && this.project.children.length > 0
207
+ ? "- modules:\n".concat(this.project.children
208
+ .map(function (c) { return "\t".concat(c.basename, " (").concat(tnp_core_1.chalk.yellow(c.name), ")"); })
209
+ .join('\n'))
210
+ : '', "\n "));
158
211
  };
159
212
  BaseCommandLine.prototype.reset = function () {
160
213
  var _a, _b, _c, _d, _e;
161
214
  return tslib_1.__awaiter(this, void 0, void 0, function () {
162
- var parent, branchFromLinkedProjectConfig, overrideBranchToReset, branches, resetProject, res;
215
+ var parent, branchFromLinkedProjectConfig, overrideBranchToReset, resetOnlyChildren, branches, resetProject, res;
163
216
  var _this = this;
164
217
  return tslib_1.__generator(this, function (_f) {
165
218
  switch (_f.label) {
166
219
  case 0:
220
+ // Helpers.clearConsole();
221
+ this.prevennCwdIsNotProject();
167
222
  parent = this.project.parent;
168
223
  branchFromLinkedProjectConfig = (_b = (_a = parent === null || parent === void 0 ? void 0 : parent.linkedProjects) === null || _a === void 0 ? void 0 : _a.find(function (l) {
169
- return (0, tnp_core_2.crossPlatformPath)([parent.location, l.relativeClonePath]) === _this.project.location;
224
+ return ((0, tnp_core_2.crossPlatformPath)([parent.location, l.relativeClonePath]) ===
225
+ _this.project.location);
170
226
  })) === null || _b === void 0 ? void 0 : _b.deafultBranch;
171
227
  overrideBranchToReset = this.firstArg ||
172
228
  branchFromLinkedProjectConfig ||
@@ -176,40 +232,48 @@ var BaseCommandLine = /** @class */ (function (_super) {
176
232
  if ((_d = this.project.core) === null || _d === void 0 ? void 0 : _d.branch) {
177
233
  index_1.Helpers.info("\n\n Core branch for project: ".concat((_e = this.project.core) === null || _e === void 0 ? void 0 : _e.branch, "\n\n "));
178
234
  }
235
+ resetOnlyChildren = !!this.project.getLinkedProjectsConfig().resetOnlyChildren;
179
236
  branches = index_1.Helpers.uniqArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(this.__filterBranchesByPattern(overrideBranchToReset)), false), tslib_1.__read(this.__filterBranchesByPattern('')), false));
180
- if (!(branches.length > 0)) return [3 /*break*/, 2];
181
- return [4 /*yield*/, this.__selectBrach(branches)];
237
+ if (!resetOnlyChildren) return [3 /*break*/, 1];
238
+ index_1.Helpers.info("Reseting only children...for defualt branches.");
239
+ return [3 /*break*/, 4];
182
240
  case 1:
183
- overrideBranchToReset = _f.sent();
184
- return [3 /*break*/, 3];
241
+ if (!(branches.length > 0)) return [3 /*break*/, 3];
242
+ return [4 /*yield*/, this.__selectBrach(branches)];
185
243
  case 2:
186
- index_1.Helpers.error("No branch found by name \"".concat(overrideBranchToReset || this.firstArg, "\""), false, true);
187
- _f.label = 3;
244
+ overrideBranchToReset = _f.sent();
245
+ return [3 /*break*/, 4];
188
246
  case 3:
189
- overrideBranchToReset = (overrideBranchToReset || '').split('/').pop() || '';
190
- this.__resetInfo(overrideBranchToReset ? overrideBranchToReset : this.project.getDefaultDevelopmentBranch());
247
+ index_1.Helpers.error("No branch found by name \"".concat(overrideBranchToReset || this.firstArg, "\""), false, true);
248
+ _f.label = 4;
249
+ case 4:
250
+ overrideBranchToReset =
251
+ (overrideBranchToReset || '').split('/').pop() || '';
252
+ this.__resetInfo(overrideBranchToReset
253
+ ? overrideBranchToReset
254
+ : this.project.getDefaultDevelopmentBranch());
191
255
  resetProject = this.project;
192
- if (!(this.project.git.isInsideGitRepo && !this.project.git.isGitRoot)) return [3 /*break*/, 5];
256
+ if (!(this.project.git.isInsideGitRepo && !this.project.git.isGitRoot)) return [3 /*break*/, 6];
193
257
  index_1.Helpers.warn("You are not in root of git repo...", false);
194
258
  resetProject = this.ins.nearestTo((0, tnp_core_2.crossPlatformPath)([this.project.location, '..']), {
195
- findGitRoot: true
259
+ findGitRoot: true,
196
260
  });
197
261
  return [4 /*yield*/, index_1.Helpers.questionYesNo("Would you like to reset root repo instead (project=".concat(tnp_core_1.chalk.bold.red(resetProject.genericName), ") ?"))];
198
- case 4:
262
+ case 5:
199
263
  if (!(_f.sent())) {
200
264
  index_1.Helpers.error("Aborted", false, true);
201
265
  }
202
- _f.label = 5;
203
- case 5: return [4 /*yield*/, index_1.Helpers.questionYesNo("Reset hard and pull current project "
204
- + "".concat(resetProject.linkedProjects.length > 0 ? '(and children)' : '', " ?"))];
205
- case 6:
266
+ _f.label = 6;
267
+ case 6: return [4 /*yield*/, index_1.Helpers.questionYesNo("Reset hard and pull current project " +
268
+ "".concat(resetProject.linkedProjects.length > 0 ? '(and children)' : '', " ?"))];
269
+ case 7:
206
270
  res = _f.sent();
207
- if (!res) return [3 /*break*/, 8];
271
+ if (!res) return [3 /*break*/, 9];
208
272
  return [4 /*yield*/, resetProject.resetProcess(overrideBranchToReset)];
209
- case 7:
210
- _f.sent();
211
- _f.label = 8;
212
273
  case 8:
274
+ _f.sent();
275
+ _f.label = 9;
276
+ case 9:
213
277
  this._exit();
214
278
  return [2 /*return*/];
215
279
  }
@@ -220,6 +284,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
220
284
  //#region commands / soft
221
285
  BaseCommandLine.prototype.soft = function () {
222
286
  // TODO when aciton commit
287
+ this.prevennCwdIsNotProject();
223
288
  this.project.git.resetSoftHEAD(1);
224
289
  this._exit();
225
290
  };
@@ -231,6 +296,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
231
296
  return tslib_1.__generator(this, function (_a) {
232
297
  switch (_a.label) {
233
298
  case 0:
299
+ this.prevennCwdIsNotProject();
234
300
  currentBranch = this.project.git.currentBranchName;
235
301
  safeReset = 10;
236
302
  rebaseBranch = this.firstArg || this.project.getDefaultDevelopmentBranch();
@@ -245,8 +311,10 @@ var BaseCommandLine = /** @class */ (function (_super) {
245
311
  _a.label = 3;
246
312
  case 3:
247
313
  _a.trys.push([3, 5, , 7]);
248
- this.project.run("git reset--hard && git checkout ".concat(rebaseBranch, " && git reset--hard HEAD~").concat(safeReset, " && git pull origin ").concat(rebaseBranch, " ")
249
- + "&& 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();
314
+ this.project
315
+ .run("git reset--hard && git checkout ".concat(rebaseBranch, " && git reset--hard HEAD~").concat(safeReset, " && git pull origin ").concat(rebaseBranch, " ") +
316
+ "&& 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 })
317
+ .sync();
250
318
  return [4 /*yield*/, this.project.init()];
251
319
  case 4:
252
320
  _a.sent();
@@ -272,6 +340,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
272
340
  * stash only staged files
273
341
  */
274
342
  BaseCommandLine.prototype.stash = function () {
343
+ this.prevennCwdIsNotProject();
275
344
  this.project.git.stash({ onlyStaged: true });
276
345
  this._exit();
277
346
  };
@@ -281,6 +350,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
281
350
  * stash all files
282
351
  */
283
352
  BaseCommandLine.prototype.stashAll = function () {
353
+ this.prevennCwdIsNotProject();
284
354
  this.project.git.stageAllFiles();
285
355
  this.project.git.stash({ onlyStaged: false });
286
356
  this._exit();
@@ -294,7 +364,9 @@ var BaseCommandLine = /** @class */ (function (_super) {
294
364
  return tslib_1.__awaiter(this, void 0, void 0, function () {
295
365
  return tslib_1.__generator(this, function (_a) {
296
366
  switch (_a.label) {
297
- case 0: return [4 /*yield*/, this.pushAll(true)];
367
+ case 0:
368
+ this.prevennCwdIsNotProject();
369
+ return [4 /*yield*/, this.pushAll(true)];
298
370
  case 1:
299
371
  _a.sent();
300
372
  return [2 /*return*/];
@@ -312,7 +384,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
312
384
  return tslib_1.__generator(this, function (_b) {
313
385
  switch (_b.label) {
314
386
  case 0:
315
- index_1.Helpers.clearConsole();
387
+ this.prevennCwdIsNotProject();
316
388
  remotes = this.project.git.allOrigins;
317
389
  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"));
318
390
  index = 0;
@@ -373,7 +445,9 @@ var BaseCommandLine = /** @class */ (function (_super) {
373
445
  var _this = this;
374
446
  return tslib_1.__generator(this, function (_a) {
375
447
  switch (_a.label) {
376
- case 0: return [4 /*yield*/, this.project.git.meltActionCommits(true)];
448
+ case 0:
449
+ this.prevennCwdIsNotProject();
450
+ return [4 /*yield*/, this.project.git.meltActionCommits(true)];
377
451
  case 1:
378
452
  _a.sent();
379
453
  return [4 /*yield*/, this.project.pushProcess(tslib_1.__assign(tslib_1.__assign({}, options), { forcePushNoQuestion: options.force, args: this.args, exitCallBack: function () {
@@ -398,9 +472,11 @@ var BaseCommandLine = /** @class */ (function (_super) {
398
472
  var _this = this;
399
473
  return tslib_1.__generator(this, function (_a) {
400
474
  switch (_a.label) {
401
- case 0: return [4 /*yield*/, this.project.pushProcess(tslib_1.__assign(tslib_1.__assign({}, options), { forcePushNoQuestion: options.force, args: this.args, exitCallBack: function () {
402
- _this._exit();
403
- } }))];
475
+ case 0:
476
+ this.prevennCwdIsNotProject();
477
+ return [4 /*yield*/, this.project.pushProcess(tslib_1.__assign(tslib_1.__assign({}, options), { forcePushNoQuestion: options.force, args: this.args, exitCallBack: function () {
478
+ _this._exit();
479
+ } }))];
404
480
  case 1:
405
481
  _a.sent();
406
482
  if (options.noExit) {
@@ -418,7 +494,9 @@ var BaseCommandLine = /** @class */ (function (_super) {
418
494
  return tslib_1.__awaiter(this, void 0, void 0, function () {
419
495
  return tslib_1.__generator(this, function (_a) {
420
496
  switch (_a.label) {
421
- case 0: return [4 /*yield*/, this.meltUpdateCommits(true)];
497
+ case 0:
498
+ this.prevennCwdIsNotProject();
499
+ return [4 /*yield*/, this.meltUpdateCommits(true)];
422
500
  case 1:
423
501
  _a.sent();
424
502
  this._exit();
@@ -652,7 +730,10 @@ var BaseCommandLine = /** @class */ (function (_super) {
652
730
  case 0: return [4 /*yield*/, this.meltUpdateCommits()];
653
731
  case 1:
654
732
  _a.sent();
655
- return [4 /*yield*/, this.push({ typeofCommit: 'performance', commitMessageRequired: true })];
733
+ return [4 /*yield*/, this.push({
734
+ typeofCommit: 'performance',
735
+ commitMessageRequired: true,
736
+ })];
656
737
  case 2:
657
738
  _a.sent();
658
739
  return [2 /*return*/];
@@ -697,6 +778,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
697
778
  //#endregion
698
779
  //#region commands / set origin
699
780
  BaseCommandLine.prototype.SET_ORIGIN = function () {
781
+ this.prevennCwdIsNotProject();
700
782
  var newOriginNameOrUrl = this.firstArg;
701
783
  var proj = this.project;
702
784
  if (proj && proj.git.isInsideGitRepo) {
@@ -712,6 +794,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
712
794
  //#endregion
713
795
  //#region commands / rename origin
714
796
  BaseCommandLine.prototype.RENAME_ORIGIN = function () {
797
+ this.prevennCwdIsNotProject();
715
798
  var newOriginNameOrUrl = this.firstArg;
716
799
  var proj = this.project;
717
800
  if (proj && proj.git.isInsideGitRepo) {
@@ -725,12 +808,14 @@ var BaseCommandLine = /** @class */ (function (_super) {
725
808
  //#endregion
726
809
  //#region commands / last hash tag
727
810
  BaseCommandLine.prototype.LAST_TAG_HASH = function () {
811
+ this.prevennCwdIsNotProject();
728
812
  index_1.Helpers.info(this.project.git.lastTagHash());
729
813
  this._exit();
730
814
  };
731
815
  //#endregion
732
816
  //#region commands / last tag
733
817
  BaseCommandLine.prototype.LAST_TAG = function () {
818
+ this.prevennCwdIsNotProject();
734
819
  var proj = this.project;
735
820
  index_1.Helpers.info("\n\n last tag: ".concat(proj.git.lastTagVersionName, "\n last tag hash: ").concat(proj.git.lastTagHash(), "\n\n"));
736
821
  this._exit();
@@ -750,7 +835,9 @@ var BaseCommandLine = /** @class */ (function (_super) {
750
835
  return tslib_1.__awaiter(this, void 0, void 0, function () {
751
836
  return tslib_1.__generator(this, function (_a) {
752
837
  switch (_a.label) {
753
- case 0: return [4 /*yield*/, this.project.lint()];
838
+ case 0:
839
+ this.prevennCwdIsNotProject();
840
+ return [4 /*yield*/, this.project.lint()];
754
841
  case 1:
755
842
  _a.sent();
756
843
  return [2 /*return*/];
@@ -766,7 +853,8 @@ var BaseCommandLine = /** @class */ (function (_super) {
766
853
  BaseCommandLine.prototype.version = function () {
767
854
  return tslib_1.__awaiter(this, void 0, void 0, function () {
768
855
  return tslib_1.__generator(this, function (_a) {
769
- console.log(this.project.version);
856
+ this.prevennCwdIsNotProject();
857
+ console.log('Current project verison: ' + this.project.version);
770
858
  this._exit();
771
859
  return [2 /*return*/];
772
860
  });
@@ -781,7 +869,9 @@ var BaseCommandLine = /** @class */ (function (_super) {
781
869
  return tslib_1.__awaiter(this, void 0, void 0, function () {
782
870
  return tslib_1.__generator(this, function (_a) {
783
871
  switch (_a.label) {
784
- case 0: return [4 /*yield*/, this.project.init()];
872
+ case 0:
873
+ this.prevennCwdIsNotProject();
874
+ return [4 /*yield*/, this.project.init()];
785
875
  case 1:
786
876
  _a.sent();
787
877
  this._exit();
@@ -799,7 +889,9 @@ var BaseCommandLine = /** @class */ (function (_super) {
799
889
  return tslib_1.__awaiter(this, void 0, void 0, function () {
800
890
  return tslib_1.__generator(this, function (_a) {
801
891
  switch (_a.label) {
802
- case 0: return [4 /*yield*/, this.project.struct()];
892
+ case 0:
893
+ this.prevennCwdIsNotProject();
894
+ return [4 /*yield*/, this.project.struct()];
803
895
  case 1:
804
896
  _a.sent();
805
897
  this._exit();
@@ -818,6 +910,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
818
910
  return tslib_1.__generator(this, function (_a) {
819
911
  switch (_a.label) {
820
912
  case 0:
913
+ this.prevennCwdIsNotProject();
821
914
  index_1.Helpers.clearConsole();
822
915
  return [4 /*yield*/, this.project.info()];
823
916
  case 1:
@@ -834,6 +927,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
834
927
  //#endregion
835
928
  //#region commands / info
836
929
  BaseCommandLine.prototype.modified = function () {
930
+ this.prevennCwdIsNotProject();
837
931
  var proj = this.project;
838
932
  var libs = proj.children.filter(function (child) {
839
933
  process.stdout.write('.');
@@ -842,7 +936,13 @@ var BaseCommandLine = /** @class */ (function (_super) {
842
936
  ]);
843
937
  });
844
938
  console.log('\n' + index_1.Helpers.terminalLine());
845
- index_1.Helpers.info(libs.length ? libs.map(function (c) { return "".concat(tnp_core_1.chalk.bold(c.name), " (").concat(c.git.uncommitedFiles.map(function (p) { return tnp_core_1.chalk.black(tnp_core_1.path.basename(p)); }).join(', '), ")"); }).join('\n') : 'Nothing modifed');
939
+ index_1.Helpers.info(libs.length
940
+ ? libs
941
+ .map(function (c) {
942
+ return "".concat(tnp_core_1.chalk.bold(c.name), " (").concat(c.git.uncommitedFiles.map(function (p) { return tnp_core_1.chalk.black(tnp_core_1.path.basename(p)); }).join(', '), ")");
943
+ })
944
+ .join('\n')
945
+ : 'Nothing modifed');
846
946
  this._exit();
847
947
  };
848
948
  //#endregion
@@ -854,8 +954,12 @@ var BaseCommandLine = /** @class */ (function (_super) {
854
954
  return tslib_1.__generator(this, function (_a) {
855
955
  switch (_a.label) {
856
956
  case 0:
857
- linkedProjects = index_1.LinkedProject.detect(this.project.location)
858
- .filter(function (linkedProj) { return _this.project.ins.From([_this.project.location, linkedProj.relativeClonePath]); });
957
+ linkedProjects = index_1.LinkedProject.detect(this.project.location).filter(function (linkedProj) {
958
+ return _this.project.ins.From([
959
+ _this.project.location,
960
+ linkedProj.relativeClonePath,
961
+ ]);
962
+ });
859
963
  return [4 /*yield*/, index_1.Helpers.questionYesNo("\n\n Deteced project:\n".concat(linkedProjects.map(function (l) { return "- ".concat(l.relativeClonePath); }).join('\n'), "\n\n\nWould you like to update current project configuration?"))];
860
964
  case 1:
861
965
  if (_a.sent()) {
@@ -880,6 +984,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
880
984
  //#endregion
881
985
  //#region commands / remotes
882
986
  BaseCommandLine.prototype.REMOTES = function () {
987
+ this.prevennCwdIsNotProject();
883
988
  var folders = index_1.Helpers.foldersFrom(this.project.location);
884
989
  folders
885
990
  .filter(function (c) { return !tnp_core_1.path.basename(c).startsWith('.'); })
@@ -894,6 +999,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
894
999
  this._exit();
895
1000
  };
896
1001
  BaseCommandLine.prototype.PROJ_EXT = function () {
1002
+ this.prevennCwdIsNotProject();
897
1003
  var p = this.project.pathFor('.vscode/extensions.json');
898
1004
  var extensions = index_1.Helpers.readJson(p, { recommendations: [] }, true);
899
1005
  for (var index = 0; index < extensions.recommendations.length; index++) {
@@ -910,6 +1016,7 @@ var BaseCommandLine = /** @class */ (function (_super) {
910
1016
  this._exit();
911
1017
  };
912
1018
  BaseCommandLine.prototype.projdb = function () {
1019
+ this.prevennCwdIsNotProject();
913
1020
  index_1.Helpers.info("Projects db location:\n ".concat(this.project.projectsDbLocation, "\n\n opening in vscode...\n\n "));
914
1021
  index_1.Helpers.run("code ".concat(this.project.projectsDbLocation)).sync();
915
1022
  this._exit();
@@ -928,7 +1035,9 @@ var BaseCommandLine = /** @class */ (function (_super) {
928
1035
  return tslib_1.__generator(this, function (_a) {
929
1036
  switch (_a.label) {
930
1037
  case 0:
931
- childrenMsg = this.project.children.length == 0 ? '(no children in project)' : '(with children)';
1038
+ childrenMsg = this.project.children.length == 0
1039
+ ? '(no children in project)'
1040
+ : '(with children)';
932
1041
  return [4 /*yield*/, index_1.Helpers.autocompleteAsk("Choose branch to reset in this project ".concat(childrenMsg, ": "), branches.map(function (b) {
933
1042
  return { name: b, value: b };
934
1043
  }))];