Commit b6f1434c by zhangleyuan

Merge branch 'feature/zhangleyuan/20210604/add-hooks' into dev

parents 296bc935 c281716e
......@@ -4,7 +4,7 @@
* @Author: 吴文洁
* @Date: 2020-06-05 14:59:14
* @LastEditors: 吴文洁
* @LastEditTime: 2020-08-04 19:28:08
* @LastEditTime: 2020-10-09 15:30:45
* @Description:
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......
......@@ -2,11 +2,11 @@
/*
* @Author: 吴文洁
* @Date: 2020-06-05 09:38:03
* @LastEditors: 吴文洁
* @LastEditTime: 2020-09-02 15:45:50
* @Description:
* @LastEditors: louzhedong
* @LastEditTime: 2020-12-26 16:08:19
* @Description:
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
const execSync = require('child_process').execSync;
......@@ -14,7 +14,7 @@ const execSync = require('child_process').execSync;
const branchName = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
// 校验分支名是否合法
const firstPattern = new RegExp('dev|rc|gray|master');
const secondPattern = new RegExp('(feature|hotfix)/[a-z]{4,}/[0-9]{8,}/[a-zA-Z-]{4,}');
const secondPattern = new RegExp('(feature|hotfix)/[a-z]{4,}/[0-9]{8,}/[0-9a-zA-Z-]{3,}');
const firstMatch = firstPattern.test(branchName);
const secondMatch = secondPattern.test(branchName);
......@@ -27,10 +27,11 @@ if (!firstMatch && !secondMatch) {
// 获取缓存区内容
// 通过diff指令获得所有改动过(不包括删除)的js文件路径
const fileNameStr = execSync('git diff --diff-filter=AM --cached HEAD --name-only').toString();
const fileNameList = fileNameStr.split('\n').filter(item => !!item);
// 过滤掉空格
const fileNameList = fileNameStr.split('\n').filter((item) => !!item);
// 获取需要检测的文件
const detectedFileList = fileNameList.filter(file => {
const detectedFileList = fileNameList.filter((file) => {
// 过滤掉空的和hooks文件夹下所有的文件
return file && file.indexOf('hooks') < 0;
});
......@@ -39,7 +40,7 @@ const detectedFileList = fileNameList.filter(file => {
let errorFileList = [];
detectedFileList.forEach((file) => {
const results = execSync(`git diff --cached ${file}`);
const pattern = /^http:\/\/{1,}/;
const pattern = /^http\:\/\/.{1,}/;
if (pattern.test(results.toString())) {
errorFileList.push(file);
}
......@@ -60,7 +61,7 @@ fileNameList.forEach((file) => {
if (conflictPattern.test(results)) {
conflictFileList.push(file);
}
})
});
if (conflictFileList.length > 0) {
const conflictFileStr = JSON.stringify(conflictFileList);
// eslint-disable-next-line no-console
......@@ -68,4 +69,4 @@ if (conflictFileList.length > 0) {
process.exit(1);
}
process.exit(0);
\ No newline at end of file
process.exit(0);
......@@ -55,7 +55,7 @@
"fs-extra": "^8.1.0",
"html-webpack-plugin": "4.0.0-beta.11",
"html2canvas": "^1.0.0-rc.7",
"husky": "^4.2.5",
"husky": "^4.3.0",
"identity-obj-proxy": "3.0.0",
"jest": "24.9.0",
"jest-environment-jsdom-fourteen": "1.0.1",
......@@ -140,5 +140,12 @@
"ali-oss": "^6.12.0",
"react-sortable-hoc": "^1.11.0",
"vconsole-webpack-plugin": "^1.5.2"
},
"husky": {
"hooks": {
"pre-commit": "node hooks/pre-commit.js",
"commit-msg": "node hooks/commit-msg.js",
"pre-push": "node hooks/pre-commit.js"
}
}
}
......@@ -23,7 +23,6 @@ import User from '@/common/js/user';
import './Home.less';
const Option = Select.Option;
class Home extends React.Component {
constructor(props) {
super(props);
......
......@@ -54,7 +54,6 @@ function Login(props) {
User.setUserId(res.result.loginInfo.userId)
User.setToken(res.result.loginInfo.xmToken)
User.setEnterpriseId(res.result.enterpriseId)
console.log('identifier',res.result.enterpriseId)
User.setIdentifier(res.result.identifier)
window.RCHistory.push({
pathname: `/switch-route`
......
......@@ -4,8 +4,7 @@
@import '../../core/global.less';
@import '../../core/filter.less';
@top-height: 60px;
@top-height: 60px;
.right-container {
position: absolute;
left: @xm-left-width;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment