From 7e35b01701a8d872c6268e222f9654aa1c450237 Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Thu, 30 Nov 2017 16:44:53 +0100 Subject: [PATCH 01/12] STIJ-195: Added pre-commit hook support. --- gulpfile.js | 7 +++++++ package.json | 2 ++ yarn.lock | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index e2985c0..bde58f5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -445,3 +445,10 @@ gulp.task('build', ['validate', 'compile']); * */ gulp.task('publish', ['publish:npm']); + +/* + * Add a pre-commit hook task. + * - Tests JS and Style validation before commit. + */ +gulp.task('pre-commit', ['validate']); + diff --git a/package.json b/package.json index f872919..763656a 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,8 @@ "dependencies": { "breakpoint-sass": "^2.7.1", "chosen-js": "^1.8.2", + "git-guppy": "^2.1.0", + "guppy-pre-commit": "^0.4.0", "lightgallery": "^1.6.3" } } diff --git a/yarn.lock b/yarn.lock index 3af87dd..30b29bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -399,7 +399,7 @@ async-foreach@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542" -async@1.5.2, async@^1.4.0: +async@1.5.2, async@^1.4.0, async@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -2551,6 +2551,15 @@ gifsicle@^3.0.0: bin-wrapper "^3.0.0" logalot "^2.0.0" +git-guppy@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/git-guppy/-/git-guppy-2.1.0.tgz#f6513ec963c6056392c1083966ba001a250b6696" + dependencies: + lodash "^4.17.4" + map-stream "0.0.6" + shelljs "^0.6.0" + strip-bom "^2.0.0" + glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" @@ -3013,6 +3022,22 @@ gulplog@^1.0.0: dependencies: glogg "^1.0.0" +guppy-cli@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/guppy-cli/-/guppy-cli-1.0.1.tgz#877c19be828bd5332efce91942952586520bd8fa" + dependencies: + async "^1.5.2" + map-stream "0.0.6" + shelljs "^0.5.3" + vinyl-fs "^2.4.3" + yargs "^3.32.0" + +guppy-pre-commit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/guppy-pre-commit/-/guppy-pre-commit-0.4.0.tgz#2ffe2792243151e40901f138a3a65ec93454e937" + dependencies: + guppy-cli "^1.0.1" + handlebars@^4.0.5: version "4.0.10" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" @@ -4355,6 +4380,10 @@ map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" +map-stream@0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.0.6.tgz#d2ef4eb811a28644c7a8989985c69c2fdd496827" + map-stream@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194" @@ -6386,6 +6415,10 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" +shelljs@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.5.3.tgz#c54982b996c76ef0c1e6b59fbdc5825f5b713113" + shelljs@^0.6.0: version "0.6.1" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.6.1.tgz#ec6211bed1920442088fe0f70b2837232ed2c8a8" @@ -7345,7 +7378,7 @@ vinyl-fs@^0.3.0: through2 "^0.6.1" vinyl "^0.4.0" -vinyl-fs@^2.2.0: +vinyl-fs@^2.2.0, vinyl-fs@^2.4.3: version "2.4.4" resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-2.4.4.tgz#be6ff3270cb55dfd7d3063640de81f25d7532239" dependencies: From 118b22d327ef5928b3976ba6cef3e47d49b39271 Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Thu, 30 Nov 2017 16:50:49 +0100 Subject: [PATCH 02/12] Updated the CHANGELOG. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e0b44f..0f9ad34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to `digipolisgent/fractal_styleguide_gent-base`. ### 2.7.1 * STIJ-193: Added figcaption atom and figure molecule. +* STIJ-195: Added Git pre commit hook support in the gulpfile. ### 2.7.0 **IMPORTANT: Class .text-center has been removed** From f26b5389361a9f13cf0df1226f2cfe4b9236a599 Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 09:11:53 +0100 Subject: [PATCH 03/12] STIJ-195: Add custom pre-commit script. --- package.json | 1 - postinstall.sh | 8 +++++--- scripts/pre-commit | 16 ++++++++++++++++ yarn.lock | 24 ++---------------------- 4 files changed, 23 insertions(+), 26 deletions(-) create mode 100755 scripts/pre-commit diff --git a/package.json b/package.json index 763656a..d7d1228 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "breakpoint-sass": "^2.7.1", "chosen-js": "^1.8.2", "git-guppy": "^2.1.0", - "guppy-pre-commit": "^0.4.0", "lightgallery": "^1.6.3" } } diff --git a/postinstall.sh b/postinstall.sh index f056402..4782d13 100755 --- a/postinstall.sh +++ b/postinstall.sh @@ -5,7 +5,9 @@ if [ -d "./public" ]; then mkdir ./public/styleguide/vendor; - cp -R node_modules/lightgallery ./public/styleguide/vendor/lightgallery; - cp -R node_modules/jquery ./public/styleguide/vendor/jquery; - cp -R node_modules/chosen-js ./public/styleguide/vendor/chosen-js; + cp -R ./node_modules/lightgallery ./public/styleguide/vendor/lightgallery; + cp -R ./node_modules/jquery ./public/styleguide/vendor/jquery; + cp -R ./node_modules/chosen-js ./public/styleguide/vendor/chosen-js; + + cp ./scripts/pre-commit ./.git/hooks/pre-commit fi diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100755 index 0000000..633b557 --- /dev/null +++ b/scripts/pre-commit @@ -0,0 +1,16 @@ +# pre-commit + +echo 'Testing the validity of your code...'; + +# Ensure that code that isn't part of the prospective commit isn't tested within your pre-commit script +git stash -q --keep-index + +# Test prospective commit +gulp validate; + +RESULT=$? + +git stash pop -q + +[ $RESULT -ne 0 ] && exit 1 +exit 0 diff --git a/yarn.lock b/yarn.lock index 30b29bb..5507189 100644 --- a/yarn.lock +++ b/yarn.lock @@ -399,7 +399,7 @@ async-foreach@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542" -async@1.5.2, async@^1.4.0, async@^1.5.2: +async@1.5.2, async@^1.4.0: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -3022,22 +3022,6 @@ gulplog@^1.0.0: dependencies: glogg "^1.0.0" -guppy-cli@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/guppy-cli/-/guppy-cli-1.0.1.tgz#877c19be828bd5332efce91942952586520bd8fa" - dependencies: - async "^1.5.2" - map-stream "0.0.6" - shelljs "^0.5.3" - vinyl-fs "^2.4.3" - yargs "^3.32.0" - -guppy-pre-commit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/guppy-pre-commit/-/guppy-pre-commit-0.4.0.tgz#2ffe2792243151e40901f138a3a65ec93454e937" - dependencies: - guppy-cli "^1.0.1" - handlebars@^4.0.5: version "4.0.10" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" @@ -6415,10 +6399,6 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" -shelljs@^0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.5.3.tgz#c54982b996c76ef0c1e6b59fbdc5825f5b713113" - shelljs@^0.6.0: version "0.6.1" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.6.1.tgz#ec6211bed1920442088fe0f70b2837232ed2c8a8" @@ -7378,7 +7358,7 @@ vinyl-fs@^0.3.0: through2 "^0.6.1" vinyl "^0.4.0" -vinyl-fs@^2.2.0, vinyl-fs@^2.4.3: +vinyl-fs@^2.2.0: version "2.4.4" resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-2.4.4.tgz#be6ff3270cb55dfd7d3063640de81f25d7532239" dependencies: From 22352922485eed3d2642f3591940b3b154bc1b7c Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 09:13:35 +0100 Subject: [PATCH 04/12] STIJ-195: Removed guppy dependency. --- gulpfile.js | 7 ------- package.json | 1 - 2 files changed, 8 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index bde58f5..e2985c0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -445,10 +445,3 @@ gulp.task('build', ['validate', 'compile']); * */ gulp.task('publish', ['publish:npm']); - -/* - * Add a pre-commit hook task. - * - Tests JS and Style validation before commit. - */ -gulp.task('pre-commit', ['validate']); - diff --git a/package.json b/package.json index d7d1228..f872919 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "dependencies": { "breakpoint-sass": "^2.7.1", "chosen-js": "^1.8.2", - "git-guppy": "^2.1.0", "lightgallery": "^1.6.3" } } From f541bcbad1698f433f28dc02ad0ffda252ec24ef Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 09:14:40 +0100 Subject: [PATCH 05/12] STIJ-195: Updated yarn.lock --- yarn.lock | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5507189..3af87dd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2551,15 +2551,6 @@ gifsicle@^3.0.0: bin-wrapper "^3.0.0" logalot "^2.0.0" -git-guppy@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/git-guppy/-/git-guppy-2.1.0.tgz#f6513ec963c6056392c1083966ba001a250b6696" - dependencies: - lodash "^4.17.4" - map-stream "0.0.6" - shelljs "^0.6.0" - strip-bom "^2.0.0" - glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" @@ -4364,10 +4355,6 @@ map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" -map-stream@0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.0.6.tgz#d2ef4eb811a28644c7a8989985c69c2fdd496827" - map-stream@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194" From c7a692dbbd6265c9d49df5de07fc55078b93730c Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 09:18:23 +0100 Subject: [PATCH 06/12] STIJ-195: Testing broken JS code. From d267a6b94a859d091902a02eaa233bad59ce1137 Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 10:29:51 +0100 Subject: [PATCH 07/12] STIJ-195: Testing broken JS code. --- .../building-blocks/hamburger-menu/hamburger-menu.binding.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js b/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js index 09fad14..992f822 100644 --- a/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js +++ b/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js @@ -13,4 +13,6 @@ } }); + dd + })(jQuery); From 246ea6f7c8d77dde1531197303adaabcd537b03b Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 10:38:18 +0100 Subject: [PATCH 08/12] STIJ-195: Updated pre-commit script. --- scripts/pre-commit | 9 --------- 1 file changed, 9 deletions(-) diff --git a/scripts/pre-commit b/scripts/pre-commit index 633b557..409ffa1 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -3,14 +3,5 @@ echo 'Testing the validity of your code...'; # Ensure that code that isn't part of the prospective commit isn't tested within your pre-commit script -git stash -q --keep-index - # Test prospective commit gulp validate; - -RESULT=$? - -git stash pop -q - -[ $RESULT -ne 0 ] && exit 1 -exit 0 From 7a4d0fe13f4e0812d7279cab057f90f6bb324b5d Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 10:38:51 +0100 Subject: [PATCH 09/12] STIJ-195: Testing broken JS code. --- .../building-blocks/hamburger-menu/hamburger-menu.binding.js | 1 - 1 file changed, 1 deletion(-) diff --git a/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js b/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js index 992f822..24a3fc6 100644 --- a/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js +++ b/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js @@ -12,7 +12,6 @@ $hamburgerMenu.loadHamburgerMenu(); } }); - dd })(jQuery); From 394424894c03101f2a77f7d99051c212dbcc1356 Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 10:39:19 +0100 Subject: [PATCH 10/12] STIJ-195: Fix broken code. --- .../building-blocks/hamburger-menu/hamburger-menu.binding.js | 1 - 1 file changed, 1 deletion(-) diff --git a/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js b/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js index 24a3fc6..09fad14 100644 --- a/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js +++ b/components/31-molecules/building-blocks/hamburger-menu/hamburger-menu.binding.js @@ -12,6 +12,5 @@ $hamburgerMenu.loadHamburgerMenu(); } }); - dd })(jQuery); From a7bdc31bbadda3c3b53c74866f0393c73094f83b Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 10:43:02 +0100 Subject: [PATCH 11/12] STIJ-195: Add symlink instead of copy. --- postinstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postinstall.sh b/postinstall.sh index 4782d13..19792f8 100755 --- a/postinstall.sh +++ b/postinstall.sh @@ -9,5 +9,5 @@ if [ -d "./public" ]; then cp -R ./node_modules/jquery ./public/styleguide/vendor/jquery; cp -R ./node_modules/chosen-js ./public/styleguide/vendor/chosen-js; - cp ./scripts/pre-commit ./.git/hooks/pre-commit + ln -sf ./scripts/pre-commit ./.git/hooks/pre-commit fi From 16ff3818e4a439b8c5e270dd0d3ea630918fc812 Mon Sep 17 00:00:00 2001 From: Gert-Jan Meire Date: Fri, 1 Dec 2017 10:45:49 +0100 Subject: [PATCH 12/12] STIJ-195: Add correct path to symlink. --- postinstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postinstall.sh b/postinstall.sh index 19792f8..96cb57c 100755 --- a/postinstall.sh +++ b/postinstall.sh @@ -9,5 +9,5 @@ if [ -d "./public" ]; then cp -R ./node_modules/jquery ./public/styleguide/vendor/jquery; cp -R ./node_modules/chosen-js ./public/styleguide/vendor/chosen-js; - ln -sf ./scripts/pre-commit ./.git/hooks/pre-commit + ln -sf $PWD/scripts/pre-commit $PWD/.git/hooks/pre-commit fi