ghcr-manager-visualizer 0.0.1-dev.0
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/README.md +45 -0
- package/dist/public/app.js +839 -0
- package/dist/public/index.html +116 -0
- package/dist/public/styles.css +235 -0
- package/dist/src/_graph-repository.d.ts +18 -0
- package/dist/src/_graph-repository.js +399 -0
- package/dist/src/_server.d.ts +14 -0
- package/dist/src/_server.js +158 -0
- package/dist/src/_sql-placeholders.d.ts +1 -0
- package/dist/src/_sql-placeholders.js +6 -0
- package/dist/src/_types.d.ts +62 -0
- package/dist/src/_types.js +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +60 -0
- package/package.json +47 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { isAbsolute, resolve } from "node:path";
|
|
2
|
+
import { startVisualizerServer } from "./_server.js";
|
|
3
|
+
export async function main(args, startServer = startVisualizerServer) {
|
|
4
|
+
const options = parseArgs(args);
|
|
5
|
+
const server = await startServer({
|
|
6
|
+
databasePath: resolveDatabasePath(options.databasePath),
|
|
7
|
+
host: options.host,
|
|
8
|
+
port: options.port
|
|
9
|
+
});
|
|
10
|
+
const shutdown = async () => {
|
|
11
|
+
process.removeListener("SIGINT", shutdown);
|
|
12
|
+
await server.close();
|
|
13
|
+
};
|
|
14
|
+
process.on("SIGINT", shutdown);
|
|
15
|
+
}
|
|
16
|
+
export function parseArgs(args) {
|
|
17
|
+
let databasePath;
|
|
18
|
+
let host = "127.0.0.1";
|
|
19
|
+
let port = 0;
|
|
20
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
21
|
+
const arg = args[index];
|
|
22
|
+
const value = args[index + 1];
|
|
23
|
+
if (arg === "--db" && value) {
|
|
24
|
+
databasePath = value;
|
|
25
|
+
index += 1;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (arg === "--host" && value) {
|
|
29
|
+
host = value;
|
|
30
|
+
index += 1;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (arg === "--port" && value) {
|
|
34
|
+
port = Number.parseInt(value, 10);
|
|
35
|
+
index += 1;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`unknown or incomplete argument: ${arg}`);
|
|
39
|
+
}
|
|
40
|
+
if (!databasePath) {
|
|
41
|
+
throw new Error("missing required option: --db");
|
|
42
|
+
}
|
|
43
|
+
if (!Number.isInteger(port) || port < 0) {
|
|
44
|
+
throw new Error(`invalid port: ${port}`);
|
|
45
|
+
}
|
|
46
|
+
return { databasePath, host, port };
|
|
47
|
+
}
|
|
48
|
+
export function resolveDatabasePath(databasePath) {
|
|
49
|
+
if (isAbsolute(databasePath)) {
|
|
50
|
+
return databasePath;
|
|
51
|
+
}
|
|
52
|
+
const invocationRoot = process.env.INIT_CWD;
|
|
53
|
+
if (invocationRoot) {
|
|
54
|
+
return resolve(invocationRoot, databasePath);
|
|
55
|
+
}
|
|
56
|
+
return resolve(databasePath);
|
|
57
|
+
}
|
|
58
|
+
if (process.argv[1] && import.meta.url === new URL(`file://${process.argv[1]}`).href) {
|
|
59
|
+
await main(process.argv.slice(2));
|
|
60
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ghcr-manager-visualizer",
|
|
3
|
+
"version": "0.0.1-dev.0",
|
|
4
|
+
"description": "Inspect ghcr-manager SQLite scan databases in a local browser graph visualizer.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"homepage": "https://github.com/ghcr-manager/ghcr-manager#readme",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/ghcr-manager/ghcr-manager/issues"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/ghcr-manager/ghcr-manager"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=24.0.0"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/public",
|
|
20
|
+
"dist/src",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"bin": {
|
|
24
|
+
"ghcr-manager-visualizer": "./dist/src/index.js"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc --project tsconfig.json && node scripts/copy-public.mjs",
|
|
28
|
+
"dev": "tsx src/index.ts",
|
|
29
|
+
"start": "node dist/src/index.js",
|
|
30
|
+
"typecheck": "tsc --noEmit --project tsconfig.json",
|
|
31
|
+
"lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
32
|
+
"test": "bash -lc 'shopt -s globstar nullglob; node --import tsx --test tests/**/*.test.ts'"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"better-sqlite3": "^12.9.0",
|
|
36
|
+
"cytoscape": "^3.34.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
40
|
+
"@types/node": "^24.12.4",
|
|
41
|
+
"eslint": "^10.2.1",
|
|
42
|
+
"globals": "^17.5.0",
|
|
43
|
+
"tsx": "^4.20.6",
|
|
44
|
+
"typescript": "^6.0.3",
|
|
45
|
+
"typescript-eslint": "^8.46.2"
|
|
46
|
+
}
|
|
47
|
+
}
|