Skip to content

v1.0.0

Choose a tag to compare

@nemanjatesic nemanjatesic released this 17 Feb 23:09
· 5 commits to main since this release

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