Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/debitoor/parse-dependencies


https://github.com/debitoor/parse-dependencies

Last synced: 12 days ago
JSON representation

Awesome Lists containing this project

README

        

# parse-dependencies
Fast and easy way to get dependencies for your code.

[![npm version](https://badge.fury.io/js/@debitoor/parse-dependencies.svg)](http://badge.fury.io/js/@debitoor/parse-dependencies) [![Build Status](https://travis-ci.org/debitoor/parse-dependencies.svg?branch=master)](https://travis-ci.org/debitoor/parse-dependencies) [![Dependency Status](https://david-dm.org/debitoor/parse-dependencies.svg)](https://david-dm.org/debitoor/parse-dependencies) [![devDependency Status](https://david-dm.org/debitoor/parse-dependencies/dev-status.svg)](https://david-dm.org/debitoor/parse-dependencies#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/debitoor/parse-dependencies/badge.svg?branch=master&service=github)](https://coveralls.io/github/debitoor/parse-dependencies?branch=master)

## Install
npm i -SE @debitoor/parse-dependencies

## Usage
```js
const parse = require('@debitoor/parse-dependencies');
parse(__dirname + '/server.js', function (err, deps) {
console.log(deps); // 'express', 'body-parser' ...
});
```

You can compare result with you production dependencies
```js
const parse = require('@debitoor/parse-dependencies');
const packageDeps = require('./package').dependencies;

parse(__dirname + '/server.js', function (err, deps) {
const diff = deps.filter(function (item) {
return !(item in packageDeps);
});
if (diff.length) {
console.log('oops. You have missing depencies\n%s', diff.join());
}
});
```