feat: implement preCommit script for formatting package.json

This commit is contained in:
Ritesh Ghosh
2025-05-12 01:23:11 +05:30
parent bd5016472d
commit 7a87c7fa32
2 changed files with 15 additions and 2 deletions
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
jq --indent 4 . package.json > tmp.json && mv tmp.json package.json
+15
View File
@@ -0,0 +1,15 @@
const { exec } = require('child_process');
export function preCommit({ tag, version }) {
exec('jq --indent 4 . package.json > tmp.json && mv tmp.json package.json', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
if (stderr) {
console.error(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});
}