systemview 2.2.0 → 2.2.1
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/api/cli-history.json +1 -1
- package/cli/index.js +24 -11
- package/cli/launchApp.js +3 -1
- package/package.json +1 -1
package/api/cli-history.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
["test","test systemview-test"]
|
|
1
|
+
["test","test signUp","test systemview-test","list","help"]
|
package/cli/index.js
CHANGED
|
@@ -25,27 +25,40 @@ const DEFAULT_PORT = 3000;
|
|
|
25
25
|
const VERSION = require("../package.json").version;
|
|
26
26
|
const UI_URL = `http://localhost:${DEFAULT_PORT}`;
|
|
27
27
|
|
|
28
|
-
const MANIFEST_FILE =
|
|
28
|
+
const MANIFEST_FILE =
|
|
29
|
+
flags.manifest || path.join(process.cwd(), "systemview.manifest.json");
|
|
29
30
|
const connectedUrls = new Set();
|
|
30
31
|
|
|
31
|
-
function loadManifest() {
|
|
32
|
+
async function loadManifest() {
|
|
32
33
|
if (!fs.existsSync(MANIFEST_FILE)) return;
|
|
33
34
|
try {
|
|
34
35
|
const manifest = JSON.parse(fs.readFileSync(MANIFEST_FILE, "utf8"));
|
|
36
|
+
const { projectCode } = manifest;
|
|
35
37
|
const services = manifest.services || [manifest];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
log.info(`Reading manifest: ${projectCode} — ${services.length} service(s)`);
|
|
39
|
+
const api = `http://localhost:${DEFAULT_PORT}/systemview/api`;
|
|
40
|
+
const { SystemView } = await Client.loadService(api);
|
|
41
|
+
await Promise.all(
|
|
42
|
+
services.map(async ({ system, serviceId, specList }) => {
|
|
43
|
+
if (!system || !system.connectionData) return;
|
|
44
|
+
const alive = await appIsRunning(system.connectionData.serviceUrl);
|
|
45
|
+
if (alive) {
|
|
46
|
+
Client.createService(system.connectionData);
|
|
47
|
+
connectedUrls.add(system.connectionData.serviceUrl);
|
|
48
|
+
try { await SystemView.connect({ system, projectCode, serviceId, specList }); } catch {}
|
|
49
|
+
}
|
|
50
|
+
log.info(` ${serviceId || system.connectionData.serviceUrl} — ${alive ? "live" : "offline"}`);
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
53
|
+
} catch (err) {
|
|
54
|
+
log.warn("Failed to read manifest: " + err.message);
|
|
55
|
+
}
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
async function startApp() {
|
|
46
59
|
const port = isNaN(input[1]) ? DEFAULT_PORT : Number(input[1]);
|
|
47
60
|
try {
|
|
48
|
-
await launchApp(port, { interactive: true, connectedUrls,
|
|
61
|
+
await launchApp(port, { interactive: true, connectedUrls, onReady: loadManifest });
|
|
49
62
|
} catch (error) {
|
|
50
63
|
log.error("Launch failed: " + error.message);
|
|
51
64
|
}
|
|
@@ -56,6 +69,7 @@ async function startTest() {
|
|
|
56
69
|
const namespace = input[2];
|
|
57
70
|
try {
|
|
58
71
|
await launchApp(DEFAULT_PORT);
|
|
72
|
+
await loadManifest();
|
|
59
73
|
const exitCode = await runTests(UI_URL, project_code, namespace, {
|
|
60
74
|
json: flags.json,
|
|
61
75
|
verbose: flags.verbose,
|
|
@@ -137,7 +151,6 @@ async function quitApp() {
|
|
|
137
151
|
}
|
|
138
152
|
|
|
139
153
|
init();
|
|
140
|
-
loadManifest();
|
|
141
154
|
|
|
142
155
|
const command = input[0];
|
|
143
156
|
|
package/cli/launchApp.js
CHANGED
|
@@ -4,7 +4,7 @@ const launchSystemView = require("../api");
|
|
|
4
4
|
const startLineReader = require("./startLineReader");
|
|
5
5
|
const listTests = require("./listTests");
|
|
6
6
|
|
|
7
|
-
module.exports = async function launchApp(port, { interactive = false, connectedUrls = new Set() } = {}) {
|
|
7
|
+
module.exports = async function launchApp(port, { interactive = false, connectedUrls = new Set(), onReady } = {}) {
|
|
8
8
|
const ui = `http://localhost:${port}`;
|
|
9
9
|
const api = `${ui}/systemview/api`;
|
|
10
10
|
|
|
@@ -18,6 +18,7 @@ module.exports = async function launchApp(port, { interactive = false, connected
|
|
|
18
18
|
if (interactive) {
|
|
19
19
|
log.warn(`SystemView already running on port ${port} — attaching.`);
|
|
20
20
|
logConnection();
|
|
21
|
+
if (onReady) await onReady();
|
|
21
22
|
await listTests(ui, null, null, { connectedUrls });
|
|
22
23
|
return startLineReader(ui, { connectedUrls });
|
|
23
24
|
}
|
|
@@ -29,6 +30,7 @@ module.exports = async function launchApp(port, { interactive = false, connected
|
|
|
29
30
|
logConnection();
|
|
30
31
|
|
|
31
32
|
if (interactive) {
|
|
33
|
+
if (onReady) await onReady();
|
|
32
34
|
await listTests(ui, null, null, { connectedUrls });
|
|
33
35
|
return startLineReader(ui, { connectedUrls });
|
|
34
36
|
}
|