diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 0000000..782e55a --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,30 @@ +{ + "rules": { + "type-enum": [ + 2, + "always", + [ + "feat", + "fix", + "docs", + "style", + "refactor", + "perf", + "test", + "build", + "ci", + "chore", + "revert" + ] + ], + "scope-case": [2, "always", "lower-case"], + "subject-case": [ + 2, + "never", + ["sentence-case", "start-case", "pascal-case", "upper-case"] + ], + "subject-empty": [2, "never"], + "subject-full-stop": [2, "never", "."], + "header-max-length": [2, "always", 92] + } +} diff --git a/.githooks/commit-msg b/.githooks/commit-msg index 89cae13..575197e 100755 --- a/.githooks/commit-msg +++ b/.githooks/commit-msg @@ -1,9 +1,9 @@ #!/bin/sh echo -e "\e[35m➤ [COMMIT]\e[0m Checking message\e[37m - \e[33m$(date +"%H:%M:%S")\e[0m" -deno task --eval commitlint --edit $1 -# if [[ $? != 0 ]]; then -# echo -e "\e[31m➤ [COMMIT]\e[0m Wrong format on message\e[37m - \e[33m$(date +"%H:%M:%S")\e[0m" -# exit -1 -# fi +deno run -A npm:commitlint -g "./.commitlintrc.json" --edit $1 +if [[ $? != 0 ]]; then + echo -e "\e[31m➤ [COMMIT]\e[0m Wrong format on message\e[37m - \e[33m$(date +"%H:%M:%S")\e[0m" + exit -1 +fi echo -e "\e[32m➤ [COMMIT]\e[0m Message ok\e[37m - \e[33m$(date +"%H:%M:%S")\e[0m" diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index fa584fb..0000000 --- a/commitlint.config.js +++ /dev/null @@ -1 +0,0 @@ -export default { extends: ["@commitlint/config-conventional"] }; diff --git a/deno.json b/deno.json index c33d3a7..a8719a4 100644 --- a/deno.json +++ b/deno.json @@ -4,13 +4,12 @@ "dev": "deno run -R --watch src/main.ts", "today:dev": "deno run -R --watch src/main.ts $(date +%e)", "today": "deno run -R src/main.ts $(date +%e)", - "test": "deno test --parallel src" + "test": "deno test --parallel src", + "lint:commit": "commitlint --edit" }, "imports": { "@commitlint/cli": "npm:@commitlint/cli@^20.1.0", - "@commitlint/config-conventional": "npm:@commitlint/config-conventional@^20.0.0", "@std/assert": "jsr:@std/assert@1", - "@/": "./src/", "lint-staged": "npm:lint-staged@^16.2.7" } } diff --git a/deno.lock b/deno.lock index 8f33147..870ac63 100644 --- a/deno.lock +++ b/deno.lock @@ -4,7 +4,7 @@ "jsr:@std/assert@1": "1.0.14", "jsr:@std/internal@^1.0.10": "1.0.10", "npm:@commitlint/cli@^20.1.0": "20.1.0", - "npm:@commitlint/config-conventional@20": "20.0.0", + "npm:commitlint@*": "20.1.0", "npm:lint-staged@*": "16.2.7", "npm:lint-staged@^16.2.7": "16.2.7" }, @@ -44,13 +44,6 @@ ], "bin": true }, - "@commitlint/config-conventional@20.0.0": { - "integrity": "sha512-q7JroPIkDBtyOkVe9Bca0p7kAUYxZMxkrBArCfuD3yN4KjRAenP9PmYwnn7rsw8Q+hHq1QB2BRmBh0/Z19ZoJw==", - "dependencies": [ - "@commitlint/types", - "conventional-changelog-conventionalcommits" - ] - }, "@commitlint/config-validator@20.0.0": { "integrity": "sha512-BeyLMaRIJDdroJuYM2EGhDMGwVBMZna9UiIqV9hxj+J551Ctc6yoGuGSmghOy/qPhBSuhA6oMtbEiTmxECafsg==", "dependencies": [ @@ -271,6 +264,14 @@ "commander@14.0.2": { "integrity": "sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ==" }, + "commitlint@20.1.0": { + "integrity": "sha512-3W3CTUpZl6R98UquFiZA/C9yGdzGJU2rmVIXlx6tvKNX8hzLuiPsoZINFfzKnfCnaSP07Xys5aXP+FE7vXZmEg==", + "dependencies": [ + "@commitlint/cli", + "@commitlint/types" + ], + "bin": true + }, "compare-func@2.0.0": { "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", "dependencies": [ @@ -284,12 +285,6 @@ "compare-func" ] }, - "conventional-changelog-conventionalcommits@7.0.2": { - "integrity": "sha512-NKXYmMR/Hr1DevQegFB4MwfM5Vv0m4UIxKZTTYuD98lpTknaZlSRrDOG4X7wIXpGkfsYxZTghUN+Qq+T0YQI7w==", - "dependencies": [ - "compare-func" - ] - }, "conventional-commits-parser@5.0.0": { "integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", "dependencies": [ @@ -739,7 +734,6 @@ "dependencies": [ "jsr:@std/assert@1", "npm:@commitlint/cli@^20.1.0", - "npm:@commitlint/config-conventional@20", "npm:lint-staged@^16.2.7" ] }