From d036168a131cc255a5ab4aea8ecfb35681eae19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Eidelman?= Date: Fri, 21 Mar 2025 17:46:49 -0300 Subject: [PATCH] fix: README badges & npm prepack --- .gitignore | 5 ++++ README.md | 36 +++++++++++++++++------------ docs/arrays.md | 2 +- docs/deltas.md | 2 +- docs/formatters.md | 2 +- packages/jsondiffpatch/package.json | 4 ++-- 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index e1a8a21a..95922ce4 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,8 @@ lib npm-debug.log .idea/ + +packages/jsondiffpatch/README.md +packages/jsondiffpatch/MIT-LICENSE.txt + +*.local.* \ No newline at end of file diff --git a/README.md b/README.md index 35699490..92a7c30d 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,34 @@ -# jsondiffpatch +

+

jsondiffpatch

+

+ jsondiffpatch.com +
+ Diff & patch JavaScript objects +

+

- -[![Build Status](https://secure.travis-ci.org/benjamine/jsondiffpatch.svg)](http://travis-ci.org/benjamine/jsondiffpatch) -[![Code Climate](https://codeclimate.com/github/benjamine/jsondiffpatch/badges/gpa.svg)](https://codeclimate.com/github/benjamine/jsondiffpatch) -[![Test Coverage](https://codeclimate.com/github/benjamine/jsondiffpatch/badges/coverage.svg)](https://codeclimate.com/github/benjamine/jsondiffpatch) -[![NPM version](https://badge.fury.io/js/jsondiffpatch.svg)](http://badge.fury.io/js/jsondiffpatch) -[![NPM dependencies](https://david-dm.org/benjamine/jsondiffpatch.svg)](https://david-dm.org/benjamine/jsondiffpatch) - -Diff & patch JavaScript objects +

+ JsonDiffPatch CI status + Created by Benjamin Eidelman + License + npm + stars +

--- -## **[Live Demo](http://benjamine.github.io/jsondiffpatch/index.html)** +## **[Live Demo](https://jsondiffpatch.com)** - min+gzipped ~ 16KB - browser and server (ESM-only) +- deep diff, use delta to patch - (optionally) uses [google-diff-match-patch](http://code.google.com/p/google-diff-match-patch/) for long text diffs (diff at character level) - smart array diffing using [LCS](http://en.wikipedia.org/wiki/Longest_common_subsequence_problem), **_IMPORTANT NOTE:_** to match objects inside an array you must provide an `objectHash` function (this is how objects are matched, otherwise a dumb match by position is used). For more details, check [Array diff documentation](docs/arrays.md) -- reverse a delta -- unpatch (eg. revert object to its original state using a delta) +- reverse a delta, unpatch (eg. revert object to its original state using a delta) - simplistic, pure JSON, low footprint [delta format](docs/deltas.md) - multiple output formatters: - - html (check it at the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html)) + - html (check it at the [Live Demo](https://jsondiffpatch.com)) - annotated json (html), makes the JSON delta format self-explained - console (colored), try running `./node_modules/.bin/jsondiffpatch left.json right.json` - JSON Patch format RFC 6902 support @@ -31,7 +37,7 @@ Diff & patch JavaScript objects ## Supported platforms -- Any browser that supports ES6 +- Any browser that [supports ES6](https://caniuse.com/es6) - Node.js 18, 20+ ## Usage @@ -270,7 +276,7 @@ const jsondiffpatchInstance = jsondiffpatch.create({ ``` -To see formatters in action check the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html). +To see formatters in action check the [Live Demo](https://jsondiffpatch.com). For more details check [Formatters documentation](docs/formatters.md) diff --git a/docs/arrays.md b/docs/arrays.md index 9549d8f3..03350325 100644 --- a/docs/arrays.md +++ b/docs/arrays.md @@ -76,4 +76,4 @@ For more details check [delta format documentation](deltas.md) #### Html -On html you will see moves as fancy curved arrows (check [Live Demo](http://benjamine.github.com/jsondiffpatch/demo/index.html) ), these are implemented using SVG elements and an embedded script tag, they will only show up [if your browser supports SVG](http://caniuse.com/svg) +On html you will see moves as fancy curved arrows (check [Live Demo](https://jsondiffpatch.com) ), these are implemented using SVG elements and an embedded script tag, they will only show up [if your browser supports SVG](http://caniuse.com/svg) diff --git a/docs/deltas.md b/docs/deltas.md index a5a4cb2d..7efda901 100644 --- a/docs/deltas.md +++ b/docs/deltas.md @@ -8,7 +8,7 @@ This format was created with a balance between readability and low footprint in - to represent changed parts, arrays and magic numbers are used to keep a low footprint (i.e. you won't see verbosity like `"type": "added"`) - keep it pure JSON serializable -A great way to understand this format is using the "Annotated JSON" option in the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html), and try the different left/right examples, or edit left/right JSON to see the annotated delta update as your type. +A great way to understand this format is using the "Annotated JSON" option in the [Live Demo](https://jsondiffpatch.com)), and try the different left/right examples, or edit left/right JSON to see the annotated delta update as your type. Here's a complete reference of this format. diff --git a/docs/formatters.md b/docs/formatters.md index ea1a1d51..f604634b 100644 --- a/docs/formatters.md +++ b/docs/formatters.md @@ -1,6 +1,6 @@ # Formatters -Some formatters are included that let you convert a JSON delta into other formats, you can see some of these used in the [Live Demo](https://benjamine.github.io/jsondiffpatch/index.html) +Some formatters are included that let you convert a JSON delta into other formats, you can see some of these used in the [Live Demo](https://jsondiffpatch.com)) ## Html diff --git a/packages/jsondiffpatch/package.json b/packages/jsondiffpatch/package.json index b8545f2f..955efbd3 100644 --- a/packages/jsondiffpatch/package.json +++ b/packages/jsondiffpatch/package.json @@ -1,6 +1,6 @@ { "name": "jsondiffpatch", - "version": "0.6.0", + "version": "0.6.1", "author": "Benjamin Eidelman ", "description": "Diff & Patch for Javascript objects", "contributors": [ @@ -30,7 +30,7 @@ "type-check": "tsc --noEmit", "lint": "eslint . --ext .ts", "test": "jest --coverage", - "prepack": "npm run build", + "prepack": "npm run build && cp ../../MIT-LICENSE.txt . && cp ../../README.md .", "prepublishOnly": "npm run test && npm run lint" }, "repository": {