0.1.1 • Published 2 years ago
@mikelgo/nx-dependency-check v0.1.1
nx-dependency-check
A Nx plugin to maintain a healthy project by checking automatically outdated packages.
Installation
npm install @mikelgo/nx-dependency-checkUsage
In your project.json you only need to define a new target:
"targets": {
"check-deps": {
"executor": "@mikelgo/nx-dependency-check:check-deps"
}
}That's it! The plugin itself comes with reasonable defaults:
- It will check all packages listed in your root
package.jsonfile - It will use the
latesttag to check for updates - It will mark a package as outdated if a package is more than one major version behind latest
Configuration
The check-deps-executor provides several configuration options. Here's an example
"targets": {
"check-deps": {
"executor": "@mikelgo/nx-dependency-check:check-deps",
"options": {
"dependenciesToCheck": ["@angular/core", "@angular/common", "rxjs", "xng-breadcrumb"],
"versionOffset": {
"major": 1
},
"versionOffsetOverrides": [{"packageName": "xng-breadcrumb", "major": 1} ],
"failOnVersionMismatch": false,
"inputs": [
"package.json"
],
"cache": true
}
}
}Let's go through the options:
dependenciesToCheck: a array of package names which should be checked. Default is * which means that all packages are checked. If you only provide certain package names like in this example this means that only theses packages are checked.versionOffset: a object which defines the version offset. Default is{major: 1}which means that a package is marked as outdated if it is more than one major version behind latest.versionOffsetOverrides: A configuration where you can overrule the generalversionOffsetfor certain packages. This is especially helpful if you have high-frequent packages or simply some packages which you can not update right now.failOnVersionMismatch: A boolean which defines if the build should fail if outdated packages are found. Default istrue. Setting this option tofalsemight be helpful if you do not want to make passing the deps-check as a hard criteria to pass your build. You wil anyway get a nice report.inputs: A list of files which are used to determine the packages to check. Default is["package.json"]which means that only the rootpackage.jsonis used. You can also provide a list of files like["package.json", "projects/**/package.json"]to check allpackage.jsonfiles in your projects.cache: whether to use the nx cache or not. Default isfalse.
Nx version compatibility
The plugin needs @nx/devkit version 16.1.0 or higher.