Dependency viewer across nodejs projects
1. Support
Currently the project has support for:
- [x] Gitlab
- [ ] Github
- [ ] Bitbucket
2. Install
npm install dependency-viewer
3. Usage
const Gitlab = require('./lib/wrappers/Gitlab');
const GraphBuilder = require('./lib/GraphBuilder');
const gitlab = new Gitlab('organization', { token: 'super-secret-token' });
const graphBuilder = new GraphBuilder(gitlab);
graphBuilder.buildDependencyGraph({
wrapperOptions: {
excludeProjects: [],
packageInclude: '',
packagePrefix: '',
},
}).then(async (dependencyGraphs) => {
// do something with your dependecy graphs
});
4. API
Classes
- GraphBuilder
-
GraphBuilder builds the dependency graph given a wrapper
- GitlabWrapper
-
GitlabWrapper implements all the communication with Gitlab api
- Wrapper
-
Wrapper extend it when implementing a Wrapper
GraphBuilder
GraphBuilder builds the dependency graph given a wrapper
new GraphBuilder(wrapper)
Create new GraphBuilder
Param | Type |
---|---|
wrapper | Wrapper |
Object
graphBuilder.buildDependencyGraph(wrapperOptions) ⇒ build the dependency graph
Kind: instance method of GraphBuilder
Returns: Object
- all dependencies {allDepsGraph, proDepsGraph, devDepsGraph }
Param | Type |
---|---|
wrapperOptions | Object |
GitlabWrapper
GitlabWrapper implements all the communication with Gitlab api
new GitlabWrapper([organization], options)
Create new GitlabWrapper
Param | Type | Default | Description |
---|---|---|---|
[organization] | String |
'' |
name of organization |
options | Object |
options object | |
[options.protocol] | String |
https |
protocol to be used |
[options.domain] | String |
gitlab.com |
domain to be used |
options.token | String |
token from Gitlab |
Object
gitlabWrapper.getAllPackages(options) ⇒ Get all package.json from gitlab projects
Kind: instance method of GitlabWrapper
Returns: Object
- All dependencies objects
Param | Type | Default | Description |
---|---|---|---|
options | Object |
options object | |
[options.excludeProjects] | Array.<String> |
[] |
array of strings representing projects to exclude |
[options.packagePrefix] | String |
'' |
inlcude packages that have this prefix in their name. Useful for organization packages |
[options.packageInclude] | String |
'' |
include packages that contain this this in their name |
Wrapper
Wrapper extend it when implementing a Wrapper
wrapper.getAllPackages(options)
Kind: instance method of Wrapper
Param | Type | Description |
---|---|---|
options | Object |
options object |
options.excludeProjects | Array.<String> |
array of strings representing projects to exclude |
options.packagePrefix | String |
inlcude packages that have this prefix in their name. Useful for organization packages |
options.packageInclude | String |
include packages that contain this this in their name |