Skip to content

Commit

Permalink
feat: add husky pre commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
lhui committed Jul 21, 2024
1 parent 09dbc4f commit c9c231d
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
.idea

yarn.lock

node_modules
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo "Running pre-commit hook"
node autoSidebar.js
git add .
2 changes: 2 additions & 0 deletions 1foundations/data-base/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Mongodb](/1foundations/data-base/Mongodb.md)
- [Redis](/1foundations/data-base/Redis.md)
1 change: 1 addition & 0 deletions 1foundations/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- [Rx.js](/1foundations/Rx.js.md)
- [数据库](/1foundations/data-base/index.md)
- [大前端](/1foundations/front-end/index.md)
- [git](/1foundations/git.md)
Expand Down
3 changes: 3 additions & 0 deletions _sidebar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
* [基础](/1foundations/index.md)
- [Rx.js](/1foundations/Rx.js.md)
* [数据库](/1foundations/data-base/index.md)
- [Mongodb](/1foundations/data-base/Mongodb.md)
- [Redis](/1foundations/data-base/Redis.md)
* [大前端](/1foundations/front-end/index.md)
- [Angular](/1foundations/front-end/Angular.md)
- [CSS](/1foundations/front-end/CSS.md)
Expand Down
4 changes: 3 additions & 1 deletion autoSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const curPath = path.resolve('./');
const taskQueue = [];
const relativeFilePathFilter = [
'/.idea',
'/public'
'/public',
'/node_modules',
'/.husky',
];

const SIDE_BAR = '/_sidebar.md'
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "woodpecker",
"version": "1.0.0",
"description": "努力更新中`ing`...",
"main": "autoSidebar.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "husky install"
},
"author": "",
"license": "ISC",
"dependencies": {
"husky": "^9.1.1"
}
}

0 comments on commit c9c231d

Please sign in to comment.