grunt-npm-check-updates
v1.1.2
Published
A Grunt Task that checks the update capabilities for each installed modules (without their dependencies).
Downloads
16
Readme
grunt-npm-check-updates
A Grunt Task that checks the update capabilities for each installed modules (without their dependencies).
Getting Started
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-npm-check-updates --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-npm-check-updates');
The "grunt-npm-check-updates" task
Example output
Overview
In your project's Gruntfile, add a section named grunt-npm-check-updates
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
'grunt-npm-check-updates': {
include: {
production: true,
develop: true,
optional: false,
jsonFile: 'package.json',
},
output: {
visual: true,
xml: true,
xmlFilename: 'grunt-npm-check-updates.xml',
xmlTemplate: '<?xml version="1.0"?><modules>{{#each modules}}<module name="{{{ this.name }}}" installed="{{{ this.installed }}}" latest="{{{ this.latest }}}" missedMajors="{{{ this.missedMajors }}}" missedMinors="{{{ this.missedMinors }}}" missedPatches="{{{ this.missedPatches }}}" status="{{{ this.status }}}"><versions>{{{ this.versions }}}</versions></module>{{/each}}</modules>',
json: true,
jsonFilename: 'grunt-npm-check-updates.json',
jsonTemplate: '{"modules": [{{#each modules}}{{#if @last }}{"name": "{{{ this.name }}}","installed": "{{{ this.installed }}}","latest": "{{{ this.latest }}}","missedMajors": "{{{ this.missedMajors }}}","missedMinors": "{{{ this.missedMinors }}}","missedPatches": "{{{ this.missedPatches }}}","versions": "{{{ this.versions }}}","status": "{{{ this.status }}}"}{{else}}{"name": "{{{ this.name }}}","installed": "{{{ this.installed }}}","latest": "{{{ this.latest }}}","missedMajors": "{{{ this.missedMajors }}}","missedMinors": "{{{ this.missedMinors }}}","missedPatches": "{{{ this.missedPatches }}}","versions": "{{{ this.versions }}}","status": "{{{ this.status }}}"},{{/if}}{{/each}}]}',
},
global: {
missedMajors: {
allowed: 0,
level: 'error',
},
missedMinors: {
allowed: 1,
level: 'warn',
},
missedPatches: {
allowed: 0,
level: 'warn',
},
showVersions: false,
},
modules: {}
});
Task Options
include.jsonFile
Type: String
Default value: package.json
The path of the package.json.
include.production
Type: Boolean
Default value: true
Indicates whether the dependencies
should be included in the test.
include.development
Type: Boolean
Default value: true
Indicates whether the devDependencies
should be included in the test.
include.optional
Type: Boolean
Default value: true
Indicates whether the optionalDependencies
should be included in the test.
output.visual
Type: Boolean
Default value: true
Indicates whether the result of the tests should be printed to the console.
output.xml
Type: Boolean
Default value: true
Indicates whether the result of the tests should be written to a xml file.
output.xmlFilename
Type: String
Default value: npm-check-updates.xml
The filename for the options.xml
option.
output.xmlTemplate
Type: String
Default value: <?xml version="1.0"?><modules>{{#each modules}}<module name="{{{ this.name }}}" installed="{{{ this.installed }}}" latest="{{{ this.latest }}}" missedMajors="{{{ this.missedMajors }}}" missedMinors="{{{ this.missedMinors }}}" missedPatches="{{{ this.missedPatches }}}" status="{{{ this.status }}}"><versions>{{{ this.versions }}}</versions></module>{{/each}}</modules>
The Handlebars template for the XML file output.
output.json
Type: Boolean
Default value: true
Indicates whether the result of the tests should be written to a json file.
output.jsonFilename
Type: String
Default value: npm-check-updates.json
The filename for the options.json
option.
output.jsonTemplate
Type: String
Default value: {"modules": [{{#each modules}}{{#if @last }}{"name": "{{{ this.name }}}","installed": "{{{ this.installed }}}","latest": "{{{ this.latest }}}","missedMajors": "{{{ this.missedMajors }}}","missedMinors": "{{{ this.missedMinors }}}","missedPatches": "{{{ this.missedPatches }}}","versions": "{{{ this.versions }}}","status": "{{{ this.status }}}"}{{else}}{"name": "{{{ this.name }}}","installed": "{{{ this.installed }}}","latest": "{{{ this.latest }}}","missedMajors": "{{{ this.missedMajors }}}","missedMinors": "{{{ this.missedMinors }}}","missedPatches": "{{{ this.missedPatches }}}","versions": "{{{ this.versions }}}","status": "{{{ this.status }}}"},{{/if}}{{/each}}]}
The Handlebars template for the JSON file output.
Global Test Options
global.missedMajors
Type: Object
Default value: missedMajors: {allowed: false, level: 'error'}
Defines the allowed (or not allowed) missed major releases.
global.missedMajors.allowed
Type: Integer|Boolean
Default value: 0
Indicates the count of missed majors updates which could pass the test. Set to true
to allow infinite missed majors updates.
global.missedMajors.level
Type: String
Default value: error
Allowed values: error
, warn
, debug
Indicates how cirital a missed major update is.
error
means that the Grunt Task will fail.
warn
means that the Grunt Task will only warn.
debug
mean that the Task will only with --debug
flag output some text.
global.missedMinors
Type: Object
Default value: missedMinors: {allowed: false, level: 'error'}
Defines the allowed (or not allowed) missed minor releases.
global.missedMinors.allowed
Type: Integer|Boolean
Default value: 0
Indicates the count of missed minors updates which could pass the test. Set to true
to allow infinite missed minors updates.
global.missedMinors.level
Type: String
Default value: error
Allowed values: error
, warn
, debug
Indicates how cirital a missed minor update is.
error
means that the Grunt Task will fail.
warn
means that the Grunt Task will only warn.
debug
mean that the Task will only with --debug
flag output some text.
global.missedPatches
Type: Object
Default value: missedPatches: {allowed: false, level: 'error'}
Defines the allowed (or not allowed) missed patch releases.
global.missedPatches.allowed
Type: Integer|Boolean
Default value: 0
Indicates the count of missed patch updates which could pass the test. Set to true
to allow infinite missed patch updates.
global.missedPatches.level
Type: String
Default value: error
Allowed values: error
, warn
, debug
Indicates how cirital a missed patch update is.
error
means that the Grunt Task will fail.
warn
means that the Grunt Task will only warn.
debug
mean that the Task will only with --debug
flag output some text.
global.showVersions
Type: Boolean
Default value: false
Indicates the whether the XML output or the console output should display the version history of a module.
Module specific Test Options
See the Global Test Options. Just wrap the options into an object with the name of the npm module as key.
modules: {
grunt: {
missedMajors: {
...
}
}
}
Release History
1.1.2
- fixed issue https://github.com/pixel-shock/grunt-npm-check-updates/issues/2 ** thanks to Matthew Mitchell (https://github.com/mmitchell80)
- fixed issue https://github.com/pixel-shock/grunt-npm-check-updates/issues/1 ** thanks to Matthew Mitchell (https://github.com/mmitchell80)
- switched to yarn
1.1.1
- fixed typo for "jsonFileName" to "jsonFilename"
1.1.0
- removed XMLWriter package
- added Handelbars package
- add XML Handlebars Template option
- add JSON Handlebars Template option
1.0.0
- moved Helper.js & Comparator.js into "lib" dir
- removed Progressbar
- changed graphical output
0.1.3
- upgraded required node version
0.1.2
- refactored code
- added tests
0.1.1
- changed options to be more distinct
- fixed
--debug
flag identification for task
0.1.0
- first release
TODO
- add more tests (if necessary)