@nu-art/build-and-install 0.204.19 → 0.204.20

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.
@@ -35,6 +35,7 @@ export declare class ProjectManager extends Logger {
35
35
  private readonly projectScreen;
36
36
  private logger?;
37
37
  constructor();
38
+ clearLogger(): void;
38
39
  showAllLogs(): void;
39
40
  showPrettyLogs(): void;
40
41
  private loadPackage;
@@ -67,16 +67,18 @@ class ProjectManager extends ts_common_1.Logger {
67
67
  this.setMinLevel(ts_common_1.LogLevel.Verbose);
68
68
  this.logInfo('Runtime params:', params_1.RuntimeParams);
69
69
  }
70
- showAllLogs() {
71
- var _a;
70
+ clearLogger() {
72
71
  if (this.logger)
73
72
  ts_common_1.BeLogged.removeConsole(this.logger);
73
+ }
74
+ showAllLogs() {
75
+ var _a;
76
+ this.clearLogger();
74
77
  (_a = this.projectScreen) === null || _a === void 0 ? void 0 : _a.disable();
75
78
  ts_common_1.BeLogged.addClient(this.logger = ts_common_1.LogClient_Terminal);
76
79
  }
77
80
  showPrettyLogs() {
78
- if (this.logger)
79
- ts_common_1.BeLogged.removeConsole(this.logger);
81
+ this.clearLogger();
80
82
  this.projectScreen.enable();
81
83
  ts_common_1.BeLogged.addClient(this.logger = this.projectScreen.logClient);
82
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/build-and-install",
3
- "version": "0.204.19",
3
+ "version": "0.204.20",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "TacB0sS",
package/phases/phases.js CHANGED
@@ -42,6 +42,7 @@ const consts_2 = require("../defaults/consts");
42
42
  const project_manager_1 = require("../project-manager");
43
43
  const ProjectScreen_1 = require("../screen/ProjectScreen");
44
44
  const cli_1 = require("@nu-art/commando/core/cli");
45
+ const RunningProcessLogs_1 = require("../screen/RunningProcessLogs");
45
46
  const CONST_ThunderstormVersionKey = 'THUNDERSTORM_SDK_VERSION';
46
47
  const CONST_ThunderstormDependencyKey = 'THUNDERSTORM_DEPENDENCY_VERSION';
47
48
  const CONST_ProjectVersionKey = 'APP_VERSION';
@@ -585,7 +586,7 @@ exports.Phase_CompileWatch = {
585
586
  });
586
587
  }
587
588
  };
588
- // const runningAppsLogs = new RunningProcessLogs();
589
+ let runningAppsLogs;
589
590
  let counter = 0;
590
591
  exports.Phase_Launch = {
591
592
  type: 'package',
@@ -594,11 +595,14 @@ exports.Phase_Launch = {
594
595
  mandatoryPhases: [exports.Phase_ResolveEnv],
595
596
  filter: async (pkg) => { var _a; return !!((_a = pkg.name.match(new RegExp(params_1.RuntimeParams.launch))) === null || _a === void 0 ? void 0 : _a[0]) && (pkg.type === 'firebase-functions-app' || pkg.type === 'firebase-hosting-app'); },
596
597
  action: async (pkg) => {
598
+ const projectManager = project_manager_1.MemKey_ProjectManager.get();
597
599
  const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
598
- // if (projectScreen.isEnabled()) {
599
- // projectScreen.disable();
600
- // runningAppsLogs.enable();
601
- // }
600
+ if (!runningAppsLogs) {
601
+ projectScreen.disable();
602
+ projectManager.clearLogger();
603
+ runningAppsLogs = new RunningProcessLogs_1.RunningProcessLogs();
604
+ runningAppsLogs.enable();
605
+ }
602
606
  const logClient = new ts_common_1.LogClient_MemBuffer(pkg.name);
603
607
  logClient.setForTerminal();
604
608
  logClient.setComposer((tag, level) => {
@@ -609,6 +613,7 @@ exports.Phase_Launch = {
609
613
  logClient.setFilter((level, tag) => {
610
614
  return tag === pkg.name;
611
615
  });
616
+ ts_common_1.BeLogged.addClient(logClient);
612
617
  projectScreen.updateOrCreatePackage(pkg.name, 'Launching...');
613
618
  if (pkg.type === 'firebase-functions-app') {
614
619
  await (0, ts_common_1.sleep)(1000 * counter++);
@@ -620,11 +625,12 @@ exports.Phase_Launch = {
620
625
  .append(`array=($(lsof -ti:${allPorts.join(',')}))`)
621
626
  .append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`);
622
627
  command.append(`firebase emulators:start --export-on-exit --import=.trash/data ${runInDebug ? `--inspect-functions ${pkg.envConfig.ssl}` : ''}`);
623
- // runningAppsLogs.registerApp(pkg.name, logClient);
628
+ runningAppsLogs.registerApp(pkg.name, logClient);
624
629
  return command
625
630
  .execute();
626
631
  }
627
- if (pkg.type === 'firebase-hosting-app')
632
+ if (pkg.type === 'firebase-hosting-app') {
633
+ runningAppsLogs.registerApp(pkg.name, logClient);
628
634
  return nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
629
635
  .setUID(pkg.name)
630
636
  .cd(pkg.path)
@@ -633,6 +639,7 @@ exports.Phase_Launch = {
633
639
  .append(`nvm use`)
634
640
  .append(`npm run start`)
635
641
  .execute();
642
+ }
636
643
  projectScreen.updateOrCreatePackage(pkg.name, 'Died');
637
644
  }
638
645
  };
@@ -41,30 +41,41 @@ class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
41
41
  }
42
42
  recalculateWidgets(logs) {
43
43
  this.clearScreen(false);
44
- const totalApps = logs.length;
45
- const fraction = 100 / totalApps;
46
- logs.forEach((log, index) => {
47
- const top = `${(index * fraction).toFixed(0)}%`;
48
- const height = `${fraction.toFixed(0)}%`;
49
- this.createWidget('log', {
50
- top: top,
51
- left: 0,
52
- width: '100%',
53
- height: height,
54
- label: ` Log for ${log.key} `,
55
- border: { type: 'line' },
56
- scrollable: true,
57
- scrollbar: {
58
- ch: ' ',
59
- track: {
60
- bg: 'grey'
44
+ const fittingGrid = gridPreset[logs.length - 1];
45
+ if (!(0, ts_common_1.exists)(fittingGrid))
46
+ return;
47
+ if (!fittingGrid)
48
+ throw new Error(`No preset available for this number of cells ${logs.length}`);
49
+ let index = 0;
50
+ let xPos = 0;
51
+ fittingGrid.forEach(column => {
52
+ let yPos = 0;
53
+ column.forEach(cell => {
54
+ const [fracWidth, fracHeight] = cell;
55
+ const width = 100 * fracWidth;
56
+ const height = 100 * fracHeight;
57
+ this.createWidget('log', {
58
+ top: `${yPos}%`,
59
+ left: `${xPos}%`,
60
+ width: `${width}%`,
61
+ height: `${height}%`,
62
+ label: ` Log for ${logs[index++].key} `,
63
+ border: { type: 'line' },
64
+ scrollable: true,
65
+ scrollbar: {
66
+ ch: ' ',
67
+ track: {
68
+ bg: 'grey'
69
+ },
70
+ style: {
71
+ inverse: true
72
+ }
61
73
  },
62
- style: {
63
- inverse: true
64
- }
65
- },
66
- mouse: true
74
+ mouse: true
75
+ });
76
+ yPos += height; // Assumes all cells in a column have the same height
67
77
  });
78
+ xPos += column[0][0] * 100;
68
79
  });
69
80
  }
70
81
  render() {
@@ -74,3 +85,19 @@ class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
74
85
  }
75
86
  }
76
87
  exports.RunningProcessLogs = RunningProcessLogs;
88
+ const columnOf1_halfWidth = [[0.5, 1]];
89
+ const columnOf2_halfWidth = [[0.5, 0.5], [0.5, 0.5]];
90
+ const columnOf3_halfWidth = [[0.5, 1 / 3], [0.5, 1 / 3], [0.5, 1 / 3]];
91
+ const columnOf2_3rdWidth = [[1 / 3, 0.5], [1 / 3, 0.5]];
92
+ const columnOf3_3rdWidth = [[1 / 3, 1 / 3], [1 / 3, 1 / 3], [1 / 3, 1 / 3]];
93
+ const gridPreset = [
94
+ [[[1, 1]]],
95
+ [columnOf1_halfWidth, columnOf1_halfWidth],
96
+ [columnOf2_halfWidth, columnOf1_halfWidth],
97
+ [columnOf2_halfWidth, columnOf2_halfWidth],
98
+ [columnOf3_halfWidth, columnOf2_halfWidth],
99
+ [columnOf3_halfWidth, columnOf3_halfWidth],
100
+ [columnOf3_3rdWidth, columnOf2_3rdWidth, columnOf2_3rdWidth],
101
+ [columnOf3_3rdWidth, columnOf3_3rdWidth, columnOf2_3rdWidth],
102
+ [columnOf3_3rdWidth, columnOf3_3rdWidth, columnOf3_3rdWidth],
103
+ ];