Skip to content

Utility to find differences in configuration files.

Notifications You must be signed in to change notification settings

DimaKabanov/gendiff

Repository files navigation

gendiff

Maintainability Build Status jest

Utility to find differences in configuration files.

Install

npm install -g dk-gendiff

Setup

make install

Test

make test

Supported format

Report generation

Usage example

pretty

$ gendiff first-config.json second-config.json

{
    common: {
        setting1: Value 1
      - setting2: 200
      - setting3: true
      + setting3: {
            key: value
        }
        setting6: {
            key: value
          + ops: vops
        }
      + setting4: blah blah
      + setting5: {
            key5: value5
        }
    }
    group1: {
      - baz: bas
      + baz: bars
      - nest: {
            key: value
        }
      + nest: str
    }
  - group2: {
        abc: 12345
    }
}

plain

$ gendiff --format plain first-config.json second-config.json

Property 'common.setting2' was removed
Property 'common.setting6.ops' was added with 'vops'
Property 'common.setting5' was added with complex value
Property 'group1.baz' was updated from 'bas' to 'bars'
Property 'group1.nest' was updated from complex value to 'str'
Property 'group2' was removed
Property 'group3' was added with complex value

json

$ gendiff --format json first-config.ini second-config.ini

[{"type":"nested","key":"common","depth":1,"children":[{"type":"unchanged","key":"setting1","depth":2,"oldValue":"Value 1"},{"type":"deleted","key":"setting2","depth":2,"oldValue":"200"},{"type":"changed","key":"setting3","depth":2,"oldValue":true,"newValue":{"key":"value"}},{"type":"nested","key":"setting6","depth":2,"children":[{"type":"unchanged","key":"key","depth":3,"oldValue":"value"},{"type":"added","key":"ops","depth":3,"newValue":"vops"}]},{"type":"added","key":"setting4","depth":2,"newValue":"blah blah"},{"type":"added","key":"setting5","depth":2,"newValue":{"key5":"value5"}}]},{"type":"nested","key":"group1","depth":1,"children":[{"type":"changed","key":"baz","depth":2,"oldValue":"bas","newValue":"bars"},{"type":"unchanged","key":"foo","depth":2,"oldValue":"bar"},{"type":"changed","key":"nest","depth":2,"oldValue":{"key":"value"},"newValue":"str"}]},{"type":"deleted","key":"group2","depth":1,"oldValue":{"abc":"12345"}},{"type":"added","key":"group3","depth":1,"newValue":{"fee":"100500"}}]

About

Utility to find differences in configuration files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published