@mapbox/duplicate-module-test

0.2.1 • Public • Published

Duplicate module test

A small command line utility used to test for duplicate installs of a module or list of modules using NPM's npm ls command output. Particularly helpful for node addons where you want to be 💯 sure there is only a single version of a binary installed before executing your code. More background as to why avoiding duplicate binaries is important here.

Usage

The primary usage is via the CLI command, duplicate-module-test, which assumes every argument passed in is the name of a module in the node_modules tree to test.

Example command

duplicate-module-test @mapbox/vtquery mapnik something-else

Output will look something like:

Checking for duplicate modules ...

✔ @mapbox/vtquery has only one version
✗ found 2 versions of mapnik
✔ something-else has only one version

Pretest

The command is particularly helpful added as a pretest command in your package.json document. This can be run in tandem with other pretest commands, like linters.

{
  "scripts": {
    "test": "node tests.js",
    "pretest": "duplicate-module-test module-one module-two && eslint index.js"
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @mapbox/duplicate-module-test

Weekly Downloads

2

Version

0.2.1

License

ISC

Unpacked Size

16.1 kB

Total Files

17

Last publish

Collaborators

  • mbx-npm-ci-production
  • mbx-npm-ci-staging
  • mbx-npm-advanced-actions-production
  • mbx-npm-advanced-actions-staging
  • mbx-npm-09-production
  • mbx-npm-08-production
  • mbx-npm-07-production
  • mbx-npm-06-production
  • mbx-npm-05-production
  • mbx-npm-04-production
  • mbx-npm-03-production
  • mbx-npm-02-production
  • mbx-npm-01-production
  • mbx-npm-02-staging
  • mapbox-npm-01
  • mapbox-npm-02
  • mapbox-npm-07
  • mapbox-npm-03
  • mapbox-npm-04
  • mapbox-npm-09
  • mapbox-npm-05
  • mapbox-npm-06
  • mapbox-npm-08
  • mapbox-npm-advanced-actions
  • mapbox-npm-ci
  • mapbox-npm
  • mapbox-admin
  • mapbox-machine-user