Code Monkey home page Code Monkey logo

changeloger's Introduction

Changeloger

npm version npm downloads Codecov License

A fast and lightweight changelog generator using Conventional Commits.

Support several providers (GitHub, Bitbucket, GitLab, and Git) and multiple output files.

Quick Start

Generate a changelog, without bumping the version or making a git commit:

npx @trandaison/changeloger@latest --noBump --noCommit --noTag

Bump the version, update CHANGELOG.md and make a git commit and tag:

npx @trandaison/changeloger@latest

CLI usage

You can choose to install @trandaison/changeloger globally, or install it as a devDependency in your project, or use npx to run it.

npm install -g @trandaison/changeloger
npm install --save-dev @trandaison/changeloger
npx @trandaison/changeloger@latest

CLI command:

changeloger [path] [...args]

Arguments:

  • path: The path to the project directory. Default: process.cwd() (current working directory).
  • --repositoryUrl: The URL of the repository. By default, it will be read from the package.json file, or guessed from the remote git repository. If it can't be guessed, it will be null.
  • --branch: The branch name. Default is the current branch.
  • --major: Bump as a semver-major version.
  • --minor: Bump as a semver-minor version.
  • --patch: Bump as a semver-patch version.
  • --fromCommit: Start commit reference. When not provided, latest git tag will be used as default.
  • --toCommit: End commit reference. When not provided, latest commit in HEAD will be used as default.
  • --date: The date of the release. Default is the current date. Format: YYYY-MM-DD.
  • --noBump: Do not bump the version in package.json.
  • --noCommit: Do not make a git commit.
  • --noTag: Do not make a git tag.
  • --noPush: Do not push the commit and the new tag to the remote git repository.
  • --debug: Output debug data in changeloger.debug.log for debugging purposes. Set --debug=inline to output debug data in the terminal.
  • And all others options available in changelog.config.json are also available as CLI arguments. The CLI arguments will override the options in the config file.

Configuration

You can use either changelog.config.json or changelog.config.{ts,tsx,js,mjs,cjs} to configure the changelog generation.

Available options and defaults:

Option Type Description Default
provider 'github' | 'bitbucket' | 'gitlab' | 'git' | null The provider of the repository. null
header string The header of the changelog. '# Changelog'
output string The path to the output file. You can create multiple changelog files (for multiple branch or multiple environment) by using the placeholder {branch} (e.g. CHANGELOG-{branch}.md). 'CHANGELOG.md'
versionPrefix string The prefix of the version. 'v'
versionBumpType 'major' | 'minor' | 'patch' The type of the version bump. patch
startVersion string The start version. 0.0.0
pullRequestOnly boolean Only include pull requests in the changelog file. false
order CommitType[] The order of each section in the changelog. ['feat', 'perf', 'fix', 'refactor', 'docs', 'chore', 'test', 'style', 'revert']
typeTitle Record<CommitType | 'other', string> The title of each section in the changelog. { feat: '๐Ÿš€ Features', perf: 'โšก๏ธ Performance', fix: '๐Ÿฉน Bug Fixes', refactor: '๐Ÿ’… Refactors', docs: '๐Ÿ“– Documentation', chore: '๐Ÿก Chores', test: 'โœ… Tests', style: 'โœจ Styles', revert: '๐Ÿ”€ Reverts', other: 'โ“ Unclassified' }
noPackageJson boolean Do not read the package.json file. Use this option when you don't have a package.json file in your project. false
clean boolean Determine if the working directory is clean and if it is not clean, exit. true
releaseCommitMessage string The commit message for the release. Placeholder {version} will be replaced with the new version. 'chore(release): {version}'
bump boolean Bump the version in package.json. This option will be ignored if --noBump is provided in the CLI arguments. true
commit boolean Make a git commit. This option will be ignored if --noCommit is provided in the CLI arguments. true
tag boolean Make a git tag. This option will be ignored if --noTag is provided in the CLI arguments. true
push boolean Push the commit and the new tag to the remote git repository. This option will be ignored if --noPush is provided in the CLI arguments. true
remote string The name of the remote git repository in case there are multiple remotes or the remote name is not origin. 'origin'

See ./src/config/index.ts for the full list of available options and their defaults.

๐Ÿ’ป Development

  • Clone the repository
  • Make sure you are using node >= v18.16
  • Install the dependencies: npm install
  • Run the dev script npm run dev or npm run test to test the build (it requires to run npm run build first)

Support

If you find this project useful, you can support its development by buying me a coffee:

Buy Me A Coffee

License

Made with โค๏ธ by trandaison

Licensed under the MIT License.

changeloger's People

Contributors

trandaison avatar sontd-nals avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.