Détail du package

changelogx

royriojas290MIT5.0.6

Yet another changelog generator from git commits, based on conventions and with an optional hook to enforce the rules

changelog, git, changes, history

readme

NPM Version Build Status

changelogx

Yet another changelog generator from git commits, based on conventions and with an optional hook to enforce the rules

Install

npm i -g changelogx

add to your package.json a section like this:

{
  "changelogx": {
    // the text is passed to new RegExp with the flags gi.
    // if a commit matches any of the passed strings it will not be added to the final changelog
    "ignoreRegExp": ["DOC: add changelog", "generated changelog", "BLD: Release"],
    "issueIDRegExp" : "#(\\d+)", // regular expression to match issues found inside the changelog
    "commitURL": "https://github.com/royriojas/changelogx/commit/{0}", //the url for commits
    "authorURL": "https://github.com/{0}", //the url for the authors
    "issueIDURL": "https://github.com/royriojas/changelogx/issues/{0}", //the url for the issues
    "projectName": "changelogx" // the name of the project
  }
}

If no configuration file is provided or no changelogx configuration is found in the package.json, then The script will try to infer the settings assuming the module is hosted in github. Please verify the inferred configuration to verify is valid or provide your own configuration

Usage

Usage: changelogx [install-hook] [options]

Options:
  -f, --format One of: html, markdown  Use a specific output format, markdown or html. - default: html
  -p, --tagPrefix String               The tag prefix to filter the tags obtained from git.
  -r, --tagRange String                Filter the commits to only the ones between the given tag range
  -o, --outputFile path::String        Specify file to write the changelog to. If omitted the output will be printed to the stdout. IF this option is set no
                                       other logs will print to stdout (-q is implicit here)
  -m, --maxSubjectLength Number        If the command install-hook is used, this option allows to specify the maximum length for the commit subject -
                                       default: 140
  -i, --ignoreRegExp [String]          A regular expression to match for commits that should be ignored from the changelog
  -h, --help                           Show this help
  -v, --version                        Outputs the version number
  -q, --quiet                          Show only the summary info
  -c, --config String                  Path to your `changelogx` config. By Default will look for a `changelogx` section on your `package.json`

When no configuration is provided, some defaults based on your `package.json` file will be used. For Example:

"changelogx": {
  "ignoreRegExp": ["BLD: Release", "DOC: Generate Changelog", "Generated Changelog"],
  "issueIDRegExp" : "#(\\d+)",
  "commitURL": "https://github.com/$user$/changelogx/commit/{0}",
  "authorURL": "https://github.com/{0}",
  "issueIDURL": "https://github.com/$user$/changelogx/issues/{0}",
  "projectName": "changelogx"
}

Examples

  • Generate an html changelog

    # this will create a changelog.html file
    changelogx -o changelog.html
    
  • Generate a markdown changelog

    # this will create a markdown changelog
    changelog -f markdown -o changelog.md
    
  • Generate the changelog to stdout

    # this will create a markdown changelog and print it to stdout
    changelog -f markdown
    
  • Get a changelog between 2 tags

    # this will create a markdown changelog from v0.1.0 to v2.0.0 and print it to stdout
    changelog -f markdown --tagRange=v0.1.0..v2.0.0
    
  • Only use certain type of tags

    # this will create a markdown changelog from v0.1.0 to v2.0.0 and print it to stdout ignoring other tags that don't start with `v`
    changelog -f markdown --tagRange=v0.1.0..v2.0.0 --tagPrefix=v
    
  • Exclude certain commits

    # this will exclude all the commits that contain the passed text. the -i option is an array
    # so if passed several times it will populate the array
    changelog -i "DOC: Generate Changelog" -i "BLD: Release" -f markdown -o ./changelog.md
    

Bonus

Install commit-msg hook, in order to enforce the conventions to follow in order to generate this changelog.

# install the commit-msg hook setting the maximum subject line length to 160 characters
changelog install-hook -m 160

This will enforce the commits to follow the following structure:

  {TAG}:({FEATURE}) {SHORT_DESCRIPTION} {ISSUE_ID}

  {LONG_DESCRIPTION}

Where:

  • TAG, Any of the following :

    • BLD: change related to build scripts
    • FIX: bugfixes, hotfixes.
    • BUG: alias for bugfixes, hotfixes.
    • DOC: documentation
    • FEAT: features new features
    • ENH: Performance enhancements, not captured in features
    • REF: maintenance commit (refactoring, etc.)
    • STY: style fix (whitespaces, typos)
    • TST: addition or modification of tests
  • FEATURE. Useful to identify commits related to a given feature. Optional.

  • SHORT_DESCRIPTION. A very short description for the commit
  • ISSUE_ID (Optional). Provide one if you have it example, see: #40, #30
  • LONG_DESCRIPTION (Optional). A longer description of the commit. You can use markdown to provide some nice formatting on the body as well. Also if you add here reference to issues they will be linked as well

Important: Messages starting with Revert or Merge will be considered valid, as they usually are created by git itself automatically.

Example:

$ git commit
FIX: (Build Issues) Fix Travis Build, This fix #20 and #25

Fix bug on build while installing

In one line

$ git commit -m "FIX: (Build Issues) Fix Travis Build. This fix #20 and #25"

If a commit does not follow this structure, the commit will be stopped

Changelog

changelog

changelogx - Changelog

v5.0.6

  • Bug Fixes
    • features should also use the issueIDURL as function - d17ccbd, Roy Riojas, 27/09/2019 11:33:36

v5.0.5

  • Bug Fixes
    • Add option to process the tags before generating the log file - 315b6d2, Roy Riojas, 27/09/2019 03:22:04

v5.0.4

  • Bug Fixes
    • remove source from call to opts.issueIDURL - 484e0bd, royriojas, 12/07/2019 14:55:33

v5.0.3

  • Bug Fixes
    • issueIDURL throws when used as a function - 02e797a, royriojas, 12/07/2019 14:45:31

v5.0.2

  • Bug Fixes
    • make issueIDURL to accept a function to handle more complex cases - 1522403, royriojas, 12/07/2019 14:37:54

v5.0.1

  • Bug Fixes
    • Remove snyk as it is not needed as deps were updated - ea96fd7, Roy Riojas, 11/07/2019 16:32:18

v5.0.0

The following vulnerabilities are fixed with a Snyk patch:
- https://snyk.io/vuln/SNYK-JS-LODASH-450202

v4.0.0

  • Refactoring

    • Changelog improvements - c8b95d4, royriojas, 09/07/2019 01:21:07

      Add the ability to specify custom tags using a config file

v3.0.0

  • Refactoring
    • use git tag --list to obtain the list of tags - b8cb797, Roy Riojas, 15/09/2018 13:15:41

v2.0.0

  • Refactoring
    • Ugrapde read-file dependency to remove outdated graceful-fs dep - 0febb4a, Roy Riojas, 19/07/2016 02:03:56

v1.0.19

  • Bug Fixes

v1.0.18

  • Build Scripts Changes
    • update clix dep to get nicer log output - c840b41, royriojas, 11/08/2015 19:34:16

v1.0.17

  • Build Scripts Changes

v1.0.16

  • Bug Fixes

v1.0.15

  • Refactoring
  • Build Scripts Changes

    • Update deps and remove unused files - 1e71bf3, royriojas, 13/07/2015 01:25:44

      Add npm script command do-changelog to automate the generation/commit of the changelog.

commit-msg hook

  • Bug Fixes

    • Fix #6. - 989068b, royriojas, 13/07/2015 01:19:35

      Commit messages now can contain : characters in the subject.

v1.0.14

  • Documentation

v1.0.13

v1.0.12

  • Features

    • Add an option to ignore certain commits from the final changelog. Fixes #3 - 0d2000f, royriojas, 18/05/2015 03:55:04

      • from the config section
        "changelogx": {
          "ignoreRegExp": ["BLD: Release", "DOC: Generate Changelog", "Generated Changelog"],
          "issueIDRegExp" : "#(\\d+)",
          "commitURL": "https://github.com/$user$/changelogx/commit/{0}",
          "authorURL": "https://github.com/{0}",
          "issueIDURL": "https://github.com/$user$/changelogx/issues/{0}",
          "projectName": "changelogx"
        }
        
      • from the command line (overrides config option)
        # this will exclude all the commits that contain the passed text. the -i option is an array
        # so if passed several times it will populate the array
        changelog -i "DOC: Generate Changelog" -i "BLD: Release" -f markdown -o ./changelog.md
        
    • Do not complain about automatic messages generated by git for merge and revert. Fixes #5 - 37ced06, royriojas, 17/05/2015 14:28:58

v1.0.11

markdown formatter

  • Bug Fixes

v1.0.10

  • Refactoring

    • Improve log messages - ecf1132, Roy Riojas, 21/03/2015 04:36:32

      Keep consistent use of the affordances

v1.0.8

configuration

  • Features

    • infer the configuration if not changelogx section found in package.json or in a custom config file. Fix #1 - 5cb6142, Roy Riojas, 21/03/2015 04:29:46

      This is the configuration that will be used in case no changelogx section found

      'changelogx': {
        'issueIDRegExp': '#(\\d+)',
        'commitURL': '[REPO_URL]/commit/{0}',
        'authorURL': 'https://github.com/{0}',
        'issueIDURL': '[REPO_URL]/issues/{0}',
        'projectName': [PKG_NAME]
      }
      
  • Other changes

v1.0.7

changelog

  • Build Scripts Changes

v1.0.6

options

  • Documentation

v1.0.5

formatters

  • Enhancements
    • Remove Uncategorized section from the features - bf549da, Roy Riojas, 16/03/2015 19:11:28
  • Add proper indentation level for log body - 6069390, Roy Riojas, 16/03/2015 18:33:28
  • Features

    • markdown formatter added - 5c86637, Roy Riojas, 16/03/2015 18:27:54

      Now it is possible to render a mardown version of the changelogx using

      changelogx -f markdown > changelog.md
      

      It is also possible to do:

      changelogx -f markdown -outputFile=./changelog.md
      

v1.0.4

formatters

  • Enhancements

v1.0.3

formatters

  • Features

    • only print output messages in case of outputFile option especified - c5e749c, Roy Riojas, 16/03/2015 16:20:43

      • When the option outputFile is ommited, then only the output of the formatter will be directed to the standard output. is like the option --quiet, -q is implicit

v1.0.2

formatters

  • Refactoring

v1.0.1

  • Refactoring
    • Change color of good commit confirmation - 96d4516, Roy Riojas, 16/03/2015 04:11:29
  • Tests Related fixes