Skip to content

Commit

Permalink
[commit] Add more general scopes for scope examples (#64)
Browse files Browse the repository at this point in the history
* ♻️ More general default scope examples - for dev

- will be removed when release

* 📝 Extract out configuration guide to docs

- make reame light

* 📝 Add more configuration examples
  • Loading branch information
ninthsun91 committed Aug 18, 2023
1 parent c2e7146 commit 1cd575e
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 76 deletions.
66 changes: 1 addition & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,71 +34,7 @@ TODO: use example GIF

## Configuration
---
You can configure your own commit headers by creating `.gitoverc.json`.

### KeywordConfig

You can set your own message setting by providing `KeywordConfig` to configuration file. `KeywordConfig` looks like below.

```javascript
{
// the actual message you want it for commit header
"name": "feat:",

// an alias to see on header list in cli
"alias": "feat",

// a description to see on header list in cli
"description": "Add new feature."
}
```

The structure of your own config file, `.gitoverc.json` using `KeywordConfig` looks like below.

```javascript
{
// change default setting of commit "type" header
// 'string' will use type header like 'feat', 'fix'...
// 'emoji' will use type header in emoji
"default": "string"|"emoji",

// custom headers for commit "type" header
// by setting below, it overwrites default headers
"type": KeywordConfig[],

// custom headers for commit "scope" header
// 'scope' refers to the scope of the commit's work, which can be a domain like 'user', 'post' or a format like 'commit', 'config'
// customize it to fit your team's conventions
"scope": KeywordConfig[],

// custom keywords for auto replacements
// You can save aliases for frequently used words.
// For example, if you alias 'bc' for the long word 'broadcast_category' and write '{bc}' the actual commit message will be written as 'broadcast_category'
"replace": KeywordConfig[]
}
```

### example

```json
{
"type": [{
"name": "feat",
"alias": "feat",
"descriiption": "Add or imporve feature"
}],
"scope": [{
"name": "article",
"alias": "article",
"description": "the article that user writes"
}],
"replace": [{
"name": "broadcast_category",
"alias": "bc",
"description": "categories for broadcast"
}]
}
```
You can configure your own commit headers by creating `.gitoverc.json`. Checkout our [Configuration Guide](./docs/CONFIGURATION_GUIDE.md) for detils.

## Contributing to Gitove
If you want to take part in `gitove`, read the [contribution guide](./docs/CONTRIBUTING.md).
Expand Down
176 changes: 176 additions & 0 deletions docs/CONFIGURATION_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
## Configuration Guide

### KeywordConfig

You can set your own message setting by providing `KeywordConfig` to configuration file. `KeywordConfig` looks like below.

```javascript
{
// the actual message you want it for commit header
"name": "feat:",

// an alias to see on header list in cli
"alias": "feat",

// a description to see on header list in cli
"description": "Add new feature."
}
```

The structure of your own config file, `.gitoverc.json` using `KeywordConfig` looks like below.

```javascript
{
// change default setting of commit "type" header
// 'string' will use type header like 'feat', 'fix'...
// 'emoji' will use type header in emoji
"default": "string"|"emoji",

// custom headers for commit "type" header
// by setting below, it overwrites default headers
"type": KeywordConfig[],

// custom headers for commit "scope" header
// 'scope' refers to the scope of the commit's work, which can be a domain like 'user', 'post' or a format like 'commit', 'config'
// customize it to fit your team's conventions
"scope": KeywordConfig[],

// custom keywords for auto replacements
// You can save aliases for frequently used words.
// For example, if you alias 'bc' for the long word 'broadcast_category' and write '{bc}' the actual commit message will be written as 'broadcast_category'
"replace": KeywordConfig[]
}
```

### example

```json
{
"type": [
{
"name": "feat",
"alias": "feat",
"description": "Add new feature.",
},
{
"name": "fix",
"alias": "fix",
"description": "Fix a bug.",
},
{
"name": "refact",
"alias": "refact",
"description": "Refactor code. No business logic change.",
},
{
"name": "design",
"alias": "design",
"description": "Add or update UI style.",
},
{
"name": "style",
"alias": "style",
"description": "Update in code format, style, etc. No business logic change.",
},
{
"name": "comment",
"alias": "comment",
"description": "Add or update annotations.",
},
{
"name": "docs",
"alias": "docs",
"description": "Add or update documentation.",
},
{
"name": "test",
"alias": "test",
"description": "Add or update tests.",
},
{
"name": "chore",
"alias": "chore",
"description": "Add or update build tasks, package manager configs, etc.",
},
{
"name": "init",
"alias": "init",
"description": "Initialize project.",
},
{
"name": "rename",
"alias": "rename",
"description": "Rename file or directory.",
},
{
"name": "remove",
"alias": "remove",
"description": "Remove file or directory.",
},
{
"name": "BREAKING CHANGE",
"alias": "break",
"description": "Significant change which is not backward compatible.",
},
],
"scope": [
{
"name": "Config",
"alias": "config",
"description": "project configuration commits.",
},
{
"name": "Auth",
"alias": "auth",
"description": "Autehntication related commits.",
},
{
"name": "DB",
"alias": "database",
"description": "Database related commits.",
},
{
"name": "User",
"alias": "user",
"description": "User related commits.",
},
{
"name": "Post",
"alias": "post",
"description": "Post related commits.",
},
{
"name": "Comment",
"alias": "comment",
"description": "Comment related commits.",
},
],
"replace": [
{
"name": "broadcast_category",
"alias": "bc",
"description": "categories for broadcast"
},
{
"name": "Hello",
"alias": "h",
"description": "Hello",
},
{
"name": "World",
"alias": "w",
"description": "Fix a bug.",
},
{
"name": ":black_cat:",
"alias": "cat",
"description": "Black cat 🐈‍⬛",
},
{
"name": "(ENV UPDATED!!)",
"alias": "env",
"description": "env updated!!",
},
]
}
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gitove",
"version": "0.2.0",
"version": "0.2.1",
"type": "module",
"description": "An interactive git cli tool for consistant commit messages.",
"license": "MIT",
Expand Down
30 changes: 20 additions & 10 deletions src/constants/scopeExamples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,31 @@ export const DEFAULT_SCOPE_EXAMPLES: CustomCommitConfig[] = [
{
name: 'Config',
alias: 'config',
description: 'Commits related to project configuration.',
description: 'project configuration commits.',
},
{
name: 'Commit',
alias: 'commit',
description: 'Commits related to commit command.',
name: 'Auth',
alias: 'auth',
description: 'Autehntication related commits.',
},
{
name: 'Rebase',
alias: 'rebase',
description: 'Commits related to rebase command.',
name: 'DB',
alias: 'database',
description: 'Database related commits.',
},
{
name: 'Push',
alias: 'push',
description: 'Commits related to push command.',
name: 'User',
alias: 'user',
description: 'User related commits.',
},
{
name: 'Post',
alias: 'post',
description: 'Post related commits.',
},
{
name: 'Comment',
alias: 'comment',
description: 'Comment related commits.',
},
];

0 comments on commit 1cd575e

Please sign in to comment.