Checks that the installed modules fulfill the requirements of package.json
, both when it comes to the version ranges of the modules themselves and when it comes to the version range of their engine requirements.
Exists as a CLI as well: installed-check
yarn add installed-check-core
const installedCheck = require('installed-check-core');
installedCheck({ versionCheck: true }).then(result => {
if (result.errors.length) {
console.error('Dependency errors: \n\n' + result.errors.join('\n') + '\n');
}
});
const { errors, warnings, notices } = await installedCheck({
path: 'path/to/module',
engineCheck: true,
engineIgnores: ['foo'],
engineNoDev: true,
versionCheck: true,
});
options
– optional object containing additional options for the module
A Promise resolving to:
{
notices: ['123'],
warnings: ['Abc'],
errors: ['Xyz']
};
path
– defaults to.
. Specifies the path to where the target to be checked can be found, with itspackage.json
being there and itsn ode_modules
as well.engineCheck
– if setinstalled-check
will check that the installed modules comply with the engines requirements of thepackage.json
and suggest an alternative requirement if the installed modules don't comply.engineIgnores
– if set then the specified module names won't be included in the engine check.engineIgnores
should an array of module names while the CLI flags should be set once for each module name.engineNoDev
– if set then dev dependencies won't be included in the engine check.versionCheck
– if setinstalled-check
will check that the installed modules comply with the version requirements set for them thepackage.json
.