Releases: nemanjatesic/deep-obj-diff
v1.0.1
v1.0.0
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.jsonTurborepo 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/ foldersUpdated 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-diffanddeep-obj-diff-clito npm separately
Breaking Changes
- Package structure — The source tree moved from root-level
src/andtests/intopackages/core/andpackages/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 fromdeep-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-cliThe 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 testsIndividual packages can be targeted:
npm run build -w packages/core
npm run test -w packages/cliTechnical 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
exportsinpackage.json - Added explicit
.jsextensions to all relative imports for ESM compatibility - Extracted CLI into standalone zero-dependency package bundled with esbuild
- Replaced runtime
package.jsonversion reading with build-time__CLI_VERSION__define - Added Turborepo for monorepo task orchestration and caching
- Created dedicated
build.jsscripts for both core and CLI packages - Updated GitHub Actions CI and publish workflows for monorepo structure
- Simplified composite action to single
turbo run lint teststep - Added
jest.config.jsmoduleNameMapperfor.jsextension resolution in tests
v0.3.0
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
ignorePathsapplied to all code paths — additions, removals, ordered & unordered array diffs, and recursive changes all respect ignore patterns.- Extracted
EngineOptionstype — internal engine options are now a single named type, eliminating duplication betweencollectChangesanddiffArrays. isIgnored()helper — centralizes the ignore check logic to keep the engine DRY.
Testing
- 86 new tests in a dedicated
tests/ignorePaths.test.tscovering:- 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)
- All four pattern types (exact,
- Total: 199 tests, all passing.
Breaking Changes
None.
Full Changelog
c610ccdfeat: add ignorePaths option with pattern matchingc9f7514feat: move expandJsonStrings to core DiffOptions6360b30fix(ci): build before test so CLI tests can find dist/
v0.2.0
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 patchCLI features:
- Dual input modes — pass file paths or inline JSON strings
- All output formats —
list(default),flat,nested,patch,json - Rich options —
--include-unchanged,--max-depth,--no-array-order,--filter,--json - Colorized output — respects
NO_COLORandFORCE_COLORenvironment variables - CI-friendly — exits with code
1when differences are found,0when 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 -eProgrammatic:
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.jsbecause tests ran before the build step - Windows compatibility — fixed
npm testscript failing on Windows by replacingnode node_modules/.bin/jestwithnpx 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-diffv0.1.0
v0.1.0 — CLI Support
What's New
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 patchCLI Features
- Dual input modes — pass file paths or inline JSON strings
- All output formats —
list(default),flat,nested,patch,json - Rich options —
--include-unchanged,--max-depth,--no-array-order,--filter,--json - Colorized output — respects
NO_COLORandFORCE_COLORenvironment variables - CI-friendly — exits with code
1when differences are found,0when identical
Other Changes
- Fixed
npm testscript 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-diffv0.0.2
🎉 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