Skip to content

Commit

Permalink
fix: add option usePreparedCommit default false
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #173
  • Loading branch information
leonardoanalista committed Jul 2, 2022
1 parent 03efbf0 commit bd3af82
Show file tree
Hide file tree
Showing 4 changed files with 316 additions and 145 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ Here are the options you can set in your `.cz-config.js`:
* **breaklineChar**: {string, default '|'}: It gets replaced with \n to create the breakline in your commit message. This is supported for fields `body` and `footer` at the moment.
* **upperCaseSubject**: { boolean, default false }: Capitalizes first subject letter if set to `true`
* **askForBreakingChangeFirst**: { boolean, default false }: It asks for breaking change as first question when set to `true`
* **usePreparedCommit**: { boolean, default false }: It re-uses commit from ./.git/COMMIT_EDITMSG when set to `true`

## Related tools
- (https://github.com/commitizen/cz-cli)
Expand Down
1 change: 1 addition & 0 deletions cz-config-EXAMPLE.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {

scopes: [{ name: 'accounts' }, { name: 'admin' }, { name: 'exampleScope' }, { name: 'changeMe' }],

usePreparedCommit: false, // to re-use commit from ./.git/COMMIT_EDITMSG
allowTicketNumber: false,
isTicketNumberRequired: false,
ticketNumberPrefix: 'TICKET-',
Expand Down
4 changes: 2 additions & 2 deletions lib/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ module.exports = {
type: 'input',
name: 'subject',
message: messages.subject,
default: getPreparedCommit('subject'),
default: config.usePreparedCommit && getPreparedCommit('subject'),
validate(value) {
const limit = config.subjectLimit || 100;
if (value.length > limit) {
Expand All @@ -152,7 +152,7 @@ module.exports = {
type: 'input',
name: 'body',
message: messages.body,
default: getPreparedCommit('body'),
default: config.usePreparedCommit && getPreparedCommit('body'),
},
{
type: 'input',
Expand Down
Loading

1 comment on commit bd3af82

@jainanuj0812
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have this PR merged please

Please sign in to comment.