@mapbox/duplicate-module-test
v0.2.1
Published
Test for duplicate installs of a module(s)
Downloads
74
Maintainers
Keywords
Readme
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 :100: 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"
}
}