dep-brain 0.2.1 → 0.3.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 +5 -0
- package/depbrain.output.schema.json +112 -0
- package/dist/core/analyzer.d.ts +2 -0
- package/dist/core/analyzer.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -91,6 +91,10 @@ Suggestions:
|
|
|
91
91
|
dep-brain analyze --json
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
Output includes `outputVersion` for schema stability and can be validated with:
|
|
95
|
+
|
|
96
|
+
- `depbrain.output.schema.json`
|
|
97
|
+
|
|
94
98
|
## Markdown Output
|
|
95
99
|
|
|
96
100
|
```bash
|
|
@@ -147,6 +151,7 @@ Sample config file:
|
|
|
147
151
|
|
|
148
152
|
- `depbrain.config.json`
|
|
149
153
|
- `depbrain.config.schema.json`
|
|
154
|
+
- `depbrain.output.schema.json`
|
|
150
155
|
|
|
151
156
|
## CI Behavior
|
|
152
157
|
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Dependency Brain Analysis Output",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["outputVersion", "rootDir", "score", "scoreBreakdown", "policy", "duplicates", "unused", "outdated", "risks", "suggestions", "config"],
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"outputVersion": { "type": "string" },
|
|
9
|
+
"rootDir": { "type": "string" },
|
|
10
|
+
"score": { "type": "number" },
|
|
11
|
+
"scoreBreakdown": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"required": ["baseScore", "duplicates", "outdated", "unused", "risks", "weights"],
|
|
14
|
+
"additionalProperties": false,
|
|
15
|
+
"properties": {
|
|
16
|
+
"baseScore": { "type": "number" },
|
|
17
|
+
"duplicates": { "type": "number" },
|
|
18
|
+
"outdated": { "type": "number" },
|
|
19
|
+
"unused": { "type": "number" },
|
|
20
|
+
"risks": { "type": "number" },
|
|
21
|
+
"weights": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["duplicateWeight", "outdatedWeight", "unusedWeight", "riskWeight"],
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"properties": {
|
|
26
|
+
"duplicateWeight": { "type": "number" },
|
|
27
|
+
"outdatedWeight": { "type": "number" },
|
|
28
|
+
"unusedWeight": { "type": "number" },
|
|
29
|
+
"riskWeight": { "type": "number" }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"policy": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"required": ["passed", "reasons"],
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"properties": {
|
|
39
|
+
"passed": { "type": "boolean" },
|
|
40
|
+
"reasons": { "type": "array", "items": { "type": "string" } }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"duplicates": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"required": ["name", "versions", "instances"],
|
|
48
|
+
"additionalProperties": false,
|
|
49
|
+
"properties": {
|
|
50
|
+
"name": { "type": "string" },
|
|
51
|
+
"versions": { "type": "array", "items": { "type": "string" } },
|
|
52
|
+
"instances": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"required": ["path", "version"],
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"properties": {
|
|
59
|
+
"path": { "type": "string" },
|
|
60
|
+
"version": { "type": "string" }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"unused": {
|
|
68
|
+
"type": "array",
|
|
69
|
+
"items": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"required": ["name", "section"],
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"properties": {
|
|
74
|
+
"name": { "type": "string" },
|
|
75
|
+
"section": { "type": "string", "enum": ["dependencies", "devDependencies"] },
|
|
76
|
+
"package": { "type": "string" }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"outdated": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"items": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"required": ["name", "current", "latest", "updateType"],
|
|
85
|
+
"additionalProperties": false,
|
|
86
|
+
"properties": {
|
|
87
|
+
"name": { "type": "string" },
|
|
88
|
+
"current": { "type": "string" },
|
|
89
|
+
"latest": { "type": "string" },
|
|
90
|
+
"updateType": { "type": "string" },
|
|
91
|
+
"package": { "type": "string" }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"risks": {
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"required": ["name", "reasons"],
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"properties": {
|
|
102
|
+
"name": { "type": "string" },
|
|
103
|
+
"reasons": { "type": "array", "items": { "type": "string" } },
|
|
104
|
+
"package": { "type": "string" }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"suggestions": { "type": "array", "items": { "type": "string" } },
|
|
109
|
+
"config": { "type": "object" },
|
|
110
|
+
"packages": { "type": "array" }
|
|
111
|
+
}
|
|
112
|
+
}
|
package/dist/core/analyzer.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export interface RiskDependency {
|
|
|
31
31
|
package?: string;
|
|
32
32
|
}
|
|
33
33
|
export interface AnalysisResult {
|
|
34
|
+
outputVersion: string;
|
|
34
35
|
rootDir: string;
|
|
35
36
|
score: number;
|
|
36
37
|
scoreBreakdown: ScoreBreakdown;
|
|
@@ -59,6 +60,7 @@ export interface PackageAnalysisResult {
|
|
|
59
60
|
risks: RiskDependency[];
|
|
60
61
|
suggestions: string[];
|
|
61
62
|
}
|
|
63
|
+
export declare const OUTPUT_VERSION = "1.0";
|
|
62
64
|
export interface ScoreBreakdown {
|
|
63
65
|
baseScore: number;
|
|
64
66
|
duplicates: number;
|
package/dist/core/analyzer.js
CHANGED
|
@@ -7,6 +7,7 @@ import { loadDepBrainConfig } from "../utils/config.js";
|
|
|
7
7
|
import { findWorkspacePackages } from "../utils/workspaces.js";
|
|
8
8
|
import { buildDependencyGraph } from "./graph-builder.js";
|
|
9
9
|
import { calculateHealthScore } from "./scorer.js";
|
|
10
|
+
export const OUTPUT_VERSION = "1.0";
|
|
10
11
|
export async function analyzeProject(options = {}) {
|
|
11
12
|
const rootDir = path.resolve(options.rootDir ?? process.cwd());
|
|
12
13
|
const loadedConfig = await loadDepBrainConfig(rootDir, options.configPath);
|
|
@@ -55,6 +56,7 @@ export async function analyzeProject(options = {}) {
|
|
|
55
56
|
risks: risks.length
|
|
56
57
|
}, config);
|
|
57
58
|
return {
|
|
59
|
+
outputVersion: OUTPUT_VERSION,
|
|
58
60
|
rootDir,
|
|
59
61
|
score,
|
|
60
62
|
scoreBreakdown,
|
|
@@ -172,6 +174,7 @@ async function analyzeSingleProject(rootDir, config, options = {}) {
|
|
|
172
174
|
? risks.map((item) => ({ ...item, package: options.packageName }))
|
|
173
175
|
: risks;
|
|
174
176
|
return {
|
|
177
|
+
outputVersion: OUTPUT_VERSION,
|
|
175
178
|
rootDir,
|
|
176
179
|
score,
|
|
177
180
|
scoreBreakdown,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { analyzeProject } from "./core/analyzer.js";
|
|
2
2
|
export type { AnalysisOptions, AnalysisResult, DuplicateDependency, OutdatedDependency, PolicyResult, PackageAnalysisResult, ScoreBreakdown, RiskDependency, UnusedDependency } from "./core/analyzer.js";
|
|
3
|
+
export { OUTPUT_VERSION } from "./core/analyzer.js";
|
|
3
4
|
export type { DepBrainConfig, DepBrainConfigOverrides } from "./utils/config.js";
|
|
4
5
|
export type { WorkspacePackage } from "./utils/workspaces.js";
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dep-brain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "CLI and library for dependency health analysis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"LICENSE",
|
|
15
15
|
"CHANGELOG.md",
|
|
16
16
|
"depbrain.config.json",
|
|
17
|
-
"depbrain.config.schema.json"
|
|
17
|
+
"depbrain.config.schema.json",
|
|
18
|
+
"depbrain.output.schema.json"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
21
|
"build": "tsc -p tsconfig.json",
|