Jelajahi Sumber

feat: add gitlint dependency

MikeWallaceDev 2 tahun lalu
induk
melakukan
f993e1d076

+ 8 - 1
.githooks/commit-msg

@@ -16,7 +16,14 @@ test "" = "$(grep '^Signed-off-by: ' "$1" |
 	exit 1
 }
 
-npx --no -- commitlint --edit $1
+.githooks/gitlint \
+	 --msg-file=$1 \
+	 --subject-regex="^([bB]uild|[cC]hore|[cC]i|[dD]ocs|[fF]eat|[fF]eature|[fF]ix|[pP]erf|[rR]efactor|[rR]evert|[sS]tyle|[tT]est)(.*)?\s?:\s?.*" \
+    --subject-maxlen=100 \
+    --subject-minlen=10 \
+    --body-regex=".*" \
+    --body-maxlen=200 \
+    --max-parents=1
 
 if [ $? -ne 0 ]
 then

+ 3 - 0
.gitignore

@@ -32,3 +32,6 @@ frontend/.vscode/*
 # Commit the highest level pubspec.lock, but ignore the others
 pubspec.lock
 !frontend/app_flowy/pubspec.lock
+
+# ignore tool used for commit linting
+.githooks/gitlint

+ 10 - 2
frontend/scripts/install_dev_env/install_linux.sh

@@ -50,6 +50,13 @@ flutter doctor
 printMessage "Setting up githooks."
 git config core.hooksPath .githooks
 
+# Install go-gitlint 
+printMessage "Installing go-gitlint."
+GOLINT_FILENAME="go-gitlint_1.1.0_linux_x86_64.tar.gz"
+wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
+tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint 
+rm ${GOLINT_FILENAME}
+
 # Change to the frontend directory
 cd frontend
 
@@ -62,8 +69,9 @@ printMessage "Installing duckscript."
 cargo install --force duckscript_cli
 
 # Install CommitLint
-printMessage "Installing CommitLint."
-npm install @commitlint/cli @commitlint/config-conventional --save-dev
+printMessage "Installing go-gitlint."
+wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/go-gitlint_1.1.0_linux_x86_64.tar.gz
+tar -xf go-gitlint_1.1.0_linux_x86_64.tar.gz - C
 
 # Check prerequisites
 printMessage "Checking prerequisites."

+ 7 - 4
frontend/scripts/install_dev_env/install_macos.sh

@@ -50,6 +50,13 @@ flutter doctor
 printMessage "Setting up githooks."
 git config core.hooksPath .githooks
 
+# Install go-gitlint 
+printMessage "Installing go-gitlint."
+GOLINT_FILENAME="go-gitlint_1.1.0_osx_x86_64.tar.gz"
+wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
+tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint 
+rm ${GOLINT_FILENAME}
+
 # Change to the frontend directory
 cd frontend
 
@@ -61,10 +68,6 @@ cargo install --force cargo-make
 printMessage "Installing duckscript."
 cargo install --force duckscript_cli
 
-# Install CommitLint
-printMessagae "Installing CommitLint."
-npm install @commitlint/cli @commitlint/config-conventional --save-dev
-
 # Check prerequisites
 printMessage "Checking prerequisites."
 cargo make flowy_dev