From 919d3f8dcf802c8abab73cb092b44dd1ff83ec21 Mon Sep 17 00:00:00 2001 From: JounQin Date: Tue, 23 Mar 2021 23:35:10 +0800 Subject: [PATCH] feat!: replace husky with simple-git-hooks --- .huskyrc.js | 1 - .simple-git-hooks.js | 1 + package.json | 2 +- packages/common-config/package.json | 4 +- packages/simple-git-hooks/index.js | 4 ++ packages/simple-git-hooks/package.json | 14 +++++++ yarn.lock | 55 +++----------------------- 7 files changed, 27 insertions(+), 54 deletions(-) delete mode 100644 .huskyrc.js create mode 100644 .simple-git-hooks.js create mode 100644 packages/simple-git-hooks/index.js create mode 100644 packages/simple-git-hooks/package.json diff --git a/.huskyrc.js b/.huskyrc.js deleted file mode 100644 index 29b2f075..00000000 --- a/.huskyrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@1stg/husky-config') diff --git a/.simple-git-hooks.js b/.simple-git-hooks.js new file mode 100644 index 00000000..abd85eca --- /dev/null +++ b/.simple-git-hooks.js @@ -0,0 +1 @@ +module.exports = require('@1stg/simple-git-hooks') diff --git a/package.json b/package.json index 2af7df59..e759dc1a 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "lint:scss": "stylelint --cache 'tests/*.{scss,vue}'", "lint:ts": "tslint -p . -t stylish", "lint:tsc": "tsc", - "postinstall": "yarn-deduplicate --strategy fewer || exit 0", + "postinstall": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0", "test": "jest ---collectCoverage", "typecov": "type-coverage" }, diff --git a/packages/common-config/package.json b/packages/common-config/package.json index 7b25fb44..13750d9f 100644 --- a/packages/common-config/package.json +++ b/packages/common-config/package.json @@ -13,16 +13,16 @@ "@1stg/babel-preset": "^1.6.0", "@1stg/commitlint-config": "^1.0.3", "@1stg/eslint-config": "^1.10.0", - "@1stg/husky-config": "^1.0.2", "@1stg/lint-staged": "^1.2.1", "@1stg/prettier-config": "^1.6.0", "@1stg/remark-config": "^1.1.0", + "@1stg/simple-git-hooks": "^0.1.0", "@1stg/tsconfig": "^1.2.0", "@babel/core": "^7.13.10", "eslint": "^7.22.0", - "husky": "^4.3.8", "lint-staged": "^10.5.4", "prettier": "^2.2.1", + "simple-git-hooks": "^2.2.0", "tslib": "^2.1.0" }, "publishConfig": { diff --git a/packages/simple-git-hooks/index.js b/packages/simple-git-hooks/index.js new file mode 100644 index 00000000..96db0849 --- /dev/null +++ b/packages/simple-git-hooks/index.js @@ -0,0 +1,4 @@ +module.exports = { + 'pre-commit': 'npx lint-staged', + 'commit-msg': `npx commitlint -e`, +} diff --git a/packages/simple-git-hooks/package.json b/packages/simple-git-hooks/package.json new file mode 100644 index 00000000..79f3819d --- /dev/null +++ b/packages/simple-git-hooks/package.json @@ -0,0 +1,14 @@ +{ + "name": "@1stg/simple-git-hooks", + "version": "0.1.0", + "description": "Personal but Shareable simple-git-hooks Configuration for all 1stG.me projects.", + "repository": "git@github.com:1stG/configs.git", + "author": "JounQin ", + "license": "MIT", + "peerDependencies": { + "simple-git-hooks": ">=2.2.0" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/yarn.lock b/yarn.lock index b2779fc1..a4576b76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4243,11 +4243,6 @@ compare-func@^2.0.0: array-ify "^1.0.0" dot-prop "^5.1.0" -compare-versions@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.6.0.tgz#1a5689913685e5a87637b8d3ffca75514ec41d62" - integrity sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA== - component-emitter@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" @@ -6042,13 +6037,6 @@ find-versions@^3.0.0: dependencies: semver-regex "^2.0.0" -find-versions@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/find-versions/-/find-versions-4.0.0.tgz#3c57e573bf97769b8cb8df16934b627915da4965" - integrity sha512-wgpWy002tA+wgmO27buH/9KzyEOQnKsG/R0yrcjPT9BOFm0zRBVQbZ95nRGXWMywS8YR5knRbpohio0bcJABxQ== - dependencies: - semver-regex "^3.1.2" - flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -6748,22 +6736,6 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@^4.3.8: - version "4.3.8" - resolved "https://registry.yarnpkg.com/husky/-/husky-4.3.8.tgz#31144060be963fd6850e5cc8f019a1dfe194296d" - integrity sha512-LCqqsB0PzJQ/AlCgfrfzRe3e3+NvmefAdKQhRYpxS4u6clblBoDdzzvHi8fmxKRzvMxPY/1WZWzomPZww0Anow== - dependencies: - chalk "^4.0.0" - ci-info "^2.0.0" - compare-versions "^3.6.0" - cosmiconfig "^7.0.0" - find-versions "^4.0.0" - opencollective-postinstall "^2.0.2" - pkg-dir "^5.0.0" - please-upgrade-node "^3.2.0" - slash "^3.0.0" - which-pm-runs "^1.0.0" - iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -9434,11 +9406,6 @@ open@^7.0.4: is-docker "^2.0.0" is-wsl "^2.1.1" -opencollective-postinstall@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259" - integrity sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q== - optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -9912,13 +9879,6 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -pkg-dir@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-5.0.0.tgz#a02d6aebe6ba133a928f74aec20bafdfe6b8e760" - integrity sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA== - dependencies: - find-up "^5.0.0" - please-upgrade-node@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942" @@ -12273,11 +12233,6 @@ semver-regex@^2.0.0: resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-2.0.0.tgz#a93c2c5844539a770233379107b38c7b4ac9d338" integrity sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw== -semver-regex@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.2.tgz#34b4c0d361eef262e07199dbef316d0f2ab11807" - integrity sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA== - semver-truncate@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/semver-truncate/-/semver-truncate-1.1.2.tgz#57f41de69707a62709a7e0104ba2117109ea47e8" @@ -12393,6 +12348,11 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== +simple-git-hooks@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/simple-git-hooks/-/simple-git-hooks-2.2.0.tgz#97fd946dba9c9c31db495f4f335094d0c3988425" + integrity sha512-bxXq98GQvXAORuugWDhL0ZcydpWE6384nS/qTpqZ5NTd4GECx+HtvaqfU0wu+PHhBQT+HhektpZEpTM5b3VuBA== + simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" @@ -14032,11 +13992,6 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which-pm-runs@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb" - integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= - which@^1.2.9, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"