lavina 1.0.1 → 1.0.2
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/cli.js +38 -8
- package/package.json +6 -3
package/cli.js
CHANGED
|
@@ -9,13 +9,23 @@ import { spawn } from 'child_process';
|
|
|
9
9
|
import { getLibDirName } from './src/cli/helpers/getLibDirName.js';
|
|
10
10
|
import open from 'open';
|
|
11
11
|
import path from 'path';
|
|
12
|
+
import { existsSync, readFileSync } from 'fs';
|
|
13
|
+
|
|
14
|
+
const packageJson = JSON.parse(
|
|
15
|
+
readFileSync(new URL('./package.json', import.meta.url), 'utf8'),
|
|
16
|
+
);
|
|
12
17
|
|
|
13
18
|
const program = new Command();
|
|
14
19
|
|
|
20
|
+
const commonEnv = {
|
|
21
|
+
...process.env,
|
|
22
|
+
PROJECT_PATH: process.cwd(),
|
|
23
|
+
};
|
|
24
|
+
|
|
15
25
|
program
|
|
16
26
|
.name('lavina')
|
|
17
27
|
.description('lavina - automated dependency propagation tool')
|
|
18
|
-
.version(
|
|
28
|
+
.version(packageJson.version);
|
|
19
29
|
|
|
20
30
|
program
|
|
21
31
|
.command('scan')
|
|
@@ -30,7 +40,7 @@ program
|
|
|
30
40
|
|
|
31
41
|
const outputPath = saveDependencies(mappedProjects);
|
|
32
42
|
|
|
33
|
-
mappedProjects.
|
|
43
|
+
mappedProjects.forEach((project) => {
|
|
34
44
|
Logger.color(COLORS.YELLOW).log(
|
|
35
45
|
`\n- ${project.displayName}: ${project.version}`,
|
|
36
46
|
true,
|
|
@@ -49,6 +59,11 @@ program
|
|
|
49
59
|
`\nDependency map saved to: ${outputPath}\n`,
|
|
50
60
|
true,
|
|
51
61
|
);
|
|
62
|
+
|
|
63
|
+
Logger.color(COLORS.GREEN).log(
|
|
64
|
+
`\nRun lavina ui to explore the dependency graph in browser!`,
|
|
65
|
+
true,
|
|
66
|
+
);
|
|
52
67
|
});
|
|
53
68
|
|
|
54
69
|
program
|
|
@@ -56,7 +71,7 @@ program
|
|
|
56
71
|
.description('Show dependency graph in a web UI')
|
|
57
72
|
.action(async () => {
|
|
58
73
|
const { __dirname } = getLibDirName(import.meta.url);
|
|
59
|
-
const uiPath =
|
|
74
|
+
const uiPath = path.join(__dirname, 'lavina-ui');
|
|
60
75
|
Logger.color(COLORS.GREEN).log(
|
|
61
76
|
`Launching Lavina UI from ${uiPath}...`,
|
|
62
77
|
true,
|
|
@@ -69,18 +84,27 @@ program
|
|
|
69
84
|
'server.js',
|
|
70
85
|
);
|
|
71
86
|
|
|
72
|
-
const isBuilt =
|
|
87
|
+
const isBuilt = existsSync(standaloneServer);
|
|
88
|
+
|
|
89
|
+
let nextProcess;
|
|
90
|
+
|
|
91
|
+
if (!existsSync(uiPath)) {
|
|
92
|
+
Logger.color(COLORS.RED).log(`Lavina UI not found at ${uiPath}`, true);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
73
95
|
|
|
74
96
|
if (isBuilt) {
|
|
75
97
|
// published package
|
|
76
|
-
spawn('node', ['server.js'], {
|
|
98
|
+
nextProcess = spawn('node', ['server.js'], {
|
|
77
99
|
cwd: path.dirname(standaloneServer),
|
|
100
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
78
101
|
env: commonEnv,
|
|
79
102
|
});
|
|
80
103
|
} else {
|
|
81
104
|
// local development
|
|
82
|
-
spawn('npm', ['run', 'dev'], {
|
|
105
|
+
nextProcess = spawn('npm', ['run', 'dev'], {
|
|
83
106
|
cwd: uiPath,
|
|
107
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
84
108
|
shell: true,
|
|
85
109
|
env: commonEnv,
|
|
86
110
|
});
|
|
@@ -88,10 +112,16 @@ program
|
|
|
88
112
|
|
|
89
113
|
let isOpened = false;
|
|
90
114
|
nextProcess.stdout?.on('data', (data) => {
|
|
91
|
-
process.
|
|
115
|
+
process.stdout.write(data);
|
|
92
116
|
|
|
93
117
|
if (isOpened) return;
|
|
94
|
-
|
|
118
|
+
const text = data.toString();
|
|
119
|
+
|
|
120
|
+
if (
|
|
121
|
+
text.includes('Ready') ||
|
|
122
|
+
text.includes('ready') ||
|
|
123
|
+
text.includes('Local:')
|
|
124
|
+
) {
|
|
95
125
|
open('http://localhost:3000');
|
|
96
126
|
isOpened = true;
|
|
97
127
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lavina",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Lavina is an automated dependency propagation tool designed to scan microservice architectures and build dependency graphs between internal projects.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"dev": "npm unlink -g lavina && npm link"
|
|
8
|
+
"dev": "npm unlink -g lavina && npm link",
|
|
9
|
+
"release": "npm run build-ui && npm publish"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
11
12
|
"cli.js",
|
|
12
|
-
"src"
|
|
13
|
+
"src",
|
|
14
|
+
"lavina-ui/.next/standalone",
|
|
15
|
+
"lavina-ui/.next/static"
|
|
13
16
|
],
|
|
14
17
|
"author": "Elena Kikiova",
|
|
15
18
|
"license": "ISC",
|