1.0.3 • Published 12 months ago

@trandaison/changeloger v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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:

OptionTypeDescriptionDefault
provider'github' \| 'bitbucket' \| 'gitlab' \| 'git' \| nullThe provider of the repository.null
headerstringThe header of the changelog.'# Changelog'
outputstringThe 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'
versionPrefixstringThe prefix of the version.'v'
versionBumpType'major' \| 'minor' \| 'patch'The type of the version bump.patch
startVersionstringThe start version.0.0.0
pullRequestOnlybooleanOnly include pull requests in the changelog file.false
orderCommitType[]The order of each section in the changelog.['feat', 'perf', 'fix', 'refactor', 'docs', 'chore', 'test', 'style', 'revert']
typeTitleRecord<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' }
noPackageJsonbooleanDo not read the package.json file. Use this option when you don't have a package.json file in your project.false
cleanbooleanDetermine if the working directory is clean and if it is not clean, exit.true
releaseCommitMessagestringThe commit message for the release. Placeholder {version} will be replaced with the new version.'chore(release): {version}'
bumpbooleanBump the version in package.json. This option will be ignored if --noBump is provided in the CLI arguments.true
commitbooleanMake a git commit. This option will be ignored if --noCommit is provided in the CLI arguments.true
tagbooleanMake a git tag. This option will be ignored if --noTag is provided in the CLI arguments.true
pushbooleanPush 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
remotestringThe 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.

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago