Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dependency-diff

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependency-diff

Generate npm install commands or objects from the diff of two package.json files

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
454
decreased by-40.11%
Maintainers
1
Weekly downloads
 
Created
Source

dependency-diff

Generate npm install commands or objects from the diff of two package.json files

Use this module when you want to determine differences in package.json dependencies. This module is part of MinerLabs's continuous build and deploy system. Utilizing this module you can minimize downtime with targeted installs and uninstalls.

The best way for now to learn what the module does and expects is to look at the tests, however here is a short write up

var DepDiff = require('dependency-diff')

var left = require('package.json')
var right = require('other_package.json');

DepDiff().left(left).right(right).toObject()
/*
returns obj e.g.

{ dependencies: 
   [ { operation: 'edit',
       name: 'package-1',
       version: '1.0.1',
       cmd: 'npm install "package-1@1.0.1" --spin=false --color=true --production --loglevel=http' },
     { operation: 'new',
       name: 'extra-package',
       version: '1.0.0',
       cmd: 'npm install "extra-package@1.0.0" --spin=false --color=true --production --loglevel=http' } ],
  devDependencies: 
   [ { operation: 'edit',
       name: 'dev-package-1',
       version: '1.0.1',
       cmd: 'npm install "dev-package-1@1.0.1" --spin=false --color=true --production --loglevel=http' },
     { operation: 'new',
       name: 'extra-package',
       version: '1.0.0',
       cmd: 'npm install "extra-package@1.0.0" --spin=false --color=true --production --loglevel=http' } ],
  optionalDependencies: 
   [ { operation: 'edit',
       name: 'optional-package-1',
       version: '1.0.1',
       cmd: 'npm install "optional-package-1@1.0.1" --spin=false --color=true --production --loglevel=http' },
     { operation: 'delete',
       name: 'only-left',
       version: '1.0.0',
       cmd: 'npm uninstall only-left' },
     { operation: 'new',
       name: 'extra-package',
       version: '1.0.0',
       cmd: 'npm install "extra-package@1.0.0" --spin=false --color=true --production --loglevel=http' } ] }
*/


DepDiff().left(left).right(right).toCmdList()
/*

[ 'npm install "package-1@1.0.1" --spin=false --color=true --production --loglevel=http',
  'npm install "extra-package@1.0.0" --spin=false --color=true --production --loglevel=http',
  'npm install "dev-package-1@1.0.1" --spin=false --color=true --production --loglevel=http',
  'npm install "extra-package@1.0.0" --spin=false --color=true --production --loglevel=http',
  'npm install "optional-package-1@1.0.1" --spin=false --color=true --production --loglevel=http',
  'npm uninstall only-left',
  'npm install "extra-package@1.0.0" --spin=false --color=true --production --loglevel=http' ]
*/


FAQs

Package last updated on 01 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc