Skip to content

Commit 2d94574

Browse files
committed
chore(bin): migrate to ES module
1 parent b47268e commit 2d94574

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bin/diffpatch

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env node
22

3-
const diffpatch = require('..');
3+
import { DiffPatcher } from '../lib/index.js';
4+
import ConsoleFormatter from '../lib/formatters/console.js';
45

5-
const fs = require('fs');
6+
import fs from 'node:fs';
67

78
const fileLeft = process.argv[2];
89
const fileRight = process.argv[3];
@@ -15,5 +16,6 @@ if (!fileLeft || !fileRight) {
1516
const left = JSON.parse(fs.readFileSync(fileLeft));
1617
const right = JSON.parse(fs.readFileSync(fileRight));
1718

18-
const delta = diffpatch.diff(left, right);
19-
diffpatch.console.log(delta);
19+
const delta = new DiffPatcher().diff(left, right);
20+
21+
console.log(new ConsoleFormatter().format(delta));

0 commit comments

Comments
 (0)