Skip to content

Commit

Permalink
refactor: output debug log to a json file instead of console logging
Browse files Browse the repository at this point in the history
refactor: output debug log to a json file instead of console logging
  • Loading branch information
eglavin committed Apr 25, 2024
2 parents 8eca111 + adecb44 commit ed562d8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env node

import { writeFileSync } from "node:fs";
import { join } from "node:path";

import { getUserConfig } from "./config/user-config";
import { Logger } from "./utils/logger";
import { FileManager } from "./strategies/file-manager";
Expand Down Expand Up @@ -47,7 +50,12 @@ async function runFork() {
tagResult,
};

logger.debug(JSON.stringify(result, null, 2));
if (!config.dryRun && config.debug) {
writeFileSync(
join(config.path, `fork-version-${Date.now()}.debug-log.json`),
JSON.stringify(result, null, 2),
);
}

return result;
}
Expand Down

0 comments on commit ed562d8

Please sign in to comment.