Coder Social home page Coder Social logo

vovacodes / find-duplicate-dependencies Goto Github PK

View Code? Open in Web Editor NEW
35.0 1.0 4.0 84 KB

Find duplicate dependencies in your node_modules. Useful when use npm as a package manager for front-end.

Home Page: https://www.npmjs.com/package/find-duplicate-dependencies

JavaScript 100.00%

find-duplicate-dependencies's Introduction

find-duplicate-dependencies

Finds duplicate dependencies in your node_modules. Useful when use npm as a package manager for front-end.

Install

for CLI usage

npm install -g find-duplicate-dependencies

for API usage

npm install find-duplicate-dependencies

Usage

CLI

find-duplicate-dependencies

This command exits with 1 if there are some duplicates and with 0 if there are not.

You can exclude some dependencies from check by passing --exclude option:

find-duplicate-dependencies --exclude express,react

API

const findDuplicateDependencies = require('find-duplicate-dependencies');

findDuplicateDependencies().then((duplicates) => {
  /*
  duplicates has the following format:

  {
    "tar": [
      {
        name: 'tar',
        version: '1.0.3',
        from: 'tar@>=1.0.0 <2.0.0',
        path: 'test/npm/node-gyp'
      },
      {
        name: 'tar',
        version: '2.1.1',
        from: 'tar@>=2.1.1 <2.2.0',
        path: 'test/npm'
      }
    ],
    "mime-types": [
      {
        name: 'mime-types',
        version: '2.1.2',
        from: 'mime-types@>=2.1.1 <3.0.0',
        path: 'test/npm/request/form-data'
      },
      {
        name: 'mime-types',
        version: '2.0.14',
        from: 'mime-types@>=2.0.1 <2.1.0',
        path: 'test/npm/request'
      }
    ]
  }
  */

  if (Object.keys(duplicates).length > 0) {
    printFailMessage(duplicates);
    return process.exit(1);
  }

  printSuccessMessage();
}).catch((error) => {
  console.error(error.stack);
  return process.exit(1);
});

find-duplicate-dependencies's People

Contributors

chrishyle avatar dependabot[bot] avatar kof avatar vovacodes avatar xhmikosr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

find-duplicate-dependencies's Issues

`npm.ls()` v4.4.2 changed output, breaking package

It looks like the return value of npm.ls() changed substantially as of npm v4.4.2 — search for "Stop flattening ls-tree output" here. Same-version dependencies are no longer deduped in npm.ls() as they are on-disk, meaning this reports everything that's depended upon multiple times as a dup. Missing dependencies are also returned, with missing: true on them and version: undefined.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.