dependency-radar 0.7.0 → 0.8.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.
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.runLicenseChecker = runLicenseChecker;
7
- const path_1 = __importDefault(require("path"));
8
- const utils_1 = require("../utils");
9
- async function runLicenseChecker(projectPath, tempDir) {
10
- const targetFile = path_1.default.join(tempDir, 'license-checker.json');
11
- const bin = (0, utils_1.findBin)(projectPath, 'license-checker');
12
- try {
13
- const result = await (0, utils_1.runCommand)(bin, ['--json'], { cwd: projectPath });
14
- let parsed;
15
- try {
16
- parsed = JSON.parse(result.stdout || '{}');
17
- }
18
- catch (err) {
19
- parsed = undefined;
20
- }
21
- if (parsed) {
22
- await (0, utils_1.writeJsonFile)(targetFile, parsed);
23
- return { ok: true, data: parsed, file: targetFile };
24
- }
25
- await (0, utils_1.writeJsonFile)(targetFile, { stdout: result.stdout, stderr: result.stderr, code: result.code });
26
- const error = result.code && result.code !== 0 ? `license-checker exited with code ${result.code}` : 'Failed to parse license-checker output';
27
- return { ok: false, error, file: targetFile };
28
- }
29
- catch (err) {
30
- await (0, utils_1.writeJsonFile)(targetFile, { error: String(err) });
31
- return { ok: false, error: `license-checker failed: ${String(err)}`, file: targetFile };
32
- }
33
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.runMadge = runMadge;
7
- const path_1 = __importDefault(require("path"));
8
- const madge_1 = __importDefault(require("madge"));
9
- const utils_1 = require("../utils");
10
- async function runMadge(projectPath, tempDir) {
11
- const targetFile = path_1.default.join(tempDir, 'madge.json');
12
- try {
13
- const srcPath = path_1.default.join(projectPath, 'src');
14
- const hasSrc = await (0, utils_1.pathExists)(srcPath);
15
- const entry = hasSrc ? srcPath : projectPath;
16
- const result = await (0, madge_1.default)(entry, {
17
- baseDir: projectPath,
18
- includeNpm: true,
19
- excludeRegExp: [/node_modules/, /dist/, /build/, /coverage/, /.dependency-radar/]
20
- });
21
- const graph = await result.obj();
22
- await (0, utils_1.writeJsonFile)(targetFile, graph);
23
- return { ok: true, data: graph, file: targetFile };
24
- }
25
- catch (err) {
26
- await (0, utils_1.writeJsonFile)(targetFile, { error: String(err) });
27
- return { ok: false, error: `madge failed: ${String(err)}`, file: targetFile };
28
- }
29
- }