Never Push Mistakes

    changelog-light

    0.3.0 • Public • Published

    Changelog Light

    Build Status codecov License

    Generate a changelog with conventional commit types.

    Requirements

    The basic requirements:

    Use

    CLI

    NPM install...

      $ npm i changelog-light

    or Yarn

      $ yarn add changelog-light

    CLI Usage

      $ changelog --help
      Generate a CHANGELOG.md with conventional commit types.
    
      Usage: changelog [options]
    
      Options:
        -b, --basic            Keep updates to [CHANGELOG.md] basic, skip all markdown
                               link syntax                  [boolean] [default: false]
        -c, --commit           Commit [CHANGELOG.md] and package.json with a release
                               commit                        [boolean] [default: true]
        -d, --date             [CHANGELOG.md] release date in the form of a valid date
                               string. Uses system new Date([your date])
                                        [string] [default: "2023-01-03T02:22:35.984Z"]
        -n, --non-cc           Allow non-conventional commits to apply a semver weight
                               and appear in [CHANGELOG.md] under a general type
                               description.                 [boolean] [default: false]
        -o, --override         Use a version you define.                      [string]
        -r, --dry-run          Generate [CHANGELOG.md] sample output
                                                            [boolean] [default: false]
            --changelog        Changelog output filename and relative path
                                                  [string] [default: "./CHANGELOG.md"]
            --commit-path      [CHANGELOG.md] path used for commits. This will be
                               "joined" with "remote-url". Defaults to the commits
                               path for GitHub.          [string] [default: "commit/"]
            --compare-path     [CHANGELOG.md] path used for version comparison. This
                               will be "joined" with "remote-url". Defaults to the
                               comparison path for GitHub.
                                                        [string] [default: "compare/"]
            --package          package.json read, output and relative path
                                                  [string] [default: "./package.json"]
            --pr-path          [CHANGELOG.md] path used for PRs/MRs. This will be
                               "joined" with "remote-url". Defaults to the PR path for
                               GitHub.                     [string] [default: "pull/"]
            --release-message  A list of prefix release scope commit messages. First
                               list item is the new commit message prefix, the second
                               list item searches for the prior release message prefix
                               for range. [write new, search old]
                                                   [array] [default: "chore(release)"]
            --remote-url       Git remote get-url for updating [CHANGELOG.md] base
                               urls. This should start with "http". Defaults to "$ git
                               remote get-url origin"                         [string]
        -h, --help             Show help                                     [boolean]
        -v, --version          Show version number                           [boolean]
    

    Using within a project

    Using changelog-light within a project requires one primary thing... formatting your commit messages using conventional commit types

    This project leverages this conventional commit types resource to determine how CHANGELOG.md is generated.

    How it works

    changelog-light doesn't use tags. Focusing on tags to determine what gets generated works in some environments.

    Since handling tags was unnecessary for our purpose, we kept it simple. Instead, changelog-light looks for the last commit message, of a specific type, to determine the range of commits...

    chore(release): [semver version format]
    

    Example NPM script

    Using within a project you could apply changelog-light as a NPM script in package.json

    "scripts": {
      "release": "changelog"
    }

    How to use

    Assuming you're using GitHub as your base. If you're not using GitHub we do expose the url paths used to generate the log.

    1. First, git checkout the branch you want to run changelog-light on

    2. Next, run the CLI, either directly, or through a NPM script like the above example.

      $ changelog --dry-run --non-cc
      

      We recommend you try the --dry-run and --non-cc options for your first run.

    3. Review the output, you have a few choices

      • in your terminal only, see option --dry-run
      • or as a commit with a CHANGELOG.md and package.json update. This is the default option --commit
      • or as updated files CHANGELOG.md and package.json, if you opted to update without a commit, see option --commit=false
    4. That's it!

    Credit

    This project is influenced by the now deprecated project Standard Version.

    The primary differences between Standard Version and this project are the weighting assigned to commit message types and a fraction of the features.

    Contributing

    Contributing? Guidelines can be found here CONTRIBUTING.md.

    Install

    npm i changelog-light

    DownloadsWeekly Downloads

    54

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    41.5 kB

    Total Files

    10

    Last publish

    Collaborators

    • cdcabrera