Context
SSD uses Conventional Commits as the commit message standard and Semantic Versioning for versioning, using release-it to manage releases automatically.
Commit Message Format
<type>[optional scope]: <description>
[optional body]
[optional footer]
Type
| Type | Used when |
|---|---|
feat |
Add a new feature |
fix |
Fix a bug |
docs |
Edit documentation |
style |
Changes that do not affect logic (color, position) |
refactor |
Change code structure without changing function |
perf |
Improve performance |
test |
Add or edit tests |
build |
Change build system or config |
ci |
Change CI configuration |
chore |
Work not related to code or tests |
revert |
Revert changes |
Scope
Specify the changed part in parentheses (optional)
| Scope | Meaning |
|---|---|
(service) |
Change service layer |
(controller) |
Change controller |
(model) |
Change model/entity |
(redux) |
Change redux slice |
(api) |
Change api client |
(merge) |
merge code |
(release) |
release version |
(config) |
Change configuration |
(deps) |
Change dependencies/packages |
Breaking Change
If there is a change everyone must know about (adding required config, changing API signature):
- Add
!before:such asfeat!:orfeat(api)!: - or add
BREAKING CHANGE: คำอธิบายin the footer
Commit Message Writing Rules
- Must always start with type
feat— use only when adding a new featurefix— use only when fixing a bug- description must come immediately after type:scope
- description no more than 50 words in Thai or English (English uses imperative form, no subject)
- body can be added, with 1 blank line after the description
- footer for reference such as
fixes #13, #5leave 1 blank line
Commit Message Examples
General
chore: initial project
docs: clean up code
docs: update README.md
chore(merge): pull request #1
chore(release): v1.0.1
chore(config): update appsetting.json
chore(deps): update restsharp version to 109.0.5
perf: improve performance of order service
test: add test for order service
Backend
feat: add new feature (api-1)
feat(service): add order service
feat(controller): add order controller
feat(model): add order table
fix: fix bug in order service
refactor: change folder structure
refactor: change order status to enum
Frontend
feat: add new feature (ui-1)
feat(redux): add new auth slice
feat(api): add new api client
fix: fix bug in login page
style: change color of button
Breaking Change
feat(api)!: change response format of order endpoint
BREAKING CHANGE: Response now returns array instead of object.
Update all frontend clients to handle the new format.
Semantic Versioning
Format: MAJOR.MINOR.PATCH
| Part | Add when | Example |
|---|---|---|
| MAJOR | Breaking change — old code no longer works | 1.0.0 → 2.0.0 |
| MINOR | add a new feature (backward compatible) | 1.0.0 → 1.1.0 |
| PATCH | fix a bug (backward compatible) | 1.0.0 → 1.0.1 |
Example:
1.0.0— first version1.1.0— add feature1.1.1— fix bug2.0.0— a change that makes old code no longer work
Release-it
Installation
npm install -g @release-it/conventional-changelog@8.0.1 release-it@17.3.0
Conditions of use
- Repository must contain only 1 program per 1 Repository
- Git on the machine must already be connected to SiamSmileDev's GitHub
- If there is more than 1 program, notify the team lead to separate the Repository
Configuration
- Edit
package.jsontoversionto match the current version - Download and place the file
.release-it.jsonat the root folder - commit:
build: add release-it
Usage
# 1. Switch ไป develop branch ก่อน
git checkout develop
# 2. รัน release-it
release-it
# 3. เลือก version type: major / minor / patch
# 4. ตอบคำถาม:
# Commit? Yes
# Tag? Yes
# Push? Yes
# Create a release on GitHub? Yes