build(grunt): Add pre-commit hook

This commit is contained in:
Pierre Rudloff 2019-09-21 12:53:42 +02:00
parent 3de1a5c7c5
commit a3aeb423b0
3 changed files with 64 additions and 6 deletions

View File

@ -47,9 +47,6 @@ module.exports = function (grunt) {
}
},
jslint: {
js: {
src: ['js/*.js']
},
Gruntfile: {
src: ['Gruntfile.js']
}
@ -121,7 +118,12 @@ module.exports = function (grunt) {
doc: {
src: ['README.md', 'CONTRIBUTING.md', 'resources/*.md']
}
}
},
githooks: {
all: {
'pre-commit': 'lint'
}
}
}
);
@ -139,9 +141,10 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-markdownlint');
grunt.loadNpmTasks('grunt-phpstan');
grunt.loadNpmTasks('grunt-githooks');
grunt.registerTask('default', ['cssmin', 'potomo']);
grunt.registerTask('lint', ['csslint', 'fixpack', 'jsonlint', 'markdownlint', 'phpcs', 'phpstan']);
grunt.registerTask('lint', ['csslint', 'jslint', 'fixpack', 'jsonlint', 'markdownlint', 'phpcs', 'phpstan']);
grunt.registerTask('test', ['phpunit']);
grunt.registerTask('doc', ['phpdocumentor']);
grunt.registerTask('release', ['default', 'githash', 'compress']);

View File

@ -16,6 +16,7 @@
"grunt-contrib-watch": "~1.1.0",
"grunt-fixpack": "~0.1.0",
"grunt-githash": "~0.1.3",
"grunt-githooks": "^0.6.0",
"grunt-jslint": "~1.1.15",
"grunt-jsonlint": "~1.1.0",
"grunt-markdownlint": "~2.1.0",
@ -38,6 +39,7 @@
"url": "https://github.com/Rudloff/alltube.git"
},
"scripts": {
"postinstall": "grunt"
"postinstall": "grunt",
"prepare": "grunt githooks"
}
}

View File

@ -30,6 +30,11 @@ alce@1.0.0:
esprima "~1.0.4"
estraverse "~1.3.0"
amdefine@>=0.0.4:
version "1.0.1"
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
@ -128,6 +133,11 @@ async@^2.0.0, async@^2.6.0:
dependencies:
lodash "^4.17.14"
async@~0.2.6:
version "0.2.10"
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
integrity sha1-trvgsGdLnXGXCMo43owjfLUmw9E=
async@~1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
@ -814,6 +824,13 @@ grunt-githash@~0.1.3:
bluebird "^3.0.5"
git-rev-2 "^0.1.0"
grunt-githooks@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/grunt-githooks/-/grunt-githooks-0.6.0.tgz#10c6a40c537c1b6c65648c6b7edf0018a00fc3f0"
integrity sha1-EMakDFN8G2xlZIxrft8AGKAPw/A=
dependencies:
handlebars "~1.0.12"
grunt-jslint@~1.1.15:
version "1.1.15"
resolved "https://registry.yarnpkg.com/grunt-jslint/-/grunt-jslint-1.1.15.tgz#c7d7dbb850307d9e9bd12ea62fef7ed6ac2abe7f"
@ -929,6 +946,14 @@ gzip-size@^3.0.0:
dependencies:
duplexer "^0.1.1"
handlebars@~1.0.12:
version "1.0.12"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-1.0.12.tgz#18c6d3440c35e91b19b3ff582b9151ab4985d4fc"
integrity sha1-GMbTRAw16RsZs/9YK5FRq0mF1Pw=
dependencies:
optimist "~0.3"
uglify-js "~2.3"
har-schema@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"
@ -1397,6 +1422,13 @@ open-sans-fontface@~1.4.0:
resolved "https://registry.yarnpkg.com/open-sans-fontface/-/open-sans-fontface-1.4.0.tgz#03cc6d1bf5e6a8b5b47910888562f722c5dd3428"
integrity sha1-A8xtG/XmqLW0eRCIhWL3IsXdNCg=
optimist@~0.3, optimist@~0.3.5:
version "0.3.7"
resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.3.7.tgz#c90941ad59e4273328923074d2cf2e7cbc6ec0d9"
integrity sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=
dependencies:
wordwrap "~0.0.2"
os-homedir@^1.0.0, os-homedir@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"
@ -1770,6 +1802,13 @@ source-map@0.5.x:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
source-map@~0.1.7:
version "0.1.43"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
integrity sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=
dependencies:
amdefine ">=0.0.4"
spdx-correct@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4"
@ -1994,6 +2033,15 @@ uc.micro@^1.0.1, uc.micro@^1.0.5:
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==
uglify-js@~2.3:
version "2.3.6"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.3.6.tgz#fa0984770b428b7a9b2a8058f46355d14fef211a"
integrity sha1-+gmEdwtCi3qbKoBY9GNV0U/vIRo=
dependencies:
async "~0.2.6"
optimist "~0.3.5"
source-map "~0.1.7"
underscore.string@~3.3.4:
version "3.3.5"
resolved "https://registry.yarnpkg.com/underscore.string/-/underscore.string-3.3.5.tgz#fc2ad255b8bd309e239cbc5816fd23a9b7ea4023"
@ -2079,6 +2127,11 @@ wide-align@^1.1.0:
dependencies:
string-width "^1.0.2 || 2"
wordwrap@~0.0.2:
version "0.0.3"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc=
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"