From eb9b374e0f4c9dd1939a9d16ac5d252868b9001b Mon Sep 17 00:00:00 2001 From: Jeff Yang <32727188+ydcjeff@users.noreply.github.com> Date: Wed, 5 Jan 2022 20:48:11 +0630 Subject: [PATCH] workflow: switch to simple-git-hooks (#6219) --- package.json | 10 ++-- pnpm-lock.yaml | 116 ++++------------------------------------ scripts/verifyCommit.ts | 5 +- 3 files changed, 17 insertions(+), 114 deletions(-) diff --git a/package.json b/package.json index 6c5eb872a..732cd385f 100644 --- a/package.json +++ b/package.json @@ -52,17 +52,17 @@ "rimraf": "^3.0.2", "rollup": "^2.59.0", "semver": "^7.3.5", + "simple-git-hooks": "^2.7.0", "sirv": "^2.0.0", "ts-jest": "^27.1.2", "ts-node": "^10.4.0", "typescript": "~4.5.4", "vite": "workspace:*", - "vitepress": "^0.20.10", - "yorkie": "^2.0.0" + "vitepress": "^0.20.10" }, - "gitHooks": { - "pre-commit": "lint-staged --concurrent false", - "commit-msg": "ts-node scripts/verifyCommit.ts" + "simple-git-hooks": { + "pre-commit": "pnpm exec lint-staged --concurrent false", + "commit-msg": "pnpm exec ts-node scripts/verifyCommit.ts $1" }, "lint-staged": { "*": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1d99bd1eb..7dd7112fb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,13 +36,13 @@ importers: rimraf: ^3.0.2 rollup: ^2.59.0 semver: ^7.3.5 + simple-git-hooks: ^2.7.0 sirv: ^2.0.0 ts-jest: ^27.1.2 ts-node: ^10.4.0 typescript: ~4.5.4 vite: workspace:* vitepress: ^0.20.10 - yorkie: ^2.0.0 devDependencies: '@microsoft/api-extractor': 7.19.3 '@types/fs-extra': 9.0.13 @@ -72,13 +72,13 @@ importers: rimraf: 3.0.2 rollup: 2.62.0 semver: 7.3.5 + simple-git-hooks: 2.7.0 sirv: 2.0.0 ts-jest: 27.1.2_1b5a1be2010a86e622f02a11eaeb730f ts-node: 10.4.0_00264fd83560919cd06c986889baae0a typescript: 4.5.4 vite: link:packages/vite vitepress: 0.20.10 - yorkie: 2.0.0 packages/create-vite: specifiers: @@ -3083,10 +3083,6 @@ packages: engines: {node: '>=10'} dev: false - /ci-info/1.6.0: - resolution: {integrity: sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==} - dev: true - /ci-info/3.3.0: resolution: {integrity: sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==} dev: true @@ -3226,6 +3222,7 @@ packages: /commander/2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + requiresBuild: true dev: true /commander/7.2.0: @@ -3544,16 +3541,6 @@ packages: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} dev: true - /create-vite/2.7.2: - resolution: {integrity: sha512-4Eint1oL6GcZWGkgLbSmbzY1UNTkqQyjD9T4aM1YQsltKQ5ZNWDy+rvgYRPV9dR0XD6eLPs8TUUoge1xQCd4BA==} - engines: {node: '>=12.0.0'} - hasBin: true - dependencies: - kolorist: 1.5.0 - minimist: 1.2.5 - prompts: 2.4.2 - dev: false - /cross-env/7.0.3: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} @@ -3562,14 +3549,6 @@ packages: cross-spawn: 7.0.3 dev: true - /cross-spawn/5.1.0: - resolution: {integrity: sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=} - dependencies: - lru-cache: 4.1.5 - shebang-command: 1.2.0 - which: 1.3.1 - dev: true - /cross-spawn/6.0.5: resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==} engines: {node: '>=4.8'} @@ -4371,19 +4350,6 @@ packages: resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} dev: true - /execa/0.8.0: - resolution: {integrity: sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=} - engines: {node: '>=4'} - dependencies: - cross-spawn: 5.1.0 - get-stream: 3.0.0 - is-stream: 1.1.0 - npm-run-path: 2.0.2 - p-finally: 1.0.0 - signal-exit: 3.0.6 - strip-eof: 1.0.0 - dev: true - /execa/5.1.1: resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} engines: {node: '>=10'} @@ -4702,11 +4668,6 @@ packages: yargs: 16.2.0 dev: true - /get-stream/3.0.0: - resolution: {integrity: sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=} - engines: {node: '>=4'} - dev: true - /get-stream/5.2.0: resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==} engines: {node: '>=8'} @@ -5154,13 +5115,6 @@ packages: engines: {node: '>= 0.4'} dev: true - /is-ci/1.2.1: - resolution: {integrity: sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==} - hasBin: true - dependencies: - ci-info: 1.6.0 - dev: true - /is-color-stop/1.1.0: resolution: {integrity: sha1-z/9HGu5N1cnhWFmPvhKWe1za00U=} dependencies: @@ -5277,11 +5231,6 @@ packages: resolution: {integrity: sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==} dev: true - /is-stream/1.1.0: - resolution: {integrity: sha1-EtSj3U5o4Lec6428hBc66A2RykQ=} - engines: {node: '>=0.10.0'} - dev: true - /is-stream/2.0.1: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} @@ -6212,13 +6161,6 @@ packages: js-tokens: 4.0.0 dev: false - /lru-cache/4.1.5: - resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} - dependencies: - pseudomap: 1.0.2 - yallist: 2.1.2 - dev: true - /lru-cache/6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} @@ -6587,11 +6529,6 @@ packages: validate-npm-package-license: 3.0.4 dev: true - /normalize-path/1.0.0: - resolution: {integrity: sha1-MtDkcvkf80VwHBWoMRAY07CpA3k=} - engines: {node: '>=0.10.0'} - dev: true - /normalize-path/3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -6621,13 +6558,6 @@ packages: string.prototype.padend: 3.1.3 dev: true - /npm-run-path/2.0.2: - resolution: {integrity: sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=} - engines: {node: '>=4'} - dependencies: - path-key: 2.0.1 - dev: true - /npm-run-path/4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -6743,11 +6673,6 @@ packages: word-wrap: 1.2.3 dev: true - /p-finally/1.0.0: - resolution: {integrity: sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=} - engines: {node: '>=4'} - dev: true - /p-limit/1.3.0: resolution: {integrity: sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==} engines: {node: '>=4'} @@ -7204,10 +7129,6 @@ packages: dev: true optional: true - /pseudomap/1.0.2: - resolution: {integrity: sha1-8FKijacOYYkX7wqKw0wa5aaChrM=} - dev: true - /psl/1.8.0: resolution: {integrity: sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==} dev: true @@ -7835,6 +7756,12 @@ packages: /signal-exit/3.0.6: resolution: {integrity: sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==} + /simple-git-hooks/2.7.0: + resolution: {integrity: sha512-nQe6ASMO9zn5/htIrU37xEIHGr9E6wikXelLbOeTcfsX2O++DHaVug7RSQoq+kO7DvZTH37WA5gW49hN9HTDmQ==} + hasBin: true + requiresBuild: true + dev: true + /simple-swizzle/0.2.2: resolution: {integrity: sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=} dependencies: @@ -8127,21 +8054,11 @@ packages: engines: {node: '>=8'} dev: true - /strip-eof/1.0.0: - resolution: {integrity: sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=} - engines: {node: '>=0.10.0'} - dev: true - /strip-final-newline/2.0.0: resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} engines: {node: '>=6'} dev: true - /strip-indent/2.0.0: - resolution: {integrity: sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=} - engines: {node: '>=4'} - dev: true - /strip-indent/3.0.0: resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==} engines: {node: '>=8'} @@ -8993,10 +8910,6 @@ packages: engines: {node: '>=10'} dev: true - /yallist/2.1.2: - resolution: {integrity: sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=} - dev: true - /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} @@ -9040,17 +8953,6 @@ packages: engines: {node: '>=6'} dev: true - /yorkie/2.0.0: - resolution: {integrity: sha512-jcKpkthap6x63MB4TxwCyuIGkV0oYP/YRyuQU5UO0Yz/E/ZAu+653/uov+phdmO54n6BcvFRyyt0RRrWdN2mpw==} - engines: {node: '>=4'} - requiresBuild: true - dependencies: - execa: 0.8.0 - is-ci: 1.2.1 - normalize-path: 1.0.0 - strip-indent: 2.0.0 - dev: true - /youch/2.2.2: resolution: {integrity: sha512-/FaCeG3GkuJwaMR34GHVg0l8jCbafZLHiFowSjqLlqhC6OMyf2tPJBu8UirF7/NI9X/R5ai4QfEKUCOxMAGxZQ==} dependencies: diff --git a/scripts/verifyCommit.ts b/scripts/verifyCommit.ts index 47ec89c2d..e433e3aa1 100644 --- a/scripts/verifyCommit.ts +++ b/scripts/verifyCommit.ts @@ -1,9 +1,10 @@ -// Invoked on the commit-msg git hook by yorkie. +// Invoked on the commit-msg git hook by simple-git-hooks. import colors from 'picocolors' import { readFileSync } from 'fs' -const msgPath = process.env.GIT_PARAMS! +// get $1 from commit-msg script +const msgPath = process.argv[2] const msg = readFileSync(msgPath, 'utf-8').trim() const releaseRE = /^v\d/