Skip to content

Commit

Permalink
✨ 增加最小
Browse files Browse the repository at this point in the history
  • Loading branch information
tw93 committed Aug 11, 2020
1 parent ed001b3 commit b7cfba8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -27,7 +27,7 @@ sudo npm install commitizen cz-emoji-chinese --global
echo '{ "path": "cz-emoji-chinese" }' > ~/.czrc

# Method 2: If you want minimalist mode, you can set it like this
echo '{ "path": "cz-emoji-chinese", "config": { "cz-emoji-chinese": { "skipQuestions": [ "issues", "scope","body" ] } } }' > ~/.czrc
echo '{ "path": "cz-emoji-chinese", "config": { "cz-emoji-chinese": { "skipQuestions": [ "issues", "scope","body" ],"subjectMinLength": 8 } } }' > ~/.czrc
```

**Locally**
Expand Down Expand Up @@ -198,3 +198,9 @@ module.exports = {
## License

MIT © Tw93

## Changelog

### 0.3.0

- [+] add `subjectMinLength` for Config
8 changes: 5 additions & 3 deletions index.js
Expand Up @@ -14,7 +14,8 @@ const defaultConfig = {
types,
symbol: false,
skipQuestions: [''],
subjectMaxLength: 75
subjectMaxLength: 75,
subjectMinLength: 4
}

function getEmojiChoices({ types, symbol }) {
Expand Down Expand Up @@ -116,9 +117,10 @@ function createQuestions(config) {
? config.questions.subject
: '写一个简短的描述:',
maxLength: config.subjectMaxLength,
minLength: config.subjectMinLength,
validate: function(value) {
const arr = value.split(" ");
if (arr && arr.length>1 && arr[0].length>3) {
const arr = value.split(' ')
if (arr && arr.length > 1 && arr[0].length > 3) {
return true
}
return '必须输入有效的改动描述'
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "cz-emoji-chinese",
"version": "0.2.1",
"version": "0.3.0",
"description": "中文版本的 git-cz emoji 提示",
"author": "Tw93 <tw93@qq.com>",
"license": "MIT",
Expand Down

0 comments on commit b7cfba8

Please sign in to comment.