* 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);
|
if (typeof commitMessage !== 'string') throw new Error(commitMessage.error);
|
||||||
|
|
||||||
// TODO: change to read file > write file with commitMessage
|
const fileContent = await fs.readFile(messageFilePath);
|
||||||
await fs.appendFile(messageFilePath, commitMessage);
|
|
||||||
|
await fs.writeFile(
|
||||||
|
messageFilePath,
|
||||||
|
commitMessage + '\n' + fileContent.toString()
|
||||||
|
);
|
||||||
|
|
||||||
outro(`${chalk.green('✔')} commit done`);
|
outro(`${chalk.green('✔')} commit done`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user