@nu-art/build-and-install 0.204.17 → 0.204.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/package.json
CHANGED
package/screen/ProjectScreen.js
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.MemKey_ProjectScreen = exports.ProjectScreen = void 0;
|
|
27
4
|
// @ts-ignore
|
|
28
|
-
const
|
|
5
|
+
const neo_blessed_1 = require("neo-blessed");
|
|
29
6
|
const MemStorage_1 = require("@nu-art/ts-common/mem-storage/MemStorage");
|
|
30
7
|
const ts_common_1 = require("@nu-art/ts-common");
|
|
31
8
|
class ProjectScreen {
|
|
@@ -87,7 +64,7 @@ class ProjectScreen {
|
|
|
87
64
|
}
|
|
88
65
|
enable() {
|
|
89
66
|
this.enabled = true;
|
|
90
|
-
this.screen = blessed.screen({
|
|
67
|
+
this.screen = neo_blessed_1.blessed.screen({
|
|
91
68
|
smartCSR: true,
|
|
92
69
|
title: 'Build and install',
|
|
93
70
|
});
|
|
@@ -95,7 +72,7 @@ class ProjectScreen {
|
|
|
95
72
|
return process.exit(1); // Quit on q, esc, or ctrl-c
|
|
96
73
|
});
|
|
97
74
|
// Create the UI components
|
|
98
|
-
this.phaseBox = blessed.text({
|
|
75
|
+
this.phaseBox = neo_blessed_1.blessed.text({
|
|
99
76
|
parent: this.screen,
|
|
100
77
|
top: 0,
|
|
101
78
|
left: 0,
|
|
@@ -110,7 +87,7 @@ class ProjectScreen {
|
|
|
110
87
|
},
|
|
111
88
|
align: 'center'
|
|
112
89
|
});
|
|
113
|
-
this.packageTable = blessed.listtable({
|
|
90
|
+
this.packageTable = neo_blessed_1.blessed.listtable({
|
|
114
91
|
parent: this.screen,
|
|
115
92
|
top: 3,
|
|
116
93
|
left: 0,
|
|
@@ -134,7 +111,7 @@ class ProjectScreen {
|
|
|
134
111
|
},
|
|
135
112
|
}
|
|
136
113
|
});
|
|
137
|
-
this.titleElement = blessed.text({
|
|
114
|
+
this.titleElement = neo_blessed_1.blessed.text({
|
|
138
115
|
parent: this.screen,
|
|
139
116
|
top: 0,
|
|
140
117
|
right: 0,
|
|
@@ -149,7 +126,7 @@ class ProjectScreen {
|
|
|
149
126
|
},
|
|
150
127
|
align: 'center'
|
|
151
128
|
});
|
|
152
|
-
this.logger = blessed.log({
|
|
129
|
+
this.logger = neo_blessed_1.blessed.log({
|
|
153
130
|
parent: this.screen,
|
|
154
131
|
top: 3,
|
|
155
132
|
right: 0,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LogClient_MemBuffer } from '@nu-art/ts-common';
|
|
2
|
+
import { ConsoleScreen } from '@nu-art/commando/console/ConsoleScreen';
|
|
3
|
+
export type PackageStatus = {
|
|
4
|
+
packageName: string;
|
|
5
|
+
status: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class RunningProcessLogs extends ConsoleScreen<{
|
|
9
|
+
logs: {
|
|
10
|
+
key: string;
|
|
11
|
+
logClient: LogClient_MemBuffer;
|
|
12
|
+
}[];
|
|
13
|
+
}> {
|
|
14
|
+
constructor();
|
|
15
|
+
registerApp(appKey: string, logClient: LogClient_MemBuffer): void;
|
|
16
|
+
unregisterApp(appKey: string): void;
|
|
17
|
+
private recalculateWidgets;
|
|
18
|
+
protected render(): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunningProcessLogs = void 0;
|
|
4
|
+
const ts_common_1 = require("@nu-art/ts-common");
|
|
5
|
+
const ConsoleScreen_1 = require("@nu-art/commando/console/ConsoleScreen");
|
|
6
|
+
class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
}
|
|
10
|
+
registerApp(appKey, logClient) {
|
|
11
|
+
const logs = this.state.logs;
|
|
12
|
+
const foundLog = logs.find(log => log.key === appKey);
|
|
13
|
+
if (foundLog)
|
|
14
|
+
throw new ts_common_1.BadImplementationException(`already have log for appkey: ${appKey}`);
|
|
15
|
+
logs.push({ key: appKey, logClient });
|
|
16
|
+
this.recalculateWidgets(logs);
|
|
17
|
+
this.setState({ logs });
|
|
18
|
+
}
|
|
19
|
+
unregisterApp(appKey) {
|
|
20
|
+
const foundLog = this.state.logs.find(log => log.key === appKey);
|
|
21
|
+
if (!foundLog)
|
|
22
|
+
throw new ts_common_1.BadImplementationException(`Could not find log for appkey: ${appKey}`);
|
|
23
|
+
const logs = this.state.logs;
|
|
24
|
+
(0, ts_common_1.removeItemFromArray)(logs, foundLog);
|
|
25
|
+
this.recalculateWidgets(logs);
|
|
26
|
+
this.setState({ logs });
|
|
27
|
+
}
|
|
28
|
+
recalculateWidgets(logs) {
|
|
29
|
+
this.clearScreen(true);
|
|
30
|
+
const totalApps = logs.length;
|
|
31
|
+
const fraction = 100 / totalApps;
|
|
32
|
+
logs.forEach((log, index) => {
|
|
33
|
+
const top = `${(index * fraction).toFixed(0)}%`;
|
|
34
|
+
const height = `${fraction.toFixed(0)}%`;
|
|
35
|
+
this.createWidget('log', {
|
|
36
|
+
top: top,
|
|
37
|
+
left: 0,
|
|
38
|
+
width: '100%',
|
|
39
|
+
height: height,
|
|
40
|
+
label: ` Log for ${log.key} `,
|
|
41
|
+
border: { type: 'line' },
|
|
42
|
+
scrollable: true,
|
|
43
|
+
scrollbar: {
|
|
44
|
+
ch: ' ',
|
|
45
|
+
track: {
|
|
46
|
+
bg: 'grey'
|
|
47
|
+
},
|
|
48
|
+
style: {
|
|
49
|
+
inverse: true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
mouse: true
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
this.state.logs.forEach((log, i) => {
|
|
58
|
+
this.widgets[i].setContent(log.logClient.buffers[0]);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.RunningProcessLogs = RunningProcessLogs;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Console_PackagesView = void 0;
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
const blessed = __importStar(require("neo-blessed"));
|
|
29
|
-
class Console_PackagesView {
|
|
30
|
-
// private readonly testBox1: blessed.Widgets.BoxElement;
|
|
31
|
-
// private readonly testBox2: blessed.Widgets.BoxElement;
|
|
32
|
-
// private readonly packageTable: blessed.Widgets.TableElement;
|
|
33
|
-
constructor(title) {
|
|
34
|
-
this.render = () => {
|
|
35
|
-
this.renderTitle();
|
|
36
|
-
this.screen.render();
|
|
37
|
-
};
|
|
38
|
-
this.title = title;
|
|
39
|
-
this.screen = blessed.screen({
|
|
40
|
-
smartCSR: true,
|
|
41
|
-
title: 'Build and install',
|
|
42
|
-
});
|
|
43
|
-
// Create the UI components
|
|
44
|
-
this.titleView = blessed.box({
|
|
45
|
-
parent: this.screen,
|
|
46
|
-
top: 1,
|
|
47
|
-
left: 'center',
|
|
48
|
-
width: '30%',
|
|
49
|
-
height: 3,
|
|
50
|
-
border: { type: 'line' },
|
|
51
|
-
content: '',
|
|
52
|
-
tags: true,
|
|
53
|
-
style: {
|
|
54
|
-
border: { fg: 'green' },
|
|
55
|
-
fg: 'black',
|
|
56
|
-
},
|
|
57
|
-
valign: 'middle',
|
|
58
|
-
align: 'center'
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
renderTitle() {
|
|
62
|
-
this.titleView.setContent(this.title);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.Console_PackagesView = Console_PackagesView;
|