@nu-art/build-and-install 0.204.25 → 0.204.26
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/logic/ProjectManager.js +2 -2
- package/package.json +1 -1
- package/phases/phases.js +5 -5
- package/screen/ProjectScreen.d.ts +13 -11
- package/screen/ProjectScreen.js +42 -85
- package/screen/RunningProcessLogs.d.ts +1 -1
- package/screen/RunningProcessLogs.js +34 -26
- package/v2/BasePackage.d.ts +4 -0
- package/v2/BasePackage.js +9 -0
- package/v2/ProjectManagerV2.d.ts +15 -0
- package/v2/ProjectManagerV2.js +23 -0
- package/v2/test/test.d.ts +1 -0
- package/v2/test/test.js +58 -0
package/logic/ProjectManager.js
CHANGED
|
@@ -74,12 +74,12 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
74
74
|
showAllLogs() {
|
|
75
75
|
var _a;
|
|
76
76
|
this.clearLogger();
|
|
77
|
-
(_a = this.projectScreen) === null || _a === void 0 ? void 0 : _a.
|
|
77
|
+
(_a = this.projectScreen) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
78
78
|
ts_common_1.BeLogged.addClient(this.logger = ts_common_1.LogClient_Terminal);
|
|
79
79
|
}
|
|
80
80
|
showPrettyLogs() {
|
|
81
81
|
this.clearLogger();
|
|
82
|
-
this.projectScreen.
|
|
82
|
+
this.projectScreen.create();
|
|
83
83
|
ts_common_1.BeLogged.addClient(this.logger = this.projectScreen.logClient);
|
|
84
84
|
}
|
|
85
85
|
loadPackage() {
|
package/package.json
CHANGED
package/phases/phases.js
CHANGED
|
@@ -92,7 +92,7 @@ exports.Phase_SetWithThunderstorm = {
|
|
|
92
92
|
packages.packages = packages.packages.filter(filter);
|
|
93
93
|
packages.packagesDependency = (_a = packages.packagesDependency) === null || _a === void 0 ? void 0 : _a.map(_packageArray => _packageArray.filter(filter));
|
|
94
94
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
95
|
-
if (!projectScreen.
|
|
95
|
+
if (!projectScreen.getPackageData().length) {
|
|
96
96
|
packages.packagesDependency.map(packages => packages.map(pkg => projectScreen.updateOrCreatePackage(pkg.name, 'Initiated')));
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -593,10 +593,10 @@ exports.Phase_Launch = {
|
|
|
593
593
|
const projectManager = project_manager_1.MemKey_ProjectManager.get();
|
|
594
594
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
595
595
|
if (!runningAppsLogs) {
|
|
596
|
-
projectScreen.
|
|
596
|
+
projectScreen.dispose();
|
|
597
597
|
projectManager.clearLogger();
|
|
598
598
|
runningAppsLogs = new RunningProcessLogs_1.RunningProcessLogs();
|
|
599
|
-
runningAppsLogs.
|
|
599
|
+
runningAppsLogs.create();
|
|
600
600
|
}
|
|
601
601
|
const logClient = new ts_common_1.LogClient_MemBuffer(pkg.name);
|
|
602
602
|
logClient.setForTerminal();
|
|
@@ -615,7 +615,7 @@ exports.Phase_Launch = {
|
|
|
615
615
|
const allPorts = Array.from({ length: 10 }, (_, i) => `${pkg.envConfig.basePort + i}`);
|
|
616
616
|
runningAppsLogs.registerApp(pkg.name, logClient);
|
|
617
617
|
await nvm_1.NVM.createCommando(basic_1.Cli_Basic)
|
|
618
|
-
.setUID(pkg.name)
|
|
618
|
+
.setUID(pkg.name).debug()
|
|
619
619
|
.append(`array=($(lsof -ti:${allPorts.join(',')}))`)
|
|
620
620
|
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
|
|
621
621
|
.execute();
|
|
@@ -636,7 +636,7 @@ exports.Phase_Launch = {
|
|
|
636
636
|
if (!pkg.envConfig.hostingPort)
|
|
637
637
|
throw new ts_common_1.BadImplementationException('Missing hosting port in envConfig');
|
|
638
638
|
return nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
639
|
-
.setUID(pkg.name)
|
|
639
|
+
.setUID(pkg.name).debug()
|
|
640
640
|
.cd(pkg.path)
|
|
641
641
|
.append(`array=($(lsof -ti:${[pkg.envConfig.hostingPort].join(',')}))`)
|
|
642
642
|
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { MemKey } from '@nu-art/ts-common/mem-storage/MemStorage';
|
|
2
2
|
import { LogClient_MemBuffer } from '@nu-art/ts-common';
|
|
3
|
+
import { ConsoleScreen } from '@nu-art/commando/console/ConsoleScreen';
|
|
3
4
|
export type PackageStatus = {
|
|
4
5
|
packageName: string;
|
|
5
6
|
status: string;
|
|
6
7
|
error?: string;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
type CurrentRunningPhase = {
|
|
10
|
+
phaseName: string;
|
|
11
|
+
};
|
|
12
|
+
type State = {
|
|
13
|
+
packageData: PackageStatus[];
|
|
14
|
+
currentRunningPhase: CurrentRunningPhase;
|
|
15
|
+
};
|
|
16
|
+
export declare class ProjectScreen extends ConsoleScreen<State> {
|
|
12
17
|
private phaseBox;
|
|
13
18
|
private packageTable;
|
|
14
19
|
private logger;
|
|
15
|
-
private titleElement;
|
|
16
20
|
readonly logClient: LogClient_MemBuffer;
|
|
17
|
-
private enabled;
|
|
18
21
|
constructor(initialData: PackageStatus[]);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
renderScreen: () => void;
|
|
23
|
-
endRun: () => void;
|
|
22
|
+
getPackageData(): PackageStatus[];
|
|
23
|
+
protected createWidgets(): void;
|
|
24
|
+
protected render(): void;
|
|
24
25
|
private renderCurrentRunningPhase;
|
|
25
26
|
private renderPackageTableTable;
|
|
26
27
|
updateOrCreatePackage: (name: string, status: string, error?: string) => void;
|
|
27
28
|
updateRunningPhase: (name: string) => void;
|
|
28
29
|
}
|
|
29
30
|
export declare const MemKey_ProjectScreen: MemKey<ProjectScreen>;
|
|
31
|
+
export {};
|
package/screen/ProjectScreen.js
CHANGED
|
@@ -1,80 +1,57 @@
|
|
|
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
|
-
// @ts-ignore
|
|
28
|
-
const blessed = __importStar(require("neo-blessed"));
|
|
29
4
|
const MemStorage_1 = require("@nu-art/ts-common/mem-storage/MemStorage");
|
|
30
5
|
const ts_common_1 = require("@nu-art/ts-common");
|
|
31
|
-
|
|
6
|
+
const ConsoleScreen_1 = require("@nu-art/commando/console/ConsoleScreen");
|
|
7
|
+
class ProjectScreen extends ConsoleScreen_1.ConsoleScreen {
|
|
32
8
|
constructor(initialData) {
|
|
9
|
+
super({
|
|
10
|
+
smartCSR: true,
|
|
11
|
+
title: 'Build and install',
|
|
12
|
+
keyBinding: [{
|
|
13
|
+
keys: ['escape', 'q', 'C-c'],
|
|
14
|
+
callback: () => {
|
|
15
|
+
return process.exit(1); // Quit on q, esc, or ctrl-c
|
|
16
|
+
}
|
|
17
|
+
}]
|
|
18
|
+
});
|
|
33
19
|
this.logClient = new ts_common_1.LogClient_MemBuffer('output.txt');
|
|
34
|
-
this.enabled = false;
|
|
35
|
-
this.renderScreen = () => {
|
|
36
|
-
if (!this.enabled)
|
|
37
|
-
return;
|
|
38
|
-
this.renderCurrentRunningPhase();
|
|
39
|
-
this.renderPackageTableTable();
|
|
40
|
-
this.logger.setContent(this.logClient.buffers[0]);
|
|
41
|
-
this.screen.render();
|
|
42
|
-
};
|
|
43
|
-
this.endRun = () => {
|
|
44
|
-
this.disable();
|
|
45
|
-
console.log(this.logClient.buffers[0]);
|
|
46
|
-
};
|
|
47
20
|
this.renderCurrentRunningPhase = () => {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
const content = `Phase Name: ${(_b = (_a = this.
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
const content = `Phase Name: ${(_c = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.currentRunningPhase) === null || _b === void 0 ? void 0 : _b.phaseName) !== null && _c !== void 0 ? _c : 'No Phase'}\n`;
|
|
50
23
|
this.phaseBox.setContent(content);
|
|
51
24
|
};
|
|
52
25
|
this.renderPackageTableTable = () => {
|
|
26
|
+
var _a;
|
|
53
27
|
const scrollPosition = this.packageTable.getScroll();
|
|
54
28
|
const selectedIndex = this.packageTable.selected;
|
|
55
29
|
const data = [
|
|
56
30
|
['Package Name', 'Status'],
|
|
57
|
-
...this.packageData.map(pkg => [pkg.packageName, pkg.status])
|
|
31
|
+
...((_a = this.state.packageData) !== null && _a !== void 0 ? _a : []).map(pkg => [pkg.packageName, pkg.status])
|
|
58
32
|
];
|
|
59
33
|
this.packageTable.setData(data);
|
|
60
34
|
this.packageTable.select(selectedIndex);
|
|
61
35
|
this.packageTable.setScroll(scrollPosition);
|
|
62
36
|
};
|
|
63
37
|
this.updateOrCreatePackage = (name, status, error) => {
|
|
64
|
-
const
|
|
38
|
+
const packageData = this.state.packageData;
|
|
39
|
+
const index = packageData.findIndex(pkg => pkg.packageName === name);
|
|
65
40
|
if (index !== -1) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
packageData[index].status = status;
|
|
42
|
+
packageData[index].error = error;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
packageData.push({ packageName: name, status });
|
|
69
46
|
}
|
|
70
|
-
this.
|
|
71
|
-
this.renderScreen();
|
|
47
|
+
this.setState({ packageData });
|
|
72
48
|
};
|
|
73
49
|
this.updateRunningPhase = (name) => {
|
|
74
|
-
this.currentRunningPhase
|
|
75
|
-
this.renderScreen();
|
|
50
|
+
this.setState({ currentRunningPhase: { phaseName: name } });
|
|
76
51
|
};
|
|
77
|
-
this.
|
|
52
|
+
this.setState({
|
|
53
|
+
packageData: initialData
|
|
54
|
+
});
|
|
78
55
|
this.logClient.setForTerminal();
|
|
79
56
|
this.logClient.setComposer((tag, level) => {
|
|
80
57
|
ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
|
|
@@ -82,21 +59,14 @@ class ProjectScreen {
|
|
|
82
59
|
return ` ${date} ${(0, ts_common_1._logger_getPrefix)(level)} ${tag}: `;
|
|
83
60
|
});
|
|
84
61
|
this.logClient.setLogAppendedListener(() => {
|
|
85
|
-
this.
|
|
62
|
+
this.setState({});
|
|
86
63
|
});
|
|
87
64
|
}
|
|
88
|
-
|
|
89
|
-
this.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
this.screen.key(['escape', 'q', 'C-c'], () => {
|
|
95
|
-
return process.exit(1); // Quit on q, esc, or ctrl-c
|
|
96
|
-
});
|
|
97
|
-
// Create the UI components
|
|
98
|
-
this.phaseBox = blessed.text({
|
|
99
|
-
parent: this.screen,
|
|
65
|
+
getPackageData() {
|
|
66
|
+
return this.state.packageData;
|
|
67
|
+
}
|
|
68
|
+
createWidgets() {
|
|
69
|
+
this.phaseBox = this.createWidget('text', {
|
|
100
70
|
top: 0,
|
|
101
71
|
left: 0,
|
|
102
72
|
height: 3,
|
|
@@ -110,8 +80,7 @@ class ProjectScreen {
|
|
|
110
80
|
},
|
|
111
81
|
align: 'center'
|
|
112
82
|
});
|
|
113
|
-
this.packageTable =
|
|
114
|
-
parent: this.screen,
|
|
83
|
+
this.packageTable = this.createWidget('listtable', {
|
|
115
84
|
top: 3,
|
|
116
85
|
left: 0,
|
|
117
86
|
width: '40%',
|
|
@@ -122,6 +91,7 @@ class ProjectScreen {
|
|
|
122
91
|
tags: true,
|
|
123
92
|
style: {
|
|
124
93
|
border: { fg: 'blue' },
|
|
94
|
+
// @ts-ignore
|
|
125
95
|
header: { bold: true },
|
|
126
96
|
cell: { fg: 'white', selected: { bg: 'blue' } }
|
|
127
97
|
},
|
|
@@ -134,8 +104,7 @@ class ProjectScreen {
|
|
|
134
104
|
},
|
|
135
105
|
}
|
|
136
106
|
});
|
|
137
|
-
this.
|
|
138
|
-
parent: this.screen,
|
|
107
|
+
this.createWidget('text', {
|
|
139
108
|
top: 0,
|
|
140
109
|
right: 0,
|
|
141
110
|
width: '60%',
|
|
@@ -149,8 +118,7 @@ class ProjectScreen {
|
|
|
149
118
|
},
|
|
150
119
|
align: 'center'
|
|
151
120
|
});
|
|
152
|
-
this.logger =
|
|
153
|
-
parent: this.screen,
|
|
121
|
+
this.logger = this.createWidget('log', {
|
|
154
122
|
top: 3,
|
|
155
123
|
right: 0,
|
|
156
124
|
width: '60%',
|
|
@@ -167,21 +135,10 @@ class ProjectScreen {
|
|
|
167
135
|
align: 'left'
|
|
168
136
|
});
|
|
169
137
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this.enabled = false;
|
|
175
|
-
if (!this.screen)
|
|
176
|
-
return;
|
|
177
|
-
this.phaseBox.detach();
|
|
178
|
-
this.packageTable.detach();
|
|
179
|
-
this.titleElement.detach();
|
|
180
|
-
this.logger.detach();
|
|
181
|
-
this.screen.detach();
|
|
182
|
-
this.screen.clear();
|
|
183
|
-
this.screen.destroy();
|
|
184
|
-
process.stdout.write('\x1bc'); // This sends the terminal reset escape code
|
|
138
|
+
render() {
|
|
139
|
+
this.renderCurrentRunningPhase();
|
|
140
|
+
this.renderPackageTableTable();
|
|
141
|
+
this.logger.setContent(this.logClient.buffers[0]);
|
|
185
142
|
}
|
|
186
143
|
}
|
|
187
144
|
exports.ProjectScreen = ProjectScreen;
|
|
@@ -7,8 +7,8 @@ export declare class RunningProcessLogs extends ConsoleScreen<{
|
|
|
7
7
|
}[];
|
|
8
8
|
}> {
|
|
9
9
|
constructor();
|
|
10
|
+
protected createWidgets(): void;
|
|
10
11
|
registerApp(appKey: string, logClient: LogClient_MemBuffer): void;
|
|
11
12
|
unregisterApp(appKey: string): void;
|
|
12
|
-
private recalculateWidgets;
|
|
13
13
|
protected render(): void;
|
|
14
14
|
}
|
|
@@ -17,30 +17,8 @@ class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
|
|
|
17
17
|
});
|
|
18
18
|
this.state = { logs: [] };
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
createWidgets() {
|
|
21
21
|
const logs = this.state.logs;
|
|
22
|
-
const foundLog = logs.find(log => log.key === appKey);
|
|
23
|
-
if (foundLog)
|
|
24
|
-
throw new ts_common_1.BadImplementationException(`already have log for appkey: ${appKey}`);
|
|
25
|
-
logs.push({ key: appKey, logClient });
|
|
26
|
-
this.recalculateWidgets(logs);
|
|
27
|
-
logClient.setLogAppendedListener(() => {
|
|
28
|
-
this.render();
|
|
29
|
-
// might have a leak.. need to remove the listener at some point
|
|
30
|
-
});
|
|
31
|
-
this.setState({ logs });
|
|
32
|
-
}
|
|
33
|
-
unregisterApp(appKey) {
|
|
34
|
-
const foundLog = this.state.logs.find(log => log.key === appKey);
|
|
35
|
-
if (!foundLog)
|
|
36
|
-
throw new ts_common_1.BadImplementationException(`Could not find log for appkey: ${appKey}`);
|
|
37
|
-
const logs = this.state.logs;
|
|
38
|
-
(0, ts_common_1.removeItemFromArray)(logs, foundLog);
|
|
39
|
-
this.recalculateWidgets(logs);
|
|
40
|
-
this.setState({ logs });
|
|
41
|
-
}
|
|
42
|
-
recalculateWidgets(logs) {
|
|
43
|
-
this.clearScreen(false);
|
|
44
22
|
const fittingGrid = gridPreset[logs.length - 1];
|
|
45
23
|
if (!(0, ts_common_1.exists)(fittingGrid))
|
|
46
24
|
return;
|
|
@@ -78,10 +56,40 @@ class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
|
|
|
78
56
|
xPos += column[0][0] * 100;
|
|
79
57
|
});
|
|
80
58
|
}
|
|
81
|
-
|
|
82
|
-
this.state.logs
|
|
83
|
-
|
|
59
|
+
registerApp(appKey, logClient) {
|
|
60
|
+
const logs = this.state.logs;
|
|
61
|
+
const foundLog = logs.find(log => log.key === appKey);
|
|
62
|
+
if (foundLog)
|
|
63
|
+
throw new ts_common_1.BadImplementationException(`already have log for appkey: ${appKey}`);
|
|
64
|
+
logs.push({ key: appKey, logClient });
|
|
65
|
+
this.dispose();
|
|
66
|
+
this.create();
|
|
67
|
+
logClient.setLogAppendedListener(() => {
|
|
68
|
+
this.render();
|
|
69
|
+
// might have a leak.. need to remove the listener at some point
|
|
84
70
|
});
|
|
71
|
+
this.setState({ logs });
|
|
72
|
+
}
|
|
73
|
+
unregisterApp(appKey) {
|
|
74
|
+
const foundLog = this.state.logs.find(log => log.key === appKey);
|
|
75
|
+
if (!foundLog)
|
|
76
|
+
throw new ts_common_1.BadImplementationException(`Could not find log for appkey: ${appKey}`);
|
|
77
|
+
const logs = this.state.logs;
|
|
78
|
+
(0, ts_common_1.removeItemFromArray)(logs, foundLog);
|
|
79
|
+
this.dispose();
|
|
80
|
+
this.create();
|
|
81
|
+
this.setState({ logs });
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
try {
|
|
85
|
+
this.state.logs.forEach((log, i) => {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
(_a = this.widgets[i]) === null || _a === void 0 ? void 0 : _a.setContent((_b = log.logClient.buffers[0]) !== null && _b !== void 0 ? _b : 'asdsd');
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
console.log(e);
|
|
92
|
+
}
|
|
85
93
|
}
|
|
86
94
|
}
|
|
87
95
|
exports.RunningProcessLogs = RunningProcessLogs;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AsyncVoidFunction } from '@nu-art/ts-common';
|
|
2
|
+
export type PhasesImplementor<Phases extends Phase<string>[]> = {
|
|
3
|
+
[K in Phases[number]['method']]?: AsyncVoidFunction;
|
|
4
|
+
};
|
|
5
|
+
export type Phase<PhaseMethod extends string> = {
|
|
6
|
+
name?: string;
|
|
7
|
+
method: PhaseMethod;
|
|
8
|
+
};
|
|
9
|
+
export declare class ProjectManagerV2<Phases extends Phase<string>[]> {
|
|
10
|
+
private manageables;
|
|
11
|
+
phases: Phase<string>[];
|
|
12
|
+
constructor(...phases: Phases);
|
|
13
|
+
register(item: PhasesImplementor<Phases>): this;
|
|
14
|
+
execute(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectManagerV2 = void 0;
|
|
4
|
+
class ProjectManagerV2 {
|
|
5
|
+
constructor(...phases) {
|
|
6
|
+
this.manageables = [];
|
|
7
|
+
this.phases = [];
|
|
8
|
+
this.phases = phases;
|
|
9
|
+
}
|
|
10
|
+
register(item) {
|
|
11
|
+
this.manageables.push(item);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
async execute() {
|
|
15
|
+
var _a;
|
|
16
|
+
for (const phase of this.phases) {
|
|
17
|
+
for (const manageable of this.manageables) {
|
|
18
|
+
await ((_a = manageable[phase.method]) === null || _a === void 0 ? void 0 : _a.call(manageable));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ProjectManagerV2 = ProjectManagerV2;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/v2/test/test.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ProjectManagerV2_1 = require("../ProjectManagerV2");
|
|
4
|
+
const BasePackage_1 = require("../BasePackage");
|
|
5
|
+
const Phase_A = {
|
|
6
|
+
name: 'Compile',
|
|
7
|
+
method: 'compile'
|
|
8
|
+
};
|
|
9
|
+
const Phase_B = {
|
|
10
|
+
name: 'Launch',
|
|
11
|
+
method: 'launch'
|
|
12
|
+
};
|
|
13
|
+
const AllPhases = [
|
|
14
|
+
Phase_A,
|
|
15
|
+
Phase_B,
|
|
16
|
+
];
|
|
17
|
+
class Package_Typescript extends BasePackage_1.BasePackage {
|
|
18
|
+
}
|
|
19
|
+
class Package_Lib extends Package_Typescript {
|
|
20
|
+
constructor(name) {
|
|
21
|
+
super(name);
|
|
22
|
+
this.compile = async () => {
|
|
23
|
+
// compile fe custom to fe
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
class Package_FirebaseHosting extends Package_Typescript {
|
|
28
|
+
constructor(name) {
|
|
29
|
+
super(name);
|
|
30
|
+
this.launch = async () => {
|
|
31
|
+
// launch FE
|
|
32
|
+
};
|
|
33
|
+
this.compile = async () => {
|
|
34
|
+
// compile fe custom to fe
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class Package_FirebaseFunction extends Package_Typescript {
|
|
39
|
+
constructor(name) {
|
|
40
|
+
super(name);
|
|
41
|
+
this.launch = async () => {
|
|
42
|
+
// launch BE
|
|
43
|
+
};
|
|
44
|
+
this.compile = async () => {
|
|
45
|
+
// compile fe custom to fe
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const item1 = new Package_FirebaseHosting('item-1');
|
|
50
|
+
const item2 = new Package_Lib('item-2');
|
|
51
|
+
const item3 = new Package_FirebaseFunction('item-3');
|
|
52
|
+
new ProjectManagerV2_1.ProjectManagerV2(...AllPhases)
|
|
53
|
+
.register(item1)
|
|
54
|
+
.register(item2)
|
|
55
|
+
.register(item3)
|
|
56
|
+
.execute()
|
|
57
|
+
.then(() => console.log('completed'))
|
|
58
|
+
.catch((e) => console.error(e));
|