Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-website-ssr-template
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liguokang
xiaomai-website-ssr-template
Commits
4562fb01
Commit
4562fb01
authored
Jul 28, 2021
by
liguokang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
⚡
parent
9698a671
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
15 deletions
+91
-15
components/layout/XMHeader/laHeader copy.js
+73
-0
hooks/commit-msg.js
+6
-4
hooks/pre-commit.js
+12
-11
No files found.
components/layout/XMHeader/laHeader copy.js
0 → 100644
View file @
4562fb01
/*
* @Author: liguokang
* @Date: 2021-07-15 10:28:10
* @LastEditors: liguokang
* @LastEditTime: 2021-07-27 21:24:21
* @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/
import
React
from
'react'
;
import
cookies
from
'react-cookies'
;
import
{
connect
}
from
'react-redux'
;
import
Link
from
'next/link'
;
import
{
withRouter
}
from
'next/router'
;
import
{
StaticImg
}
from
'@/api/interfaces'
;
import
style
from
'./laHeader.less'
;
import
{
Button
}
from
'antd'
;
class
LaHeader
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{};
}
render
()
{
return
(
<
header
>
<
nav
>
<
div
className
=
{
style
.
title_con
}
>
<
Link
href
=
"/"
>
<
div
className
=
{
style
.
title_item
}
>
<
span
>
头部头部头部头部
<
/span
>
<
Button
>
头部头部头部头部
<
/Button
>
<
img
src
=
{
StaticImg
+
'/logo.png'
}
width
=
{
121
}
alt
=
""
/>
<
/div
>
<
/Link
>
<
Link
href
=
"/"
>
<
div
className
=
{
style
.
title_item
}
>
<
span
>
头部头部头
2222
部头部
<
/span
>
<
img
src
=
{
StaticImg
+
'/logo.png'
}
width
=
{
121
}
alt
=
""
/>
<
/div
>
<
/Link
>
<
Link
href
=
"/"
>
<
div
className
=
{
style
.
title_item
}
>
<
span
>
头部头部头部头部
<
/span
>
<
img
src
=
{
StaticImg
+
'/logo.png'
}
width
=
{
121
}
alt
=
""
/>
<
/div
>
<
/Link
>
<
Link
href
=
"/"
>
<
div
className
=
{
style
.
title_item
}
>
<
span
>
头部头部头部头部
<
/span
>
<
img
src
=
{
StaticImg
+
'/logo.png'
}
width
=
{
121
}
alt
=
""
/>
<
/div
>
<
/Link
>
<
Link
href
=
"/"
>
<
div
className
=
{
style
.
title_item
}
>
<
span
>
头部头部头部头部
<
/span
>
<
img
src
=
{
StaticImg
+
'/logo.png'
}
width
=
{
121
}
alt
=
""
/>
<
/div
>
<
/Link
>
<
Link
href
=
"/"
>
<
div
className
=
{
style
.
title_item
}
>
<
span
>
头部头部头部头部
<
/span
>
<
img
src
=
{
StaticImg
+
'/logo.png'
}
width
=
{
121
}
alt
=
""
/>
<
/div
>
<
/Link
>
<
/div
>
<
/nav
>
<
/header
>
);
}
}
// export default withRouter(LaHeader);
const
mapStateToProps
=
({
city
,
cityMap
})
=>
({
city
,
cityMap
});
export
default
LaHeader
;
hooks/commit-msg.js
View file @
4562fb01
#! /usr/bin/env node
/*
* @Author:
liguokang
* @Date: 202
1-07-14 20:42:36
* @Author:
吴文洁
* @Date: 202
0-06-05 14:59:14
* @LastEditors: liguokang
* @LastEditTime: 2021-07-
15 10:23
:15
* @LastEditTime: 2021-07-
28 11:30
:15
* @Description:
* @Copyrigh: ©
2021
杭州杰竞科技有限公司 版权所有
* @Copyrigh: ©
2020
杭州杰竞科技有限公司 版权所有
*/
const
fs
=
require
(
'fs'
)
...
...
hooks/pre-commit.js
View file @
4562fb01
#! /usr/bin/env node
/*
* @Author:
liguokang
* @Date: 202
1-07-14 20:42:36
* @LastEditors: l
iguoka
ng
* @LastEditTime: 202
1-07-15 10:23:23
* @Author:
吴文洁
* @Date: 202
0-06-05 09:38:03
* @LastEditors: l
ouzhedo
ng
* @LastEditTime: 202
0-12-26 16:08:19
* @Description:
* @Copyrigh: ©
2021
杭州杰竞科技有限公司 版权所有
* @Copyrigh: ©
2020
杭州杰竞科技有限公司 版权所有
*/
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'
);
// 过滤掉空格
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment