mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-22 20:18:08 -05:00
* 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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user