grunt-check-outdated

grunt-check-outdated

grunt-check-outdated uses the third-party tool check-outdated by Jens Duttke to determine and display which dependencies are outdated.

grunt-check-outdated takes on the role of calling the check-outdated package, passing configuration parameters from grunt to check-outdated.

grunt

is a task runner written in Javascript that can be used to build projects. For this purpose grunt integrates plugins that contribute to the build process with their different capabilities.


grunt-check-outdated is open source software (OSS) and distributed under the MIT License.

Third party tools:

check-outdated is open source software (OSS) and distributed under the MIT License.


Prerequisites for installing grunt-check-outdated are an existing npm that ships with nodejs and grunt.

npm install grunt-check-outdated --save-dev


Configuration of the plugin is usually done via an entry in the grunfile.js file. To be able to keep an overview of the configuration even when using many plugins, we use the package load-grunt-config. This way we can keep a separate configuration file for each plugin, as the following example shows.

// file check_outdated.js
module.exports = function ( grunt, options ) {
  return {
    always: {                                   // this is a grunt multitask, so define a target.
      options: {
        // cwd:           process.cwd(),        // set a working directory - defaults to process.cwd()
        // dryrun:        false,                // dry run - do nothing just print out the cmd line
        // quiet          false,                // ... shut up! (no good idea if task fails)
        /* node: {                              // node options
          exec:           {string},             // set your node executable - defaults to: process.execPath
          opts:           {Array<string>}       // array of node options
        }, */
        checkoutdated: {                        // mirrors options of [check-outdated](https://www.npmjs.com/package/check-outdated)
          ignore: {
            // prereleases:     false,          // --ignore-pre-releases
                                                //   Don't recommend to update to the latest version, if it contains a hyphen
            // devdependencies: false,          // --ignore-dev-dependencies
                                                //   Do not warn if devDependencies are outdated.
            packages:           [ "webpack" ]   // --ignore-packages
          },                                    //   Ignore the listed packages, even if they are outdated.
          columns:              [               // --columns
                                  "name" ,      //   Defines which columns should be shown in which order.
                                  "current",    //   [Available columns](https://www.npmjs.com/package/check-outdated#available-columns)
                                  "wanted",
                                  "latest"
                                ],
          // opts:              {Array<string>} //  grunt-plugin specific: In case check-outdated is newer than
                                                //  grunt-check-outdated, you may manually add new options to this
                                                //  array. The arrays contents are appended to the end of the call,
                                                //  created by this plugin (which can be verified using --dryrun)
          // depth:             false,          //  --depth <n> Max depth for checking dependency tree
          // global:            false           //  --global Check packages in the global install prefix
        }
      }
    }
  };
};
grunt-check-outdated

Which parameters can be passed from grunt-check-outdated to check-outdated?

All!

The configuration section checkoutdated contains a property opts, which can be passed an array of strings. All strings in the array will be passed to check-outdated if the task is called.

If grunt-check-outdated itself might be outdated one day, any parameter can be passed to check-outdated. Even those not known to the outdated plugin.

Currently the following parameters of check-outdated are supported by grunt-check-outdated:

–ignore-pre-releases
–ignore-dev-dependencies
–ignore-packages
–columns
–depth
–global


Property <targetname> {Object}

grunt-check-outdated is a multitask plugin,, which means, there can be any number of targets to run.
Each target requires a number of properties.

// file check_outdated.js
module.exports = function ( grunt, options ) {
  return {
    always: {
      // ... further properties go here!
    }
  };
};
grunt

Multitasks

Tasks and Targets

Because grunt tasks need to be named, always is the name of the only task configured in this example. You could also use foo, bar or another string instead.


Property options {Object}

This property can be configured for all tasks or per task.
The example sets options for the task always.

grunt

Options


Property cwd {path} (current working directory)

grunt-check-outdated needs to know the directory where the package.json file is located. If grunt is started in another directory, the cwd property must be set.

Usually the value fits automatically and it does not need to be specified.

Property dryrun {Boolean}

If the value of the property is set to true, check-outdated is no longer called. Instead, the string that would have started the third-party tool will be written to the console.
The output should be directly callable from the project’s commandshell.

Property quiet {Boolean}

If the value of the property is set to true, the plugin will stop using the standard output, meaning it will be silenced.

Property node {Object}

The third-party tool check-outdated is called in a separate node process. If it is necessary to make changes to the type of call, this can be done via the properties of the node object.

grunt-check-outdated

These are the standard features offered by each of our plugins.

They are independent of the third-party tool, but refer to the way it will be called.


Property checkoutdated {Object}

This object bundles all configuration settings for the third-party tool check-outdated.

Property ignore {Object}

The ignore object is a property of the checkoutdated object. It bundles all settings that tell check-outdated to ignore things.
This affects all options of check-outdated that start with –ignore*.

Property prereleases {Boolean}

This is a property of the ignore object.
Setting its value to true means that the presence of a prerelese for a packages will not cause check-outdated to report the package as obsolete.

Property devdependencies {Boolean}

This is a property of the ignore object. Setting its value to true means that dependencies on outdated developer packages will not cause check-outdated to report this.

Property packages {Array<string>}

This is a property of the ignore object.
It accepts an array. All packages listed by the array will be excluded from checks by check-outdated.

Property columns {Array<string>}

This is a property of the checkoutdated object.
It accepts an array containing all the columns that should be displayed when checkoutdated outputs a check result.

Property depth {Number<integer>:3}

This is a property of the checkoutdated object.
An integer specifies the depth of the package dependencies, to which a check for outdated packages should take place.

Property global {Boolean}

This is a property of the checkoutdated object.
Set to true, will cause check-outdated to also check the globally installed packages.