Skip to content

Commit

Permalink
fix: diff tooling (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Aug 9, 2024
1 parent b2781b8 commit e906492
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/commands/diffSnaphots.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'node:fs';
import path from 'node:path';
import {compareStorageLayouts} from '@bgd-labs/js-utils';
import type {Command} from '@commander-js/extra-typings';
import {adiDiffReports} from '../reports/adi-diff-reports';
Expand All @@ -18,6 +19,7 @@ export function addCommand(program: Command) {
const to = options.stringMode ? readJsonString(_to) : readJsonFile(_to);
const content = await diffReports(from, to);
if (options.out) {
fs.mkdirSync(path.dirname(options.out), {recursive: true});
fs.writeFileSync(options.out, content);
} else {
console.log(content);
Expand All @@ -36,6 +38,7 @@ export function addCommand(program: Command) {
const to = options.stringMode ? readJsonString(_to) : readJsonFile(_to);
const content = await adiDiffReports(from, to);
if (options.out) {
fs.mkdirSync(path.dirname(options.out), {recursive: true});
fs.writeFileSync(options.out, content);
} else {
console.log(content);
Expand All @@ -53,6 +56,7 @@ export function addCommand(program: Command) {
const to = readJsonFile(_to);
const content = await compareStorageLayouts(from, to);
if (options.out) {
fs.mkdirSync(path.dirname(options.out), {recursive: true});
fs.writeFileSync(options.out, content);
} else {
console.log(content);
Expand Down

0 comments on commit e906492

Please sign in to comment.