dependency-cruiser 16.10.2 → 16.10.3
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/bin/depcruise-baseline.mjs +51 -25
- package/bin/depcruise-fmt.mjs +110 -66
- package/package.json +5 -5
- package/src/meta.cjs +1 -1
|
@@ -1,43 +1,69 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
3
|
+
import { parseArgs } from "node:util";
|
|
3
4
|
import assertNodeEnvironmentSuitable from "#cli/assert-node-environment-suitable.mjs";
|
|
4
5
|
import cli from "#cli/index.mjs";
|
|
5
6
|
import meta from "#meta.cjs";
|
|
6
7
|
|
|
7
|
-
function
|
|
8
|
-
process.
|
|
9
|
-
|
|
8
|
+
function showHelp() {
|
|
9
|
+
process.stdout
|
|
10
|
+
.write(`Usage: depcruise-baseline [options] <files-or-directories...>
|
|
11
|
+
|
|
12
|
+
Writes all known violations of rules in a .dependency-cruiser.js to a file.
|
|
13
|
+
Alias for depcruise -c -T baseline -f .dependency-cruiser-known-violations.json [files-or-directories]
|
|
14
|
+
Details: https://github.com/sverweij/dependency-cruiser
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
-c, --config [file] read rules and options from [file] (default: true)
|
|
18
|
+
-f, --output-to [file] file to write output to; - for stdout (default: ".dependency-cruiser-known-violations.json")
|
|
19
|
+
-V, --version display version number
|
|
20
|
+
-h, --help display help for command
|
|
21
|
+
`);
|
|
10
22
|
}
|
|
11
23
|
|
|
12
24
|
try {
|
|
13
25
|
assertNodeEnvironmentSuitable();
|
|
14
26
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const { values: options, positionals } = parseArgs({
|
|
28
|
+
options: {
|
|
29
|
+
config: {
|
|
30
|
+
type: "string",
|
|
31
|
+
short: "c",
|
|
32
|
+
default: "",
|
|
33
|
+
},
|
|
34
|
+
"output-to": {
|
|
35
|
+
type: "string",
|
|
36
|
+
short: "f",
|
|
37
|
+
default: ".dependency-cruiser-known-violations.json",
|
|
38
|
+
},
|
|
39
|
+
version: {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
short: "V",
|
|
42
|
+
},
|
|
43
|
+
help: {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
short: "h",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
allowPositionals: true,
|
|
49
|
+
});
|
|
30
50
|
|
|
31
|
-
if (
|
|
32
|
-
process.
|
|
33
|
-
|
|
51
|
+
if (options.version) {
|
|
52
|
+
process.stdout.write(`${meta.version}\n`);
|
|
53
|
+
} else if (options.help || positionals.length === 0) {
|
|
54
|
+
showHelp();
|
|
55
|
+
} else {
|
|
56
|
+
if (options.config === "") {
|
|
57
|
+
options.config = true;
|
|
58
|
+
}
|
|
59
|
+
process.exitCode = await cli(positionals, {
|
|
60
|
+
config: options.config,
|
|
61
|
+
outputTo: options["output-to"],
|
|
34
62
|
cache: false,
|
|
35
63
|
outputType: "baseline",
|
|
36
64
|
});
|
|
37
|
-
} else {
|
|
38
|
-
program.help();
|
|
39
65
|
}
|
|
40
66
|
} catch (pError) {
|
|
41
|
-
|
|
67
|
+
process.stderr.write(pError.message);
|
|
42
68
|
process.exitCode = 1;
|
|
43
69
|
}
|
package/bin/depcruise-fmt.mjs
CHANGED
|
@@ -1,82 +1,126 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
3
|
+
import { parseArgs } from "node:util";
|
|
4
4
|
import assertNodeEnvironmentSuitable from "#cli/assert-node-environment-suitable.mjs";
|
|
5
5
|
import format from "#cli/format.mjs";
|
|
6
6
|
import meta from "#meta.cjs";
|
|
7
7
|
|
|
8
|
-
function
|
|
9
|
-
process.
|
|
10
|
-
|
|
8
|
+
function showHelp() {
|
|
9
|
+
process.stdout.write(`Usage: depcruise-fmt [options] <dependency-cruiser-json>
|
|
10
|
+
|
|
11
|
+
Format dependency-cruiser output json.
|
|
12
|
+
Details: https://github.com/sverweij/dependency-cruiser
|
|
13
|
+
|
|
14
|
+
Options:
|
|
15
|
+
-f, --output-to <file> file to write output to; - for stdout (default: "-")
|
|
16
|
+
-T, --output-type <type> output type; e.g. err, err-html, dot, ddot, archi, flat,
|
|
17
|
+
d2, mermaid or json (default: "err")
|
|
18
|
+
-I, --include-only <regex> only include modules matching the regex
|
|
19
|
+
-F, --focus <regex> only include modules matching the regex + their direct neighbours
|
|
20
|
+
--focus-depth <number> the depth to focus on - only applied when --focus is passed too.
|
|
21
|
+
1= direct neighbors, 2=neighbours of neighbours etc. (default: 1)
|
|
22
|
+
-R, --reaches <regex> only include modules matching the regex + all modules that can reach it
|
|
23
|
+
-H, --highlight <regex> mark modules matching the regex as 'highlighted'
|
|
24
|
+
-x, --exclude <regex> exclude all modules matching the regex
|
|
25
|
+
-S, --collapse <regex> collapse to a folder depth by passing a single digit (e.g. 2). Or
|
|
26
|
+
pass a regex to collapse to a pattern E.g. ^packages/[^/]+/ would
|
|
27
|
+
collapse to modules/ folders directly under your packages folder.
|
|
28
|
+
-P, --prefix <prefix> prefix to use for links in the dot and err-html reporters
|
|
29
|
+
-e, --exit-code exit with a non-zero exit code when the input json contains error
|
|
30
|
+
level dependency violations. Works for err, err-long and teamcity
|
|
31
|
+
output types
|
|
32
|
+
-V, --version display version number
|
|
33
|
+
-h, --help display help for command
|
|
34
|
+
`);
|
|
11
35
|
}
|
|
12
36
|
|
|
13
37
|
try {
|
|
14
38
|
assertNodeEnvironmentSuitable();
|
|
15
39
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"-"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
40
|
+
const { values: options, positionals } = parseArgs({
|
|
41
|
+
options: {
|
|
42
|
+
"output-to": {
|
|
43
|
+
type: "string",
|
|
44
|
+
short: "f",
|
|
45
|
+
default: "-",
|
|
46
|
+
},
|
|
47
|
+
"output-type": {
|
|
48
|
+
type: "string",
|
|
49
|
+
short: "T",
|
|
50
|
+
default: "err",
|
|
51
|
+
},
|
|
52
|
+
"include-only": {
|
|
53
|
+
type: "string",
|
|
54
|
+
short: "I",
|
|
55
|
+
},
|
|
56
|
+
focus: {
|
|
57
|
+
type: "string",
|
|
58
|
+
short: "F",
|
|
59
|
+
},
|
|
60
|
+
"focus-depth": {
|
|
61
|
+
type: "string",
|
|
62
|
+
default: "1",
|
|
63
|
+
},
|
|
64
|
+
reaches: {
|
|
65
|
+
type: "string",
|
|
66
|
+
short: "R",
|
|
67
|
+
},
|
|
68
|
+
highlight: {
|
|
69
|
+
type: "string",
|
|
70
|
+
short: "H",
|
|
71
|
+
},
|
|
72
|
+
exclude: {
|
|
73
|
+
type: "string",
|
|
74
|
+
short: "x",
|
|
75
|
+
},
|
|
76
|
+
collapse: {
|
|
77
|
+
type: "string",
|
|
78
|
+
short: "S",
|
|
79
|
+
},
|
|
80
|
+
prefix: {
|
|
81
|
+
type: "string",
|
|
82
|
+
short: "P",
|
|
83
|
+
},
|
|
84
|
+
"exit-code": {
|
|
85
|
+
type: "boolean",
|
|
86
|
+
short: "e",
|
|
87
|
+
},
|
|
88
|
+
version: {
|
|
89
|
+
type: "boolean",
|
|
90
|
+
short: "V",
|
|
91
|
+
},
|
|
92
|
+
help: {
|
|
93
|
+
type: "boolean",
|
|
94
|
+
short: "h",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
allowPositionals: true,
|
|
98
|
+
});
|
|
71
99
|
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
100
|
+
if (options.version) {
|
|
101
|
+
process.stdout.write(`${meta.version}\n`);
|
|
102
|
+
} else if (options.help || positionals.length === 0) {
|
|
103
|
+
showHelp();
|
|
104
|
+
} else {
|
|
105
|
+
const lFormatOptions = {
|
|
106
|
+
...options,
|
|
107
|
+
outputTo: options["output-to"],
|
|
108
|
+
outputType: options["output-type"],
|
|
109
|
+
includeOnly: options["include-only"],
|
|
110
|
+
focusDepth: options["focus-depth"],
|
|
111
|
+
exitCode: options["exit-code"],
|
|
112
|
+
};
|
|
113
|
+
delete lFormatOptions["output-to"];
|
|
114
|
+
delete lFormatOptions["output-type"];
|
|
115
|
+
delete lFormatOptions["include-only"];
|
|
116
|
+
delete lFormatOptions["focus-depth"];
|
|
117
|
+
delete lFormatOptions["exit-code"];
|
|
118
|
+
const lExitCode = await format(positionals[0], lFormatOptions);
|
|
119
|
+
if (lFormatOptions.exitCode) {
|
|
75
120
|
process.exitCode = lExitCode;
|
|
76
121
|
}
|
|
77
|
-
} else {
|
|
78
|
-
program.help();
|
|
79
122
|
}
|
|
80
123
|
} catch (pError) {
|
|
81
|
-
|
|
124
|
+
process.stderr.write(pError.message);
|
|
125
|
+
process.exitCode = 1;
|
|
82
126
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dependency-cruiser",
|
|
3
|
-
"version": "16.10.
|
|
3
|
+
"version": "16.10.3",
|
|
4
4
|
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"static analysis",
|
|
@@ -140,15 +140,15 @@
|
|
|
140
140
|
"README.md"
|
|
141
141
|
],
|
|
142
142
|
"dependencies": {
|
|
143
|
-
"acorn": "^8.
|
|
143
|
+
"acorn": "^8.15.0",
|
|
144
144
|
"acorn-jsx": "^5.3.2",
|
|
145
145
|
"acorn-jsx-walk": "^2.0.0",
|
|
146
|
-
"acorn-loose": "^8.5.
|
|
146
|
+
"acorn-loose": "^8.5.1",
|
|
147
147
|
"acorn-walk": "^8.3.4",
|
|
148
148
|
"ajv": "^8.17.1",
|
|
149
149
|
"commander": "^13.1.0",
|
|
150
150
|
"enhanced-resolve": "^5.18.1",
|
|
151
|
-
"ignore": "^7.0.
|
|
151
|
+
"ignore": "^7.0.5",
|
|
152
152
|
"interpret": "^3.1.1",
|
|
153
153
|
"is-installed-globally": "^1.0.0",
|
|
154
154
|
"json5": "^2.2.3",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"prompts": "^2.4.2",
|
|
159
159
|
"rechoir": "^0.8.0",
|
|
160
160
|
"safe-regex": "^2.1.1",
|
|
161
|
-
"semver": "^7.7.
|
|
161
|
+
"semver": "^7.7.2",
|
|
162
162
|
"teamcity-service-messages": "^0.1.14",
|
|
163
163
|
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
164
164
|
"watskeburt": "^4.2.3"
|