3.10.0 • Published 2 months ago

@4s1/conventional-commit-creator v3.10.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

Conventional Commit Creator

Please don't upload to GitHub

This CLI application assists you in creating commit messages that are conform to the conventional commit style. It will ask for type, scope, description, body and issue id.

Features:

⭐ format of the commit message can be fully customized \ ⭐ different templates for your repositories based on Git remote url \ ⭐ issue id can be inserted in up to three places of a commit message

Install & usage

Install this package globally.

npm install -g @4s1/conventional-commit-creator

Inside your repository run Conventional Commit Creator.

conventional-commit-creator
# or just
ccc

Configure commit message templates

The configuration is stored in ~/.config/conventional-commit-creator/config.json.

The default template look like the following json:

{
  "$schema": "https://www.4s1.de/conventional-commit-creator/schema.json",
  "version": 1,
  "templates": [
    {
      "name": "Default",
      "regex": ".*",
      "pattern": "{type}{scope}: {description}{issue}{body}",

      "pre_type": "",
      "post_type": "",
      "pre_scope": "(",
      "post_scope": ")",
      "pre_description": "",
      "post_description": "",
      "pre_body": "\n\n",
      "post_body": "",

      "pre_issue": " (#",
      "post_issue": ")",
      "pre_issue2": "",
      "post_issue2": "",
      "pre_issue3": "",
      "post_issue3": ""
    }
  ]
}

and will create the following commit message:

--- your input --------------------------

type: chore
scope: foo
description: some description
body: Lorem ipsum dolor sit amet.
issue: 42

--- commit message result ---------------

chore(foo): some description (#42)

Lorem ipsum dolor sit amet.

The pre and post texts are only inserted if a matching middle part has also been entered.

Now let's look at another more complex variant.

We take the configuration from above, remove all empty strings (missing settings are replaced by empty strings) and add another template that should apply to all GitHub projects (see regex).

{
  "$schema": "https://www.4s1.de/conventional-commit-creator/schema.json",
  "version": 1,
  "templates": [
    {
      "name": "Default",
      "regex": ".*",
      "pattern": "{type}{scope}: {description}{issue}{body}",
      "pre_scope": "(",
      "post_scope": ")",
      "pre_body": "\n\n",
      "pre_issue": " (#",
      "post_issue": ")"
    },
    {
      "name": "GitHub Project",
      "regex": "^.*github.*$",
      "pattern": "{type}{scope}: {description}{body}{issue}{issue2}{issue3}",
      "pre_scope": "(",
      "post_scope": ")",
      "pre_body": "\n\n",
      "pre_issue": "\n\nRefs: #",
      "pre_issue2": " | [refs #",
      "post_issue2": "]",
      "pre_issue3": " | REDMINE-",
      "post_issue3": ""
    }
  ]
}

This will result in the following commit example:

--- your input --------------------------

type: refactor
scope: -
description: foobar
body: Hallo \n world
issue: 42

--- commit message result ---------------

refactor: foobar

Hallo
world

Refs: #42 | [refs #42] | REDMINE-42

or without issue id

--- your input --------------------------

type: refactor
scope: -
description: foobar
body: Hallo \n world
issue: -

--- commit message result ---------------

refactor: foobar

Hallo
world

Checking the Git remote url via regular expression is done in the order the templates were specified from top to bottom. The last hit wins.

3.10.0

2 months ago

3.9.1

2 months ago

3.9.0

2 months ago

3.9.0-rc.0

2 months ago

3.9.0-rc.1

2 months ago

3.8.0

6 months ago

3.7.0

9 months ago

3.6.0

11 months ago

3.5.0

11 months ago

3.2.0-dev.0

12 months ago

3.0.0-dev.0

1 year ago

3.0.0-dev.1

1 year ago

2.0.1

1 year ago

3.4.0

12 months ago

3.3.0

12 months ago

3.2.0

12 months ago

3.1.0

1 year ago

3.0.0

1 year ago

2.0.0

1 year ago

1.0.0

2 years ago

0.12.0

2 years ago

0.13.0

2 years ago

0.13.1

2 years ago

0.11.3

2 years ago

0.11.2

2 years ago

0.11.1

2 years ago

0.11.0

2 years ago

0.10.2

2 years ago

0.10.1

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago