File size: 625 Bytes
d522ffa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import { mkdir } from 'node:fs/promises';
import { atomicWrite } from './atomic-write.js';
import { migrationReportFile } from './paths.js';
import type { MigrationReport } from './types.js';
/**
* Writes the migration report as pretty-printed JSON to
* `<targetHome>/migration-report.json`. Creates the target directory with
* mode 0700 if it does not yet exist.
*/
export async function writeReport(
targetHome: string,
report: MigrationReport,
): Promise<void> {
await mkdir(targetHome, { recursive: true, mode: 0o700 });
await atomicWrite(migrationReportFile(targetHome), JSON.stringify(report, null, 2));
}
|