Skip to content

Releases: nemanjatesic/deep-obj-diff

v1.0.1

18 Feb 23:02

Choose a tag to compare

Release v1.0.1

Adds 2FA auth to publishing and adds README.md files to both packages

v1.0.0

17 Feb 23:09

Choose a tag to compare

Release v1.0.0

Highlights

deep-obj-diff v1.0.0 is a major release that restructures the project into a Turborepo-managed monorepo with two independently publishable packages: a core diffing library and a standalone CLI.


What's New

Monorepo Architecture

The project has been split into two packages under packages/:

Package npm Name Description
packages/core deep-obj-diff Zero-dependency deep object diffing library
packages/cli deep-obj-diff-cli Standalone CLI for comparing JSON files/values

Dual CJS / ESM Support

The core library now ships both CommonJS and ES Module builds, so it works seamlessly regardless of how you consume it:

// ESM
import { diff } from 'deep-obj-diff';

// CJS
const { diff } = require('deep-obj-diff');

Distribution layout:

dist/
  cjs/    → CommonJS build
  esm/    → ES Module build
  types/  → TypeScript declarations

Package exports use the conditional exports specification, so bundlers and Node.js automatically resolve the correct entry point.

Zero-Dependency CLI Bundle

The CLI (deep-obj-diff-cli) is bundled with esbuild into a single self-contained file — it has zero runtime dependencies. All dependencies including commander and deep-obj-diff itself are inlined at build time.

npx deep-obj-diff-cli file1.json file2.json

Turborepo Integration

The monorepo is now orchestrated by Turborepo for:

  • Parallel task execution — build, test, and lint run concurrently across packages
  • Intelligent caching — unchanged packages skip redundant work
  • Dependency-aware ordering — CLI build automatically waits for the core build

Root-level scripts:

npm run build    # Build all packages
npm run test     # Test all packages
npm run lint     # Lint all packages
npm run clean    # Clean all dist/ folders

Updated CI/CD

GitHub Actions have been updated for the monorepo:

  • CI — Validates that both CJS, ESM, types, and CLI dist artifacts are produced correctly
  • Publish — Publishes deep-obj-diff and deep-obj-diff-cli to npm separately

Breaking Changes

  • Package structure — The source tree moved from root-level src/ and tests/ into packages/core/ and packages/cli/. If you were importing from internal file paths rather than the package entry point, those paths have changed.
  • CLI package name — The CLI is now a separate package (deep-obj-diff-cli). If you previously used the CLI from deep-obj-diff, install the new package instead.

Migration Guide

Library Users

No changes needed. npm install deep-obj-diff still works exactly the same. Both import and require are now supported out of the box.

CLI Users

# Before
npm install -g deep-obj-diff

# After
npm install -g deep-obj-diff-cli

The CLI command name remains deep-obj-diff.

Contributors

The repo is now a monorepo. After cloning:

npm install          # Installs all workspaces + Turborepo
npm run build        # Builds everything
npm run test         # Runs all tests

Individual packages can be targeted:

npm run build -w packages/core
npm run test -w packages/cli

Technical Details

Core CLI
Build tsc (dual CJS + ESM) esbuild (single bundled file)
Runtime deps 0 0
Tests 180 19
Node.js ≥ 18 ≥ 18
TypeScript 5.9 5.9

Full Changelog

  • Restructured project into npm workspaces monorepo (packages/core, packages/cli)
  • Added dual CJS/ESM build output with conditional exports in package.json
  • Added explicit .js extensions to all relative imports for ESM compatibility
  • Extracted CLI into standalone zero-dependency package bundled with esbuild
  • Replaced runtime package.json version reading with build-time __CLI_VERSION__ define
  • Added Turborepo for monorepo task orchestration and caching
  • Created dedicated build.js scripts for both core and CLI packages
  • Updated GitHub Actions CI and publish workflows for monorepo structure
  • Simplified composite action to single turbo run lint test step
  • Added jest.config.js moduleNameMapper for .js extension resolution in tests

v0.3.0

17 Feb 22:31

Choose a tag to compare

Release Notes — v0.3.0

Date: 2026-02-17

Highlights

This release introduces path ignoring with a flexible pattern system and promotes expandJsonStrings from a CLI-only flag to a first-class core option.


New Features

ignorePaths option (core + CLI)

Selectively skip paths during diffing using an array of pattern strings. Ignored paths (and their children) are silently excluded from the result — across all output formats, convenience functions, and the CLI.

Pattern rules:

Pattern Matches Example
"foo.bar" Exact path "foo.bar" only
"*.type" Any path ending with .type (requires a parent) "a.type", "x.y.type"
"**.id" .id at any depth, including top-level "id", "a.id", "a.b.c.id"
"settings.*" Any path under settings "settings.theme", "settings[0]"

Core usage:

import { diff, hasDiff } from 'deep-obj-diff';

const result = diff(oldObj, newObj, {
  ignorePaths: ['**.id', '*.type', 'metadata.timestamp'],
});

// Works with all convenience functions
hasDiff(a, b, { ignorePaths: ['**.id'] });

CLI usage:

deep-obj-diff old.json new.json -i "**.id" -i "metadata.timestamp"
deep-obj-diff old.json new.json --ignore "*.type" --ignore "build.*"

The -i / --ignore flag is repeatable — each occurrence adds a pattern.

expandJsonStrings promoted to core

Previously a CLI-only feature, expandJsonStrings is now available directly on DiffOptions. String values containing valid JSON are recursively parsed before diffing so their inner structure is compared instead of the raw string.

const result = diff(
  { data: '{"name":"Alice"}' },
  { data: '{"name":"Bob"}' },
  { expandJsonStrings: true },
);
// => [{ kind: 'changed', path: 'data.name', lhs: 'Alice', rhs: 'Bob' }]

Engine Improvements

  • ignorePaths applied to all code paths — additions, removals, ordered & unordered array diffs, and recursive changes all respect ignore patterns.
  • Extracted EngineOptions type — internal engine options are now a single named type, eliminating duplication between collectChanges and diffArrays.
  • isIgnored() helper — centralizes the ignore check logic to keep the engine DRY.

Testing

  • 86 new tests in a dedicated tests/ignorePaths.test.ts covering:
    • All four pattern types (exact, *.suffix, **.suffix, prefix.*)
    • Arrays (ordered, unordered, nested, specific indices)
    • Additions and removals
    • Interaction with includeUnchanged, maxDepth, filter, expandJsonStrings, isEqual, arrayOrderMatters
    • All output formats (list, flat, nested, patch, custom formatter)
    • Convenience functions (hasDiff, addedDiff, removedDiff, changedDiff)
    • Edge cases (empty array, 50-key objects, 6-level nesting, null/undefined, Date)
    • Complex real-world scenarios (API responses, configs, DB records, K8s manifests, event logs, form state)
  • Total: 199 tests, all passing.

Breaking Changes

None.


Full Changelog

  • c610ccd feat: add ignorePaths option with pattern matching
  • c9f7514 feat: move expandJsonStrings to core DiffOptions
  • 6360b30 fix(ci): build before test so CLI tests can find dist/

v0.2.0

17 Feb 20:29

Choose a tag to compare

v0.2.0

New Features

CLI for comparing JSON objects and files

deep-obj-diff now ships with a command-line interface. Compare JSON files or inline strings directly from your terminal.

# Compare two JSON files
deep-obj-diff old.json new.json

# Compare inline JSON
deep-obj-diff '{"a":1,"b":2}' '{"a":1,"b":3,"c":4}'

# Use any output format
deep-obj-diff old.json new.json --format patch

CLI features:

  • Dual input modes — pass file paths or inline JSON strings
  • All output formatslist (default), flat, nested, patch, json
  • Rich options--include-unchanged, --max-depth, --no-array-order, --filter, --json
  • Colorized output — respects NO_COLOR and FORCE_COLOR environment variables
  • CI-friendly — exits with code 1 when differences are found, 0 when identical
  • Modular structure — CLI code organized into src/cli/ (types, colors, input, printers, command)

Expand JSON-stringified strings (--expand-json-strings / -e)

String values containing valid JSON can now be recursively expanded before diffing, so their inner structure is compared rather than the raw string.

CLI:

deep-obj-diff old.json new.json -e

Programmatic:

import { diff } from 'deep-obj-diff';

diff(
  { data: '{"name":"Alice"}' },
  { data: '{"name":"Bob"}' },
  { expandJsonStrings: true }
);
// => [{ kind: 'changed', path: 'data.name', lhs: 'Alice', rhs: 'Bob' }]

The expandJsonStrings utility function is also exported for standalone use.

Bug Fixes

  • CI: build before test — fixed CI failure where CLI tests couldn't find dist/cli/index.js because tests ran before the build step
  • Windows compatibility — fixed npm test script failing on Windows by replacing node node_modules/.bin/jest with npx jest

Other Changes

  • Added 27 new tests (113 total, all passing)
  • Updated README with full CLI documentation
  • Coverage thresholds maintained (>80% across all metrics)

Install

npm install deep-obj-diff

# Or install globally for CLI access
npm install -g deep-obj-diff

v0.1.0

17 Feb 17:24

Choose a tag to compare

v0.1.0 — CLI Support

What's New

CLI for comparing JSON objects and filesdeep-obj-diff now ships with a command-line interface. Compare JSON files or inline strings directly from your terminal.

# Compare two JSON files
deep-obj-diff old.json new.json

# Compare inline JSON
deep-obj-diff '{"a":1,"b":2}' '{"a":1,"b":3,"c":4}'

# Use any output format
deep-obj-diff old.json new.json --format patch

CLI Features

  • Dual input modes — pass file paths or inline JSON strings
  • All output formatslist (default), flat, nested, patch, json
  • Rich options--include-unchanged, --max-depth, --no-array-order, --filter, --json
  • Colorized output — respects NO_COLOR and FORCE_COLOR environment variables
  • CI-friendly — exits with code 1 when differences are found, 0 when identical

Other Changes

  • Fixed npm test script for Windows compatibility
  • Restructured CLI into modular src/cli/ folder (types, colors, input, printers, command)
  • Added 19 CLI integration tests (105 total, all passing)
  • Updated README with full CLI documentation

Install

npm install -g deep-obj-diff

v0.0.2

17 Feb 17:01

Choose a tag to compare

🎉 Initial Release

A zero-dependency, fully typed deep object diffing library for TypeScript/JavaScript.

Features

  • Deep comparison of objects, arrays, dates, regexps, and primitives
  • 5 output formats: list, flat, nested, patch (RFC 6902), and custom formatters
  • Convenience helpers: hasDiff, addedDiff, removedDiff, changedDiff
  • Customizable: path filters, custom equality functions, depth limits, ordered/unordered array comparison
  • Full TypeScript support with generic return types
  • Zero runtime dependencies

Installation

npm install deep-obj-diff