Skip to content
This repository was archived by the owner on Mar 1, 2021. It is now read-only.

Commit 762258d

Browse files
committed
RAGC-38 - Add and configure Commitlint
1 parent 76b474f commit 762258d

File tree

6 files changed

+1297
-23
lines changed

6 files changed

+1297
-23
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
###> ide
66
/.idea
77
/.DS_Store
8-
###< ide
8+
###< ide
9+
10+
###> Dependency directories
11+
node_modules/
12+
###< Dependency directories

README.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
## Quick startup
22

3+
4+
### Commitlint configuration:
5+
6+
Install Node.js on your machine [Node via package manager](https://nodejs.org/en/download/package-manager/)
7+
8+
After that in root directory run command in terminal ```npm install``` to install dependencies.
9+
10+
Your commit message should contain PREFIX: FRDQ, ID as a number, and SUBJECT.
11+
Example: ```"RAGC-21 - Your commit message"```
12+
13+
14+
315
### For docker (linux)
416

517
Allows you to quick setup development environment
@@ -11,34 +23,34 @@ Allows you to quick setup development environment
1123
###> docker/dev ###
1224
# Set a port where the app should be served on your localhost
1325
APP_PORT=8080
14-
26+
1527
# Set a port where the database should be served on your localhost
1628
DB_PORT=3310
1729
###< docker/dev ###
18-
30+
1931
###> docker/mysql ###
2032
# Set the database user name
2133
MYSQL_USER=user
22-
34+
2335
# Set the database name
2436
MYSQL_DATABASE=database
25-
37+
2638
# Set the database user password
2739
MYSQL_PASSWORD=pass
28-
40+
2941
# Set the database password for the CLI usage
3042
MYSQL_ROOT_PASSWORD=pass
31-
43+
3244
# It should be untouched if its running in docker
3345
MYSQL_HOST=database:3306
3446
###< docker/mysql ###
3547
```
36-
48+
3749
- Build images using
3850
```
3951
docker-compose -f docker-compose.yml -f docker-compose.development.yml build
4052
```
41-
53+
4254
- Download dependencies using
4355
```
4456
docker-compose -f docker-compose.yml -f docker-compose.development.yml run --no-deps api /bin/bash -c "composer install"
@@ -55,12 +67,12 @@ Allows you to quick setup development environment
5567
```
5668
docker-compose exec api /bin/bash
5769
```
58-
70+
5971
- If it's not running (without database access)
6072
```
6173
docker-compose -f docker-compose.yml -f docker-compose.development.yml run --no-deps api /bin/bash
6274
```
63-
75+
6476
> If you want to stop the server, type
6577
`docker-compose stop` on your host machine.
6678

commitlint.config.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const PREFIX = 'RAGC';
2+
3+
const customParser = {
4+
parserOpts: {
5+
headerPattern: /^(\w+)-(\d+) - (.*)$/,
6+
headerCorrespondence: ['type', 'id', 'subject'],
7+
},
8+
};
9+
10+
module.exports = {
11+
parserPreset: customParser,
12+
rules: {
13+
'type-enum': [2, 'always', [`${PREFIX}`]],
14+
'commit-message-rule': [2, 'always'],
15+
'subject-empty': [2, 'never'],
16+
'subject-case': [2, 'always', 'sentence-case'],
17+
},
18+
plugins: [
19+
{
20+
rules: {
21+
'commit-message-rule': ({ type, id }) => {
22+
const ID = parseInt(id, 10);
23+
24+
return [
25+
!isNaN(ID) && type.includes(`${PREFIX}`),
26+
`\x1b[31m Your commit message should contain PREFIX: ${PREFIX}, ID as a number, and SUBJECT. \r\n Example:\x1b[34m "${PREFIX}-21 - Your commit message" \x1b[0m \x1b[0m`,
27+
];
28+
},
29+
},
30+
},
31+
],
32+
};

node_modules/.yarn-integrity

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)