Compare commits

...

3 Commits

Author SHA1 Message Date
di-sukharev
b747d70e69 1.0.3 2023-03-09 13:59:55 +08:00
di-sukharev
caa64fbcf9 * 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
2023-03-09 13:58:27 +08:00
di-sukharev
1a49c08409 * chore(commit.ts): change stagedFilesSpinner message when no files are staged 2023-03-09 13:56:03 +08:00
4 changed files with 10 additions and 6 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "open-commit",
"version": "1.0.2",
"version": "1.0.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "open-commit",
"version": "1.0.2",
"version": "1.0.3",
"license": "ISC",
"dependencies": {
"@clack/prompts": "^0.6.1",

View File

@@ -1,6 +1,6 @@
{
"name": "opencommit",
"version": "1.0.2",
"version": "1.0.3",
"description": "AI generates conventional commits with mind-blowing accuracy.",
"keywords": [
"git",

View File

@@ -79,7 +79,7 @@ export async function commit(isStageAllFlag = false) {
.bold('`oc`')} command.`
);
stagedFilesSpinner.stop('Counting staged files');
stagedFilesSpinner.stop('No files are staged');
const isStageAllAndCommitConfirmedByUser = await confirm({
message: 'Do you want to stage all files and generate commit message?'
});

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) {