Skip to content

dpellier/compare-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Grunt task to compare multiples JSON files and report the keys differences

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published