From c19c0befe9c72bcbfb3343f8c5f6e465cf56d9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?France=20B=C3=A9rut?= Date: Tue, 18 Jun 2024 13:13:05 +0200 Subject: [PATCH 1/2] chore(husky): add commit name rule --- .gitignore | 3 +++ commitlint.config.js | 1 + package.json | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 commitlint.config.js diff --git a/.gitignore b/.gitignore index 0e0a9ecc..f2faa5e1 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,6 @@ metadata/ /.editorconfig package-lock.json + +# coverage report + coverage/ diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 00000000..422b1944 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +module.exports = { extends: ['@commitlint/config-conventional'] }; diff --git a/package.json b/package.json index 63b6e298..ddaf6142 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,11 @@ "license": "ISC", "homepage": "https://github.com/alma/sfcc-plugin", "devDependencies": { + "@commitlint/config-conventional": "^13.2.0", "@types/chai": "^4.3.5", "chai": "^3.5.0", "chai-subset": "^1.6.0", + "commitlint": "^13.2.1", "del": "^6.1.1", "dotenv": "^16.0.2", "dw": "^1.0.1", @@ -41,7 +43,7 @@ "eslint-plugin-sitegenesis": "~1.0.0", "gulp": "^4.0.2", "gulp-zip": "^5.1.0", - "husky": "^4.2.5", + "husky": "^4.3.8", "isml-linter": "^5.40.3", "istanbul": "^0.4.5", "mocha": "^5.2.0", @@ -81,7 +83,8 @@ "husky": { "hooks": { "pre-commit": "npm run lint", - "pre-push": "npm run lint" + "pre-push": "npm run lint", + "commit-msg": "npx --no -- commitlint --edit ''" } } } From a71991abd8bf378d3853dccc6d7e72c5959741af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?France=20B=C3=A9rut?= Date: Tue, 18 Jun 2024 17:01:41 +0200 Subject: [PATCH 2/2] chore(precommit): add commit name rule --- .pre-commit-config.yaml | 8 +++++++- cz.yaml | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 cz.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 19a6018a..ed3c1edb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,12 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: + - repo: https://github.com/commitizen-tools/commitizen + rev: v3.27.0 + hooks: + - id: commitizen + name: Check commit message format + stages: [ commit-msg ] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: @@ -37,7 +43,7 @@ repos: - prettier@2.8.8 - stylelint-config-standard@32.0.0 - stylelint-prettier@3.0.0 - + # - repo: https://github.com/returntocorp/semgrep # rev: v1.27.0 # hooks: diff --git a/cz.yaml b/cz.yaml new file mode 100644 index 00000000..76939275 --- /dev/null +++ b/cz.yaml @@ -0,0 +1,7 @@ +--- +commitizen: + name: cz_conventional_commits + tag_format: v$version + update_changelog_on_bump: true + version: 4.5.1 + version_scheme: semver