grunt-compare-json

0.1.2 • Public • Published

grunt-compare-json

Compare multiples JSON files and report the keys differences

Getting Started

This plugin requires Grunt ~0.4.1

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-compare-json --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-compare-json');

The "compare-json" task

Overview

In your project's Gruntfile, add a section named comparejson to the data object passed into grunt.initConfig().

grunt.initConfig({
  comparejson: {
    compare: {
      src: ['<dir>'],
      fatal: true | false
    }
  }
})

Arguments

src

Type: Array[String]
Mandatory: true

Directory where are the files to compare. The path can use wildcard.

fatal

Type: Boolean
Mandatory: false
Default value: true

Flag to indicate wheter or not the task failed if some differences are found.

Usage Examples

grunt.initConfig({
  comparejson: {
    compare: {
      src: ['dir/**/*.json'],
      fatal: true
    }
  }
})

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 2013-10-29   v0.1.0   initial release

Package Sidebar

Install

npm i grunt-compare-json

Weekly Downloads

48

Version

0.1.2

License

none

Last publish

Collaborators

  • dpellier