From 1ef93abd6ed05eb13062348071e96b005ab7d32c Mon Sep 17 00:00:00 2001 From: "Davis Z. Cabral" Date: Mon, 9 Jan 2017 17:13:07 -0200 Subject: [PATCH] Use Husky rather than deprecated ghooks See gtramontina/ghooks#166 for more info --- ignite-base/README.md.template | 2 +- ignite-base/package.json | 13 ++-- ignite-base/package.json.template | 13 ++-- ignite-base/yarn.lock | 115 ++++++++---------------------- 4 files changed, 42 insertions(+), 101 deletions(-) diff --git a/ignite-base/README.md.template b/ignite-base/README.md.template index 3d56fcc1a..c9dd7bd5f 100644 --- a/ignite-base/README.md.template +++ b/ignite-base/README.md.template @@ -29,7 +29,7 @@ This project adheres to Standard. Our CI enforces this, so we suggest you enabl **To Lint on Commit** -This is implemented using [ghooks](https://github.com/gtramontina/ghooks). There is no additional setup needed. +This is implemented using [husky](https://github.com/typicode/husky). There is no additional setup needed. **Bypass Lint** diff --git a/ignite-base/package.json b/ignite-base/package.json index 2c3c81e07..ff3d1b848 100644 --- a/ignite-base/package.json +++ b/ignite-base/package.json @@ -20,7 +20,11 @@ "android:devices": "$ANDROID_HOME/platform-tools/adb devices", "android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V", "android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82", - "flow": "flow --show-all-errors" + "flow": "flow --show-all-errors", + "precommit": "npm run git-hook", + "prepush": "npm run git-hook", + "postrewrite": "npm run git-hook", + "git-hook": "if [ -d 'ignite-base' ]; then cd ignite-base; fi; npm run lint" }, "dependencies": { "apisauce": "^0.6.0", @@ -52,7 +56,7 @@ "babel-preset-es2015": "^6.18.0", "enzyme": "^2.6.0", "flow-bin": "0.33.0", - "ghooks": "^1.3.2", + "husky": "^0.12.0", "mockery": "^2.0.0", "nyc": "^9.0.1", "react-addons-test-utils": "^15.3.1", @@ -91,10 +95,5 @@ "FormData", "React$Element" ] - }, - "config": { - "ghooks": { - "pre-commit": "if [ -d 'ignite-base' ]; then cd ignite-base; fi; npm run lint" - } } } diff --git a/ignite-base/package.json.template b/ignite-base/package.json.template index 42f17abc6..15d03f093 100644 --- a/ignite-base/package.json.template +++ b/ignite-base/package.json.template @@ -20,7 +20,11 @@ "android:devices": "$ANDROID_HOME/platform-tools/adb devices", "android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V", "android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82", - "flow": "flow --show-all-errors" + "flow": "flow --show-all-errors", + "precommit": "npm run git-hook", + "prepush": "npm run git-hook", + "postrewrite": "npm run git-hook", + "git-hook": "if [ -d 'ignite-base' ]; then cd ignite-base; fi; npm run lint" }, "dependencies": { "apisauce": "^0.6.0", @@ -52,7 +56,7 @@ "babel-preset-es2015": "^6.18.0", "enzyme": "^2.6.0", "flow-bin": "0.33.0", - "ghooks": "^1.3.2", + "husky": "^0.12.0", "mockery": "^2.0.0", "nyc": "^9.0.1", "react-addons-test-utils": "^15.3.1", @@ -91,10 +95,5 @@ "FormData", "React$Element" ] - }, - "config": { - "ghooks": { - "pre-commit": "if [ -d 'ignite-base' ]; then cd ignite-base; fi; npm run lint" - } } } diff --git a/ignite-base/yarn.lock b/ignite-base/yarn.lock index 15f7062c6..2c06e1939 100644 --- a/ignite-base/yarn.lock +++ b/ignite-base/yarn.lock @@ -1773,6 +1773,10 @@ chokidar@^1.4.2: optionalDependencies: fsevents "^1.0.0" +ci-info@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" + circular-json@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" @@ -1874,10 +1878,6 @@ code-point-at@^1.0.0: dependencies: number-is-nan "^1.0.0" -colors@~0.6.0-1: - version "0.6.2" - resolved "https://registry.yarnpkg.com/colors/-/colors-0.6.2.tgz#2423fe6678ac0c5dae8852e5d0e5be08c997abcc" - colors@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" @@ -1888,16 +1888,12 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@^2.5.0, commander@^2.9.0, commander@2.9.0: +commander@^2.5.0, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: graceful-readlink ">= 1.0.0" -commander@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.1.0.tgz#d121bbae860d9992a3d517ba96f56588e47c6781" - commander@~2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4" @@ -2102,7 +2098,7 @@ create-error-class@^3.0.1: dependencies: capture-stack-trace "^1.0.0" -cross-spawn-async@^2.1.1, cross-spawn-async@^2.2.2: +cross-spawn-async@^2.2.2: version "2.2.4" resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-2.2.4.tgz#c9a8d8e9a06502c7a46296e33a1a054b5d2f1812" dependencies: @@ -3054,17 +3050,6 @@ exec-sh@^0.2.0: dependencies: merge "^1.1.3" -execa@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.4.0.tgz#4eb6467a36a095fabb2970ff9d5e3fb7bce6ebc3" - dependencies: - cross-spawn-async "^2.1.1" - is-stream "^1.1.0" - npm-run-path "^1.0.0" - object-assign "^4.0.1" - path-key "^1.0.0" - strip-eof "^1.0.0" - exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" @@ -3246,6 +3231,10 @@ find-cache-dir@^0.1.1: mkdirp "^0.5.1" pkg-dir "^1.0.0" +find-parent-dir@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" + find-root@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.0.0.tgz#962ff211aab25c6520feeeb8d6287f8f6e95807a" @@ -3257,13 +3246,6 @@ find-up@^1.0.0, find-up@^1.1.2: path-exists "^2.0.0" pinkie-promise "^2.0.0" -findup@0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/findup/-/findup-0.1.5.tgz#8ad929a3393bac627957a7e5de4623b06b0e2ceb" - dependencies: - colors "~0.6.0-1" - commander "~2.1.0" - first-chunk-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz#59bfb50cd905f60d7c394cd3d9acaab4e6ad934e" @@ -3466,18 +3448,6 @@ gh-got@^2.2.0: object-assign "^4.0.1" pinkie-promise "^2.0.0" -ghooks@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/ghooks/-/ghooks-1.3.2.tgz#bee29deec4283e23eb1ff37d94a8120acd4332e9" - dependencies: - execa "^0.4.0" - findup "0.1.5" - lodash.clone "4.3.2" - manage-path "2.0.0" - opt-cli "1.5.1" - path-exists "^2.0.0" - spawn-command "0.0.2" - github-username@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/github-username/-/github-username-2.1.0.tgz#200e5a104af42ba08a54096c708d4b6ec2fa256b" @@ -3847,6 +3817,14 @@ http-signature@~1.1.0: jsprim "^1.2.2" sshpk "^1.7.0" +husky@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-0.12.0.tgz#3a44922fce8071803242c3c7522a6582c50525dc" + dependencies: + find-parent-dir "^0.3.0" + is-ci "^1.0.9" + normalize-path "^1.0.0" + iconv-lite@^0.4.5, iconv-lite@~0.4.13, iconv-lite@0.4.13: version "0.4.13" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2" @@ -4010,6 +3988,12 @@ is-ci@^1.0.7: version "1.0.9" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.9.tgz#de2c5ffe49ab3237fda38c47c8a3bbfd55bbcca7" +is-ci@^1.0.9: + version "1.0.10" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" + dependencies: + ci-info "^1.0.0" + is-date-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" @@ -4163,7 +4147,7 @@ is-retry-allowed@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" -is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: +is-stream@^1.0.0, is-stream@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -4492,10 +4476,6 @@ lodash-es@^4.2.1: version "4.16.4" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.16.4.tgz#4dc3e2cf33a8c343028aa7f7e06d1c9697042599" -lodash._baseclone@~4.5.0: - version "4.5.7" - resolved "https://registry.yarnpkg.com/lodash._baseclone/-/lodash._baseclone-4.5.7.tgz#ce42ade08384ef5d62fa77c30f61a46e686f8434" - lodash._basecopy@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" @@ -4544,12 +4524,6 @@ lodash.bind@^4.1.4: version "4.2.1" resolved "https://registry.yarnpkg.com/lodash.bind/-/lodash.bind-4.2.1.tgz#7ae3017e939622ac31b7d7d7dcb1b34db1690d35" -lodash.clone@4.3.2: - version "4.3.2" - resolved "https://registry.yarnpkg.com/lodash.clone/-/lodash.clone-4.3.2.tgz#e56b176b6823a7dde38f7f2bf58de7d5971200e9" - dependencies: - lodash._baseclone "~4.5.0" - lodash.cond@^4.3.0: version "4.5.2" resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" @@ -4737,10 +4711,6 @@ makeerror@1.0.x: dependencies: tmpl "1.0.x" -manage-path@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/manage-path/-/manage-path-2.0.0.tgz#f4cf8457b926eeee2a83b173501414bc76eb9597" - 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" @@ -5043,16 +5013,14 @@ normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" +normalize-path@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" + normalize-path@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a" -npm-run-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-1.0.0.tgz#f5c32bf595fe81ae927daec52e82f8b000ac3c8f" - dependencies: - path-key "^1.0.0" - npmlog@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-2.0.4.tgz#98b52530f2514ca90d09ec5b22c8846722375692" @@ -5211,15 +5179,6 @@ opn@^3.0.2: dependencies: object-assign "^4.0.1" -opt-cli@1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/opt-cli/-/opt-cli-1.5.1.tgz#04db447b13c96b992eb31685266f4ed0d9736dc2" - dependencies: - commander "2.9.0" - lodash.clone "4.3.2" - manage-path "2.0.0" - spawn-command "0.0.2-1" - optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" @@ -5364,10 +5323,6 @@ path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" -path-key@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-1.0.0.tgz#5d53d578019646c0d68800db4e146e6bdc2ac7af" - path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" @@ -6550,14 +6505,6 @@ sparkles@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.0.tgz#1acbbfb592436d10bbe8f785b7cc6f82815012c3" -spawn-command@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2.tgz#9544e1a43ca045f8531aac1a48cb29bdae62338e" - -spawn-command@0.0.2-1: - version "0.0.2-1" - resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0" - spawn-sync@^1.0.15: version "1.0.15" resolved "https://registry.yarnpkg.com/spawn-sync/-/spawn-sync-1.0.15.tgz#b00799557eb7fb0c8376c29d44e8a1ea67e57476" @@ -6804,10 +6751,6 @@ strip-dirs@^1.0.0: minimist "^1.1.0" sum-up "^1.0.1" -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - strip-indent@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2"