2.0.7 • Published 5 years ago

go-cmf v2.0.7

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

CMF Commit Message Formatter - V2

CMF is a simple to use utility to standarize commit messages on projects.

Getting started

Install via npm, just do $ npm install -g go-cmf

Or from Go go install github.com/walmartdigital/commit-message-formatter

Once installed, go to your project an run $ cmf init and select one of the flows, it will create a .cmf.yamlfile on your project with your selected flow.

Flows

CMF have three flows (for now) default, Jira and custom

Default

Running $ cmf init and select default, you will get the default flow and prompted for:

- Type of change you made to your code
- Module affected by this change
- Commit message or description of your change

Jira

Running $ cmf init and select Jira, you will get the jira flow, this time you will be prompt for:

- Jira task ID
- Type of change you made to your code
- Commit message or description of your change

Custom

Running $ cmf initand select custom, you will get the custom flow, this time it will create a .cmf.yamlfile with default flow but with annotations of how change it.


Variables

CMF have inner variables and you can access it throw templates using {{}}:

  • {{BRANCH_NAME}} it will print the current branch name of your repository

Configurations

It is possible to config CMF as you like, you can change custom flows, templates or assign default flows. You can do this using a local file on the root of your porject or setting as global preferences with a file on your Home directory called .cmf.yaml.

TEMPLATE

Set a template string for commit messages.

Default flow

Default template {{CHANGE}}({{MODULE}}): {{MESSAGE}}. You can use this variables:

  • CHANGE type of change: feature, fix, update
  • MODULE module affected
  • MESSAGE commit message
TEMPLATE: "{{CHANGE}}({{MODULE}}): {{MESSAGE}}"

Jira flow

Default template {{JIRA-TASK}} ({{CHANGE}}): {{MESSAGE}}. You can use this variables:

  • JIRATASK _jira task id, by default {{BRANCH_NAME}}
  • CHANGE type of change: feature, fix, update
  • MESSAGE commit message
TEMPLATE: "{{JIRA-TASK}} ({{CHANGE}}): {{MESSAGE}}"

PROMPT

You can create your custom flows using this configuration attribute.

Prompt accept two types of prompts:

  • Single question:
    • KEY variable name
    • LABEL prompt title
  • Select:
    • KEY variable name
    • LABEL prompt title
    • OPTIONS list of options
      • VALUE variable value
      • DESC variable description

default .cmf.yaml sample file

PROMPT:
  - KEY: "CHANGE"
    LABEL: "Select the type of change:"
    OPTIONS:
      - VALUE: "feature"
        DESC: "A new feature"
      - VALUE: "fix"
        DESC: "A Bug fix"
      - VALUE: "update"
        DESC: "An update code change (moving or split code)"
      - VALUE: "docs"
        DESC: "Documentation only changes"
      - VALUE: "style"
        DESC: "Small changes of code style"
      - VALUE: "test"
        DESC: "Add, change or update test code"
  - KEY: "MODULE"
    LABEL: "Affected module:"
  - KEY: "MESSAGE"
    LABEL: "Commit message:"
TEMPLATE: "{{CHANGE}}({{MODULE}}): {{MESSAGE}}"

Contributions

Use GitHub issues for requests.

I actively welcome pull requests; learn how to contribute.


License

CMF is available under the MIT License.

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.22

6 years ago

1.0.20

6 years ago

1.0.18

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago