Skip to content

Commit

Permalink
feat(commitlint): enable commit linting via git hooks
Browse files Browse the repository at this point in the history
Signed-off-by: Manjot Sidhu <manjot.techie@gmail.com>
  • Loading branch information
manjotsidhu authored and tachyons committed Aug 4, 2021
1 parent 7144fd8 commit 940c6ba
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .githooks/commit-msg
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
green='\e[0;32m'
red='\033[0;31m'
nocol='\033[0m'

echo -e "${green}CV: Running Commit lint${nocol}"
npx --no-install commitlint --edit "$1"

if [ $? -ne 0 ]; then
echo -e "${red}CV: Commit lint failed. Please fix the errors and run the command again${nocol}"
exit 1
fi

exit 0
23 changes: 18 additions & 5 deletions README.md
Expand Up @@ -13,16 +13,29 @@ Follow these instructions to build and run the project

A detailed guide for multiple platforms setup could be find [here](https://flutter.dev/docs/get-started/install/)

### Next Steps
### Setup Project

- Clone this repository.
- Clone this repository using `git clone https://github.com/CircuitVerse/mobile-app.git`.
- `cd` into `mobile_app`.
- `flutter pub get` to get all the dependencies.
- `flutter run`
- Generate files using Builder Runner (**required**)
```
flutter packages pub run --no-sound-null-safety build_runner build
```
- Switch to mobile-app's git hooks (**optional but recommended**)
```
git config core.hooksPath .githooks/
# Make sure npm is installed to run the next command
npm install -g @commitlint/config-conventional @commitlint/cli
```
> Mobile App enforces [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/), make sure to read and follow them.
### Running the app

### Generating Files using Build Runner
Make sure you have a connected Android/iOS device/simulator and run the following command to build and run the app in debug mode.

`flutter packages pub run --no-sound-null-safety build_runner build`
`flutter run`

### Android OAuth Config

Expand Down
1 change: 1 addition & 0 deletions commitlint.config.js
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] }

0 comments on commit 940c6ba

Please sign in to comment.