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