From cce002e361036c7830d734b35cb1bcf16a7bdc55 Mon Sep 17 00:00:00 2001 From: nobkd <44443899+nobkd@users.noreply.github.com> Date: Sun, 16 Apr 2023 20:11:08 +0200 Subject: [PATCH] chore: add back conventinal commits check --- .husky/post-commit | 1 + .husky/prepare-commit-msg | 27 ++++++++++++++------------- package-lock.json | 4 ++-- package.json | 2 +- public/manifest.json | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.husky/post-commit b/.husky/post-commit index 47c5a78..e8e9e6c 100755 --- a/.husky/post-commit +++ b/.husky/post-commit @@ -1,4 +1,5 @@ #!/bin/bash + flag_file_path='.version-update' if [ -f $flag_file_path ]; then diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg index 4e4b88e..bf2b379 100755 --- a/.husky/prepare-commit-msg +++ b/.husky/prepare-commit-msg @@ -8,17 +8,19 @@ if [ -f $flag_file_path ]; then exit 0 fi -if [ ! $(git branch --show-current) = 'main' ]; then +if [ $(git branch --show-current) != 'main' ]; then exit 0 fi # types -commit_types='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)' -minor_types='^(build|feat|revert)' -patch_types='^(chore|fix|perf|refactor)' - parens='(\(\w+\))?' msg=':\s.+' +opt_exclam='!?' +exclam='!' + +commit_types='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)'$parens +minor_types='^(build|feat|revert)'$parens$msg +patch_types='^(chore|fix|perf|refactor)'$parens$msg version_match='"version": *"[0-9.]\+"' version_str='"version": ' @@ -26,11 +28,10 @@ version_str='"version": ' # read message to var commit_msg=$(cat $1) -# TODO: fix this, as it does not work... -#if [[ $commit_msg =~ $commit_types$parens'!?'$msg ]]; then -# echo 'Use Conventional Commits: https://conventionalcommits.org' -# exit 1 -#fi +if ! [[ $commit_msg =~ $commit_types$opt_exclam$msg ]]; then + echo 'Use Conventional Commits: https://conventionalcommits.org' + exit 1 +fi # bump version function bumpVersion() { @@ -42,13 +43,13 @@ bumpVersion() { } # version change type -if [[ $commit_msg =~ $commit_types$parens'!'$msg ]]; then +if [[ $commit_msg =~ $commit_types$exclam$msg ]]; then bumpVersion major else - if [[ $commit_msg =~ $minor_types$parens$msg ]]; then + if [[ $commit_msg =~ $minor_types ]]; then bumpVersion minor else - if [[ $commit_msg =~ $patch_types$parens$msg ]]; then + if [[ $commit_msg =~ $patch_types ]]; then bumpVersion patch fi fi diff --git a/package-lock.json b/package-lock.json index 4c27b1e..767db1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "replace-maps", - "version": "1.1.3", + "version": "1.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "replace-maps", - "version": "1.1.3", + "version": "1.1.4", "hasInstallScript": true, "license": "Unlicense", "dependencies": { diff --git a/package.json b/package.json index 61c7377..75bbfd2 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Replace Maps iframes with OSM", "author": "nobkd", "license": "Unlicense", - "version": "1.1.3", + "version": "1.1.4", "type": "module", "homepage": "https://github.com/nobkd/replace-maps#readme", "bugs": { diff --git a/public/manifest.json b/public/manifest.json index 7b5c460..be9a712 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -2,7 +2,7 @@ "description": "Replace Maps iframes with OSM", "manifest_version": 2, "name": "Replace Maps", - "version": "1.1.3", + "version": "1.1.4", "homepage_url": "https://github.com/nobkd/replace-maps", "icons": { "48": "icons/48.png",