ci: update release workflow try19
This commit is contained in:
@@ -1,18 +1,31 @@
|
|||||||
import { exec } from "child_process";
|
import { readFile, writeFileSync } from "fs";
|
||||||
import { writeFileSync } from "fs";
|
|
||||||
|
|
||||||
export function preCommit({ tag, version }) {
|
export function preCommit({ tag, version }) {
|
||||||
writeFileSync("tmp.json", "{}")
|
readFile("package.json", "utf8", (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Error reading file:", err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
exec("jq --indent 4 . package.json > tmp.json && mv tmp.json package.json", (error, stdout, stderr) => {
|
// Parse the JSON string into an object
|
||||||
if (error) {
|
const json = JSON.parse(data);
|
||||||
console.error(`exec error: ${error}`);
|
|
||||||
return;
|
// Convert the object back to a JSON string
|
||||||
}
|
const jsonString = JSON.stringify(json, null, 4);
|
||||||
if (stderr) {
|
|
||||||
console.error(`stderr: ${stderr}`);
|
// Write the updated JSON string back to the file
|
||||||
return;
|
writeFileSync("package.json", jsonString);
|
||||||
}
|
|
||||||
console.log(`stdout: ${stdout}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 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}`);
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user