提交 e9223031 编写于 作者: richard_1015's avatar richard_1015

feat: email check and commit config

上级 45214278
......@@ -2,7 +2,7 @@
node_modules
/dist
/libs
/jd
/jd/upload.js
yarn.lock
package.lock
......
{
"singleQuote": true,
"semi": true,
"semi": false,
"bracketSpacing": true,
"tabWidth": 2,
"printWidth": 150,
......
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [1, 'always'],
'footer-leading-blank': [1, 'always'],
'header-max-length': [2, 'always', 72],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [2, 'always', ['upd', 'chore', 'docs', 'feat', 'fix', 'test', 'refactor', 'revert', 'style']]
}
}
#!/usr/bin/env node
const { execSync } = require('child_process')
const stdout = execSync('git config user.email').toString()
if (stdout && /@jd.com$/gi.test(stdout.replace(/^\s+|\s+$/g, ''))) {
console.log('\x1B[31m%s\x1B[39m', 'ERROR:', '不能使用京东企业邮箱提交,请设置个人GitHub邮箱')
console.log('提示: git config user.email xxxxxxxx@xx.com')
process.exit(1)
} else {
process.exit(0)
}
......@@ -44,6 +44,8 @@
"vue-router": "^4.0.0-0"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
......@@ -57,6 +59,8 @@
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^7.0.0-0",
"husky": "^4.3.0",
"lint-staged": "^10.5.0",
"prettier": "^1.19.1",
"typescript": "~3.9.3"
},
......@@ -81,6 +85,15 @@
"no-console": "off"
}
},
"husky": {
"hooks": {
"pre-commit": "node ./jd/verifymail.js && lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*.{ts,js,vue,scss}": "prettier --write"
},
"repository": {
"type": "git",
"url": "https://github.com/jdf2e/nutui.git"
......@@ -90,4 +103,4 @@
"last 2 versions",
"not dead"
]
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册