https://github.com/andrejewski/independency
Source code dependency graph generator
https://github.com/andrejewski/independency
Last synced: 9 months ago
JSON representation
Source code dependency graph generator
- Host: GitHub
- URL: https://github.com/andrejewski/independency
- Owner: andrejewski
- License: isc
- Created: 2016-07-02T17:03:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-07T02:47:13.000Z (over 9 years ago)
- Last Synced: 2025-05-10T04:03:34.803Z (9 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Independency
Independency is a code dependency graph generator that is language agnostic and useful for doing project-wide static analysis.
```sh
npm install independency
```
```js
const assert = require('assert');
const independency = require('independency');
independency({
filepath: __filename,
shouldAddFile(info) {
return !info.path.contains('node_modules');
},
analyze(filepath, code) {
// see contrib/javascript for example
const imports = getImports(code);
const exports = getExports(code);
return {imports, exports};
}
}, (error, graph) => {
assert.equal(graph.path, __filename);
assert(Array.isArray(graph.imports));
assert(Array.isArray(graph.exports));
});
```