Skip to content

Commit 6ff0403

Browse files
committed
Refactor: rename moreInfo to body
1 parent d2e8b57 commit 6ff0403

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

.sgcrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"questions": {
33
"scope": false,
4-
"moreInfo": true
4+
"body": true
55
},
66
"emoji": false,
77
"types": [

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ You can even create a global config. Just go to your users home and create a `.s
5353

5454
**Options:**
5555
- `scope` Asks for the scope in parentheses of the commit. Default: `false`
56-
- `moreInfo` Asks if more info (body) should be added. Default: `true`
56+
- `body` Asks if more info (body) should be added. Default: `true`
5757

5858
An object with predefined settings, what should be asked.
5959

lib/cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env node
2+
23
import chalk from 'chalk';
34
import execa from 'execa';
45
import yargs from 'yargs';
@@ -33,7 +34,7 @@ if (argv.v) {
3334
} else {
3435
inquirer.prompt(questionsList).then((answers) => {
3536
const typeScope = combineTypeScope(answers.type, answers.scope);
36-
const message = answers.moreInfo ? `${answers.editor}` : `${typeScope} ${answers.description}`;
37+
const message = answers.body ? `${answers.editor}` : `${typeScope} ${answers.description}`;
3738

3839
return execa('git', ['commit', '-m', message], { stdio: 'inherit' })
3940
.catch(() => {
@@ -42,4 +43,3 @@ if (argv.v) {
4243
});
4344
});
4445
}
45-

lib/getConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const getConfig = (altPath) => {
3232
let configDefaults = {
3333
questions: {
3434
scope: false,
35-
moreInfo: true,
35+
body: true,
3636
},
3737
};
3838

lib/questions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ const questions = (config) => {
4848
},
4949
{
5050
type: 'confirm',
51-
name: 'moreInfo',
51+
name: 'body',
5252
message: 'Do you want to add more information to your commit?',
53-
when: () => config.questions.moreInfo,
53+
when: () => config.questions.body,
5454
default: false,
5555
},
5656
{
5757
type: 'editor',
5858
name: 'editor',
5959
message: 'This will let you add more information',
60-
when: answers => answers.moreInfo,
60+
when: answers => answers.body,
6161
default: (answers) => {
6262
const type = combineTypeScope(answers.type, answers.scope);
6363

test/fixtures/.sgcrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"questions": {
33
"scope": false,
4-
"moreInfo": true
4+
"body": true
55
},
66
"emoji": false,
77
"types": [

test/getConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ test('read config from a .sgcrc_default', (t) => {
4646

4747
globalConfig.questions = {
4848
scope: false,
49-
moreInfo: true,
49+
body: true,
5050
};
5151

5252
t.deepEqual(getConfig(), globalConfig);

test/questions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ test('COMMIT | when and default functions in questions', (t) => {
120120
const config = getConfig();
121121
const questionsList = questions(config);
122122

123-
t.is(questionsList[4].when({ moreInfo: true }), true);
124-
t.is(questionsList[4].when({ moreInfo: false }), false);
125-
t.deepEqual(questionsList[4].default({ type: ':wrench: Chore:', description: 'This is a commit message!', moreInfo: true }), ':wrench: Chore: This is a commit message!\n\n\n');
123+
t.is(questionsList[4].when({ body: true }), true);
124+
t.is(questionsList[4].when({ body: false }), false);
125+
t.deepEqual(questionsList[4].default({ type: ':wrench: Chore:', description: 'This is a commit message!', body: true }), ':wrench: Chore: This is a commit message!\n\n\n');
126126
});
127127

128128
test('CONFIRM EDITOR | check if it shows if it has to', (t) => {
129129
const config = getConfig();
130130
const questionsList = questions(config);
131131

132-
t.is(questionsList[3].when(), config.questions.moreInfo);
132+
t.is(questionsList[3].when(), config.questions.body);
133133
});

0 commit comments

Comments
 (0)