Precommit hook for git lfs. Fix #2506
This commit is contained in:
Родитель
da1c2c8cbc
Коммит
9d293a00e2
|
@ -0,0 +1,10 @@
|
||||||
|
const $ = require('shelljs')
|
||||||
|
|
||||||
|
const { code, stdout } = $.exec('git lfs --version', { silent: true })
|
||||||
|
|
||||||
|
if (code === 0 && stdout.startsWith('git-lfs')) {
|
||||||
|
process.exit(0)
|
||||||
|
} else {
|
||||||
|
console.log('Please install Git LFS https://github.com/microsoft/vscode-docs#cloning for commiting {gif,mp4,jpg,png} files.')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
15
package.json
15
package.json
|
@ -8,8 +8,23 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Microsoft/vscode-docs.git"
|
"url": "https://github.com/Microsoft/vscode-docs.git"
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"check-lfs": "node ./build/check-lfs.js"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
|
"husky": "^1.3.1",
|
||||||
|
"lint-staged": "^8.1.5",
|
||||||
"shelljs": "^0.7.8"
|
"shelljs": "^0.7.8"
|
||||||
|
},
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "lint-staged"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{gif,mp4,jpg,png}": [
|
||||||
|
"git lfs --version"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1537
yarn.lock
1537
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче