Skip to content

Commit 56663a0

Browse files
authored
New @graphql-inspector/compare-changes package for comparing diff changes (#2939)
1 parent d128373 commit 56663a0

File tree

9 files changed

+1613
-1
lines changed

9 files changed

+1613
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@graphql-inspector/action': patch
3+
---
4+
dependencies updates:
5+
- Updated dependency [`js-yaml@4.1.1` ↗︎](https://www.npmjs.com/package/js-yaml/v/4.1.1) (from
6+
`4.1.0`, in `dependencies`)

.changeset/giant-bulldogs-film.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@graphql-inspector/compare-changes': minor
3+
---
4+
5+
Initial release. Exposes a utility function for checking equivalency of changes output from the
6+
"@graphql-inspector/core" diff function.

packages/compare-changes/CHANGELOG.md

Whitespace-only changes.

packages/compare-changes/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# GraphQL Change Comparison Utility
2+
3+
This package allows comparing two changes (output from `@graphql-inspector/core`'s `diff`) for determining if they would result in the same output.
4+
5+
## Usage
6+
7+
```typescript
8+
import { buildSchema } from 'graphql';
9+
import { diff } from '@graphql-inspector/diff';
10+
import { isChangeEqual } from '@graphql-inspector/compare-changes';
11+
12+
const before = buildSchema(/* existing SDL */);
13+
const after = buildSchema(/* new SDL */);
14+
const changes = diff(before, after);
15+
16+
const hasChange = changes.some((c) => isChangeEqual(c, existingChange));
17+
```

0 commit comments

Comments
 (0)