1.0.2 • Published 4 years ago

dependency-viewer v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Node.js CI

Dependency viewer across nodejs projects

1. Support

Currently the project has support for:

  • 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

GraphBuilder

new GraphBuilder(wrapper)

Create new GraphBuilder

ParamType
wrapperWrapper

graphBuilder.buildDependencyGraph(wrapperOptions) ⇒ Object

build the dependency graph

Kind: instance method of GraphBuilder

Returns: Object - all dependencies {allDepsGraph, proDepsGraph, devDepsGraph }

ParamType
wrapperOptionsObject

GitlabWrapper

GitlabWrapper implements all the communication with Gitlab api

GitlabWrapper

new GitlabWrapper(organization, options)

Create new GitlabWrapper

ParamTypeDefaultDescription
organizationString''name of organization
optionsObjectoptions object
options.protocolStringhttpsprotocol to be used
options.domainStringgitlab.comdomain to be used
options.tokenStringtoken from Gitlab

gitlabWrapper.getAllPackages(options) ⇒ Object

Get all package.json from gitlab projects

Kind: instance method of GitlabWrapper

Returns: Object - All dependencies objects

ParamTypeDefaultDescription
optionsObjectoptions object
options.excludeProjectsArray.<String>[]array of strings representing projects to exclude
options.packagePrefixString''inlcude packages that have this prefix in their name. Useful for organization packages
options.packageIncludeString''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

ParamTypeDescription
optionsObjectoptions object
options.excludeProjectsArray.<String>array of strings representing projects to exclude
options.packagePrefixStringinlcude packages that have this prefix in their name. Useful for organization packages
options.packageIncludeStringinclude packages that contain this this in their name