Open
Description
What problem are you trying to solve?
Since v4.0.0, if one wants to integrate code-complexity
with another program, the recommended solution is to use the json
flag, example:
const { execSync } = require("fs");
const raw = execSync("npx code-complexity ../foo/bar --format=json");
const result = JSON.parse(raw);
Which is not ideal since it feels a bit hacky and the datastructure is unknown from a user point of view.
Describe the feature
A cool way to do things would be to be able to import code-complexity
as a dependency, example:
const codeComplexity = require('code-complexity');
const options = { directory: '../foo/bar' };
const result = await codeComplexity.compute(options);
I initially planned that feature for v4.0.0
but struggled with the TypeScript module system. Help definitely wanted :)