* refactor(prepare-commit-msg-hook.ts): change appendFile to writeFile to write commit message to file

* chore(prepare-commit-msg-hook.ts): add newline character before appending file content to commit message
This commit is contained in:
di-sukharev
2023-03-09 13:58:27 +08:00
parent 1a49c08409
commit caa64fbcf9

View File

@@ -37,8 +37,12 @@ export const prepareCommitMessageHook = async () => {
if (typeof commitMessage !== 'string') throw new Error(commitMessage.error);
// TODO: change to read file > write file with commitMessage
await fs.appendFile(messageFilePath, commitMessage);
const fileContent = await fs.readFile(messageFilePath);
await fs.writeFile(
messageFilePath,
commitMessage + '\n' + fileContent.toString()
);
outro(`${chalk.green('✔')} commit done`);
} catch (error) {