semantic-commit-emoji
Version:
CLI for rewriting semantic commits with an emoji prefix
15 lines (14 loc) • 514 B
JavaScript
import * as fs from "fs";
import processCommitMessage from "../index.js";
/**
* Synchronously read in a string from the provided file, sends the contents
* to the processor and writes back the resulting commit message.
*/
export default (config, filePath) => {
const commitString = fs.readFileSync(filePath, "utf8");
const newCommitMessage = processCommitMessage(config, commitString);
if (newCommitMessage === undefined) {
return;
}
fs.writeFileSync(filePath, newCommitMessage);
};