CoolFace
Apppublic

TrinetraLabs/Placebo_AI

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
deps.js38 linesDownload Raw Back to jszip
1"use strict";2 3const madge = require("madge");4const path = require("path");5const ts = require("typescript");6 7const DIR = "./lib";8 9async function main() {10    const tsconfigPath = ts.findConfigFile("./", ts.sys.fileExists);11    const tsconfig = ts.readConfigFile(tsconfigPath, ts.sys.readFile).config;12    const parsedConfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, "./");13    const typedPaths = parsedConfig.fileNames.map(filename => path.resolve("./", filename));14 15    const excludeTypedPaths = path => !typedPaths.includes(path);16 17    const res = await madge(DIR, {18        dependencyFilter: excludeTypedPaths19    });20 21    const untypedLeaves = res.leaves().map(filename => path.resolve(DIR, filename)).filter(excludeTypedPaths);22    if (untypedLeaves.length) {23        console.log("Convert next:");24        console.log(untypedLeaves.join("\n"));25    } else {26        console.log("No untyped leaf dependencies found.");27        console.log("Try looking at circular dependencies, or the image to decide what to convert next:");28        const untypedCircular = res.circular().flat().map(filename => path.resolve(DIR, filename)).filter(excludeTypedPaths);29        console.log(untypedCircular.join("\n"));30    }31 32    const imagePath = await res.image("graph.svg");33    console.log();34    console.log("Image written to " + imagePath);35}36 37main();38