fix: ensure tmp.json is created before formatting package.json

This commit is contained in:
Ritesh Ghosh
2025-05-12 01:33:40 +05:30
parent a0b9e46038
commit eb33f10478
+3
View File
@@ -1,6 +1,9 @@
import { exec } from "child_process"; import { exec } from "child_process";
import { writeFileSync } from "fs";
export function preCommit({ tag, version }) { export function preCommit({ tag, version }) {
writeFileSync("tmp.json", "{}")
exec("jq --indent 4 . package.json > tmp.json && mv tmp.json package.json", (error, stdout, stderr) => { exec("jq --indent 4 . package.json > tmp.json && mv tmp.json package.json", (error, stdout, stderr) => {
if (error) { if (error) {
console.error(`exec error: ${error}`); console.error(`exec error: ${error}`);