Skip to content

Commit 9573174

Browse files
authoredJul 6, 2022
Replace pre-commit with husky (#38350)
* Replace pre-commit with husky * update lock * actually update lock
1 parent 6b4b037 commit 9573174

File tree

4 files changed

+18
-43
lines changed

4 files changed

+18
-43
lines changed
 

‎.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
pnpm lint-staged

‎lint-staged.config.js

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = {
1515
.filter((file) => !eslint.isPathIgnored(file))
1616
.map((f) => `"${f}"`)
1717
.join(' ')}`,
18+
`git add ${escapedFileNames}`,
1819
]
1920
},
2021
'**/*.{json,md,mdx,css,html,yml,yaml,scss}': (filenames) => {
@@ -23,6 +24,7 @@ module.exports = {
2324
.join(' ')
2425
return [
2526
`prettier --with-node-modules --ignore-path .prettierignore_staged --write ${escapedFileNames}`,
27+
`git add ${escapedFileNames}`,
2628
]
2729
},
2830
}

‎package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
"clean-trace-jaeger": "rm -rf test/integration/basic/.next && TRACE_TARGET=JAEGER node --trace-deprecation --enable-source-maps packages/next/dist/bin/next build test/integration/basic",
4545
"debug": "node --inspect packages/next/dist/bin/next",
4646
"postinstall": "git config feature.manyFiles true && node scripts/install-native.mjs",
47-
"version": "pnpm install && git add pnpm-lock.yaml"
47+
"version": "pnpm install && git add pnpm-lock.yaml",
48+
"prepare": "husky install"
4849
},
49-
"pre-commit": "lint-staged",
5050
"devDependencies": {
5151
"@babel/core": "7.18.0",
5252
"@babel/eslint-parser": "7.18.2",
@@ -141,6 +141,7 @@
141141
"glob": "7.1.6",
142142
"gzip-size": "5.1.1",
143143
"html-validator": "5.1.18",
144+
"husky": "8.0.0",
144145
"image-size": "0.9.3",
145146
"is-animated": "2.0.2",
146147
"isomorphic-unfetch": "3.0.0",
@@ -167,7 +168,6 @@
167168
"postcss-pseudoelements": "5.0.0",
168169
"postcss-short-size": "4.0.0",
169170
"postcss-trolling": "0.1.7",
170-
"pre-commit": "1.2.2",
171171
"prettier": "2.5.1",
172172
"pretty-bytes": "5.3.0",
173173
"pretty-ms": "7.0.0",

‎pnpm-lock.yaml

+9-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.