Skip to content

Commit 0212afa

Browse files
committed
fix(library): master
- Fix commit message typo - Fix reading .gitchangelog file (use fs.readFileSync instead of require) version: v1.1.1
1 parent 6429091 commit 0212afa

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.gitchangelog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"scopes":[
3+
"messages",
4+
"scripts",
5+
"library",
6+
"command"
7+
]
8+
}

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22
const path = require('path');
33
const chalk = require('chalk');
4+
const fs = require('fs');
45
const {
56
askType,
67
askScope,
@@ -42,8 +43,8 @@ const config = {
4243
};
4344

4445
try {
45-
const localConfig = require(path.join(process.cwd(), '.gitchangelog'));
46-
Object.assign(config, localConfig);
46+
const localConfig = fs.readFileSync(path.join(process.cwd(), '.gitchangelog')).toString('utf8');
47+
Object.assign(config, JSON.parse(localConfig));
4748
} catch (error) {}
4849

4950
const commitTemplate = loadTemplate(
@@ -117,7 +118,7 @@ const run = async () => {
117118
executeScripts(config.afterCommit, scriptsEnvs);
118119
}
119120

120-
console.log(chalk.greenBright.bold('commited'));
121+
console.log(chalk.greenBright.bold('committed'));
121122

122123
};
123124

lib/prompts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const askScope = async (scopes = []) => {
1919
name: 'scope',
2020
message: 'which commit scope are you doing?',
2121
choices: scopes,
22-
default: scopes[0]
22+
default: scopes[0],
2323
});
2424
return answer.scope;
2525
}

0 commit comments

Comments
 (0)