Code Monkey home page Code Monkey logo

changelogen's Introduction

changelogen

npm version npm downloads Codecov License

Generate Beautiful Changelogs using Conventional Commits

Quick Start

Generate a changelog in Markdown format and display in the console:

npx changelogen@latest

Generate a changelog, bump the version in package.json and update CHANGELOG.md (without commit):

npx changelogen@latest --bump

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

npx changelogen@latest --release

CLI Usage

npx changelogen@latest [...args] [--dir <dir>]

Arguments:

  • --from: Start commit reference. When not provided, latest git tag will be used as default.
  • --to: End commit reference. When not provided, latest commit in HEAD will be used as default.
  • --dir: Path to git repository. When not provided, current working directory will be used as as default.
  • --clean: Determine if the working directory is clean and if it is not clean, exit.
  • --output: Changelog file name to create or update. Defaults to CHANGELOG.md and resolved relative to dir. Use --no-output to write to console only.
  • --bump: Determine semver change and update version in package.json.
  • --release. Bumps version in package.json and creates commit and git tags using local git. You can disable commit using --no-commit and tag using --no-tag. You can enable the automatic push of the new tag and release commit to your git repository by adding --push.
  • --publish. Publishes package as a new version on npm. You will need to set authorisation tokens separately via .npmrc or environment variables.
  • --publishTag Use custom npm tag for publishing (Default is latest)
  • --nameSuffix: Adds suffix to package name (Example: --nameSuffix canary renames foo to foo-canary)
  • --versionSuffix: Adds suffix to package version. When set without value or to true, uses date + commit hash as commit
  • --canary. Shortcut to --bump --versionSuffix (--nameSuffix will be also added if arg has a string value).
  • -r: Release as specific version.
  • --major: Bump as a semver-major version
  • --minor: Bump as a semver-minor version
  • --patch: Bump as a semver-patch version
  • --premajor: Bump as a semver-premajor version, can set id with string.
  • --preminor: Bump as a semver-preminor version, can set id with string.
  • --prepatch: Bump as a semver-prepatch version, can set id with string.
  • --prerelease: Bump as a semver-prerelease version, can set id with string.

changelogen gh release

Changelogen has built-in functionality to sync with with Github releases.

In order to manually sync a release, you can use changelogen gh release. It will parse current CHANGELOG.md from current repository (local, then remote) and create or update releases.

Usage:

npx changelogen@latest gh release [all|versions...] [--dir] [--token]

To enable this integration, make sure there is a valid repository field in package.json or repo is set in .changelogenrc.

By default in unauthenticated mode, changelogen will open a browser link to make manual release. By providing github token, it can be automated.

  • Using environment variables or .env, use CHANGELOGEN_TOKENS_GITHUB or GITHUB_TOKEN or GH_TOKEN
  • Using CLI args, use --token <token>
  • Using global configuration, put tokens.github=<token> inside ~/.changlogenrc
  • Using GitHub CLI token when authenticated with gh auth login

Configuration

Configuration is loaded by unjs/c12 from cwd. You can use either changelog.config.json, changelog.config.{ts,js,mjs,cjs}, .changelogrc or use the changelog field in package.json.

See ./src/config.ts for available options and defaults.

๐Ÿ’ป Development

  • Clone this repository
  • Enable Corepack using corepack enable (use npm i -g corepack for Node.js < 16.10)
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Made with ๐Ÿ’›

Published under MIT License.

changelogen's People

Contributors

aa900031 avatar antfu avatar atinux avatar autofix-ci[bot] avatar danielroe avatar dnldsht avatar exer7um avatar farnabaz avatar intevel avatar jannchie avatar johncampionjr avatar julien-r44 avatar louismazel avatar lvjiaxuan avatar maciej-ka avatar nozomuikuta avatar pi0 avatar renovate[bot] avatar sxzz avatar tmlmt avatar waleed-kh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

changelogen's Issues

Add an option to use only merge commits

Describe the feature

I wish the changelog could be generated using only merge commit (git log --merges) to have a tool more inclusive for those want do not want use squash merges.

Additional information

  • Would you be willing to help implement this feature?

Separate dependency changes from other changes

Describe the feature

I'm using renovate in my project to manage dependencies (as does this one). Renovate generates commit messages like fix(deps): update dependency .... I would like to group these dependency changes not under the fixes section but in a separate group. Usually there are a lot of dependency updates between releases and thus they clutter the changelog.

I can look into implementing this if someone points me in the right direction.

Additional information

  • Would you be willing to help implement this feature?

Add `--publish` flag

This flag can be helpful to for automated releases to automatically trigger the npm publish command with proper args and scope.

Related: #104

Config format `.changelogrc` not works

Environment

Node.js v20.2.0
Changelogen v0.5.3

Reproduction

I added changelog.config.json with the following content:

{
  "types": {
    "feat": {
      "title": "๐Ÿš€ Features"
    },
    "fix": {
      "title": "๐Ÿž Bug Fixes"
    },
    "perf": {
      "title": "๐ŸŽ Performance Improvements"
    },
    "refactor": false,
    "style": false,
    "chore": false,
    "build": false,
    "test": false,
    "docs": false,
    "ci": false
  }
}

Everything is working fine.

But when I create a file `.changelogrc' with the same content, it has no effect on how changelog is generated.

Support custom email mapping

For some reasons, github api might be unable to map a user to it's handle and name (unjs/ungh#50). We might support a emailMap configuration to support custom emails

(also i would use same feature to stop thanking my self / known members in changeloges :D)

gitmoji support

Add support for gitmoji commit messages:

Currently:

### ๐Ÿก Chore

  - :arrow_up: bump qs from 6.10.3 to 6.10.4 (xxx)
  - :arrow_up: bump mongodb from 4.4.1 to 4.6.0 (xxx)
  - :arrow_up: bump @azure/data-tables from 13.0.1 to 13.1.1 (xxx)
  - :arrow_up: bump gremlin from 3.5.2 to 3.6.0 (xxx)

### ๐Ÿ“– Documentation

  - **helper:** :pencil:  Updated TSDoc (xxx)

With gitmoji support:

### ๐Ÿก Chore

  - โฌ†๏ธ bump qs from 6.10.3 to 6.10.4 (xxx)
  - โฌ†๏ธ bump mongodb from 4.4.1 to 4.6.0 (xxx)
  - โฌ†๏ธ bump @azure/data-tables from 13.0.1 to 13.1.1 (xxx)
  - โฌ†๏ธ bump gremlin from 3.5.2 to 3.6.0 (xxx)

### ๐Ÿ“– Documentation

  - **helper:** โœ๏ธ Updated TSDoc (xxx)

issue with detecting last tag

Using taggerdate to find the latest created tag seems wrong when different tag names exist in a git repo. Using creatordate will solve this issue.

const r = await execCommand('git', ['--no-pager', 'tag', '-l', '--sort=taggerdate']).then(r => r.split('\n'))

Here is the result of running these command in @nuxt/content repo

git --no-pager tag -l --sort=taggerdate

2.0.0
2.0.1
v1.13.1
v1.14.0
...
[email protected]
[email protected]
@nuxt/[email protected]
@nuxt/[email protected]

git --no-pager tag -l --sort=creatordate

v0.0.1
v0.0.2
v0.0.3
...
@nuxt/[email protected]
v2.0.0
v2.0.1

npx: package borked? ๐Ÿค”

Just tried using changelogen with npx and I keep getting this error:

/bin/env: bad interpreter: No such file or directory

I've tried on a couple different computers and seems to be happening whenever you try to run the script ๐Ÿค” (I am on node 16, btw)

GitHub username mentions for GitHub releases

Describe the feature

I would really like to be able to mention users when making a GitHub release. (This does not work if their user name is linked.)

For the GitHub release only, would it be possible to include just the username and not the link to their profile (which will be auto-linked)?

I would also note that quite a lot of usernames are not correctly linked, including mine. Currently I manually go through every commit to ensure I have the right user mentioned in the release. Here's a sample implementation from the amazing changelogithub:

https://github.com/antfu/changelogithub/blob/main/src/github.ts#L63-L93

Additional information

  • Would you be willing to help implement this feature?

config.templates.commitMessage.replaceAll is not a function with node 14

Environment

v14.18.0

Reproduction

Describe the bug

When I run the 'yarn changelogen --release' command i get the error mentioned in the title. I don't have any problem when my Node version is 16.0.0, but when it's 14.18.0, I get the error. I think it's because replaceAll function started to be used in version 15.0.0. Can you create alternative for replaceAll fn due to solve it?

Additional context

node_error

Logs

No response

support including handles of contributors

Describe the feature

GitHub Releases marks contributors to releases by usage of @ handle. It would be nice to generate these in the contributors list at the bottom (maybe instead of email addresses) so they show up when the release is published.

Additional information

  • Would you be willing to help implement this feature?

migrate cli to use unjs/citty

Environment

node 16.20.0

Reproduction

migrate cli to use unjs/citty

Describe the bug

migrate cli to use unjs/citty

Additional context

No response

Logs

No response

Add ability to add for generating changelog for specific release without tagging

Describe the feature

Hi!
Thank you for your awesome project!

I use the bumpp package for version upgrades. I like that I can manually choose version of my package.

image

It would be great to be able to generate a changelog for a release by tag, which would include the difference between the tag and the previous tag.

Like this:

// package.json
{
  "scripts" {
    "release:version": "bumpp package.json --execute=\"pnpm exec changelogen --output changelog.md --version %s" --tag --all",
  }
}

Additional information

  • Would you be willing to help implement this feature?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm standard-version Available

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update pnpm to v9.10.0

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): replace devdependency standard-version with commit-and-tag-version ^9.5.0

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/autofix.yml
  • actions/checkout v4
  • actions/setup-node v4
  • autofix-ci/action ff86a557419858bb967097bfc916833f5647fa8c
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-node v4
  • codecov/codecov-action v4
npm
package.json
  • c12 ^1.11.2
  • colorette ^2.0.20
  • consola ^3.2.3
  • convert-gitmoji ^0.1.5
  • execa ^8.0.1
  • mri ^1.2.0
  • node-fetch-native ^1.6.4
  • ofetch ^1.3.4
  • open ^10.1.0
  • pathe ^1.1.2
  • pkg-types ^1.2.0
  • scule ^1.3.0
  • semver ^7.6.3
  • std-env ^3.7.0
  • yaml ^2.5.1
  • @types/node ^20.16.5
  • @types/semver ^7.5.8
  • @vitest/coverage-v8 ^2.0.5
  • eslint ^9.10.0
  • eslint-config-unjs ^0.3.2
  • jiti ^1.21.6
  • prettier ^3.3.3
  • standard-version ^9.5.0
  • typescript ^5.5.4
  • unbuild ^2.0.0
  • vitest ^2.0.5
  • pnpm 9.9.0

  • Check this box to trigger a request for Renovate to run again on this repository

auto added scopes using scope map config

Using a map from file names / prefixes to scoped like scopeMap, we could map a change to it's scope (like updating src/presets renamed fix: foobar in src/presets/foo.ts to fix(presets): foobar when scopeMap: { 'presets/**': 'foobar' } is set.

Use GitHub release notes to generate changelog

Describe the feature

Hello,

I'm currently working in a project where they use merge commit. So changelogen have some difficulties to create the changelog because all commits are use.

2 issues here:

  • Every commit from the PR will be used to create changelog and to determine bump type
  • Author of the merge commit is not (it can but not each time) the author of the PR

But, GitHub is able to generate correct release not. So I build a tool to fetch release notes, organize them and update the related release. (https://github.com/aneoconsulting/order-github-release-notes)

I see that changelogen is using more GitHub API with a namespace github so do you think we can merge my tool into changelogen?

related to #62

Additional information

  • Would you be willing to help implement this feature?

Mode `dry-run`

Describe the feature

It would be great to have a --dry-run option so we could do npx changelogen@latest --release --dry-run or npx changelogen@latest --bump --dry-run

This will force to not write to git/disk (improved --no-output --no-commit --no-tag)

Additional information

  • Would you be willing to help implement this feature?

Monorepo support

Moving from #18 also awesome works in #45 by @leo91000 and #83 by @aa900031

@itpropro: Provide some way to generate changelogs only for one or more specific subfolders/repos in a monoprepo structure.

These are smaller tasks breakdown in order to support mono repos progressively since this is a rather big change in changelogen.

  • Configurable git commit template (#82)
  • Monorepo utils (unjs/pkg-types#117)
  • Expose a new workspaces config object (auto-detected with resolveWorkspace from pkg-types)
  • A new subDir config defaulting to / and when is set, filters commits only relevant to this subpath and also operates package.json and CHANGELOG.md in {rootDir}/{subDir} for updating
  • Update CLI --release to use workspace config when is set/detected and operate release on each monorepo project with baseDir set (using sorted/ordered graph resolved by pkg-types)
  • Extend scopeMap (#86) with workspace config to automatically apply scoped changeloges

Note: PRs are more than welcome to implement each task. If you see an improvement in the roadmap for implementation please comment below. ๐Ÿ™๐Ÿผ

Summary stats

Show summary stats of total commits, change type, authors

CHANGELOG.md file is not commited during the first release

Environment

OS: Ubuntu 22.04.1 LTS
node: 16.19.0
npm: 8.9.13
changelogen: latest (0.4.1)

Reproduction

https://github.com/sumerokr/changelogen-reproduction

Describe the bug

Dear UnJS team,
I have noticed that the first run of the npx changelogen --release command does not include the CHANGELOG.md file into the version bump commit. Is this on purpose?

Additional context

No response

Logs

> git log
feat: init

> git status
nothing to commit, working tree clean

> npx changelogen --release

> git log
chore(release): v1.1.0
feat: init

> git status
Untracked files:
  CHANGELOG.md

Custom commit message like [skip ci]

Describe the feature

I'm using bitbucket as pipeline and I can skip the pipeline run when the commit message contains "[skip ci]"

I see no possibilty to adjust the commit message "chore(release): {tag}" to another one

Additional information

  • Would you be willing to help implement this feature?

special characters break repo config detection

When repository name or org name contains . or - or _, (while it is supported, it cannot be detected).

While working on fix, I'm thinking to extract this functionality to it's own lib also sharing with unjs/giget and improve testing

[BUG] Publishing Github release doesn't work in v0.5.2

Environment

changelogen: 0.5.2
node: 18.14.1
browser: Arc v0.95.1 (37921)

Reproduction

Run: changelogen --release --push

package.json

{
  "changelog": {
    "repo": {
      "provider": "github"
    }
  }
}

Describe the bug

The auto publish of the release with Github not works anymore with v0.5.2

A new window of the Browser is open, stay open and the release is not published.

Additional context

The urls generated for commits and compare version looks like:

I think the bug is due to this error

Check it here: https://github.com/zadigetvoltaire/nuxt-gtm/blob/main/CHANGELOG.md (v0.0.9)

Logs

> changelogen --release --push

โ„น Generating changelog for v0.0.8...main                                                                                          15:27:31
โ„น Bumping version from 0.0.8 to 0.0.9 (minor)                                                                                     15:27:31
โ„น Updating /.../CHANGELOG.md                                                                 15:27:31
โ„น Followup in the browser to manually create the release.

How can I generate CHANGELOG.md when I first time bump version?

Hi. Thanks for your work.

When I try changelogen, I find no way to generate CHANGELOG.md when I first time bump version.

$ npx changelogen --release                    
Need to install the following packages:
  [email protected]
Ok to proceed? (y) 

 ERROR  Command failed with exit code 128: git describe --tags --abbrev=0                                                                                                                                                                             16:07:45
fatal: No tags can describe 'dbd9fa593d64f0a04bb801be556eae775242c48a'.
Try --always, or create some tags.

  fatal: No tags can describe 'dbd9fa593d64f0a04bb801be556eae775242c48a'.
  Try --always, or create some tags.
  at makeError (/Users/wurui/.npm/_npx/fd5a125c5466fd2f/node_modules/execa/lib/error.js:59:11)
  at handlePromise (/Users/wurui/.npm/_npx/fd5a125c5466fd2f/node_modules/execa/index.js:124:26)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async execCommand (/Users/wurui/.npm/_npx/fd5a125c5466fd2f/node_modules/changelogen/dist/shared/changelogen.53701f80.mjs:94:15)
  at async getLastGitTag (/Users/wurui/.npm/_npx/fd5a125c5466fd2f/node_modules/changelogen/dist/shared/changelogen.53701f80.mjs:13:13)
  at async loadChangelogConfig (/Users/wurui/.npm/_npx/fd5a125c5466fd2f/node_modules/changelogen/dist/shared/changelogen.53701f80.mjs:415:19)
  at async Module.defaultMain (/Users/wurui/.npm/_npx/fd5a125c5466fd2f/node_modules/changelogen/dist/chunks/default.mjs:24:18)
  at async main (/Users/wurui/.npm/_npx/fd5a125c5466fd2f/node_modules/changelogen/dist/cli.mjs:22:3)

Can you please give me some advice? Thanks.

Generate Changelog with version from `package.json`

Describe the feature

Hi!

I use bumpp to raise the version of my package.

I used conventional-changelog and standard-version for generating changelogs before.

It worked according to the following algorithm:

  1. Files are prepared, tests and builds are run
  2. bumpp updates the version in package.json
  3. standard-version or conventional-changelog generate the changelog from latest version tag to version from package.json
  4. The updated changelog is added to the git
  5. bumpp create commit and tag with new version and push to origin repo

Example of package.json:

{
  "scripts": {
    "release": "pnpm release:check && pnpm release:version && pnpm release:publish",
    "release:changelog": "standard-version --infile changelog.md --same-file --skip.bump --skip.commit --skip.tag",
    "release:check": "pnpm test && pnpm build",
    "release:publish": "clean-publish",
    "release:version": "bumpp package.json --execute=\"pnpm release:changelog && git add changelog.md\" --commit \"build: publish v%s\" --tag --all",
  }
}

I would like to be able to generate changelogs without creating a tag and getting a new version from package.json

Additional information

  • Would you be willing to help implement this feature?

How to adopt changelogen for an already conventional commit project

Describe the feature

Hello,

I'm going to move from standard-version and friends since the project is deprecated. I found changelogen and I really like it!

Not only that, but I wanted to ask if it could be possible to regenerate the CHANGELOG.md for a project that is already uses conventional commits.

Like generating all the releases from the beginning, is that possible? ๐Ÿ™‚

Additional information

  • Would you be willing to help implement this feature?

Disable contributors section

Would it be possible to add an option to disable the contributors section ? Or only show new contributors instead of repeating every time ?

Could we extract the bump function?

Hello,

Actually, I'm using codacy/git-version but it use a dev and a main branch which is really annoying. So, I'm looking for a way to generate the next version using conventional commit. I'm not founding anything but looking at this package, I think that it could be awesome to extract the bump function into it's own package to be able to generate, using lastest tag and last commits a new version without the pain of the dev and main branch.

Then, in this package, we could use the new package to get a version.

Monorepo support

Provide some way to generate changelogs only for one or more specific subfolders/repos in a monoprepo structure.
For single folders, rootDir would probably work, but if 2 or more projects in a monorepo changed, you would have to append all together.

Introduce CAC

Describe the feature

Hello,

In order to easily add new command and understand how the CLI works (because there is more and more feature), I think that we could use a tool like CAC, https://github.com/cacjs/cac, to achieve this.

Currently, there is no -h flag and there is many more flag to come.

#104 with a --prevenance
#105 with a --publish
nuxt/nuxt#20675 with a flag to create a PR (where we could personalize changelog header)

Additional information

  • Would you be willing to help implement this feature?

Github prereleases

When there is a prerelease suffix to the version (x.y.z-something) we should sync it as a prerelease for github

Configuration doesn't override the right way

My .changelogrc looks like that:

{
	"types": {
		"feat": { "title": "Features" }
	}
}

But config is still logged like that:

{
  types: {
    feat: { title: '๏ฟฝ๐Ÿš€ Enhancements' }
    perf: { title: '๏ฟฝ๐Ÿ“– Performance' },
    fix: { title: '๐Ÿฉน Fixes'  },        
    refactor: { title: '๏ฟฝ๐Ÿ’… Refactors' 
    examples: { title: '๏ฟฝ๐Ÿ€ Examples' }
    docs: { title: '๏ฟฝ๐ŸŒŠ Documentation' 
    chore: { title: '๏ฟฝ๐ŸŽจ Chore' },     
    build: { title: '๏ฟฝ๐Ÿ“ฆ Build' },     
    test: { title: 'โœ… Tests' },        
    types: { title: '๏ฟฝ๐ŸŒŠ Types' },     
    style: { title: '๏ฟฝ๐ŸŽจ Styles' },    
    ci: { title: '๏ฟฝ๐Ÿค– CI' }
  },

Markdown templates

Built-in: group (previous) and flat (current)
External: Lodash-template alike?

Add breaking changes message to changelog

breaking change

Hi, "breaking changes" are important things for users to watch out for in new versions. i usually include them in the commit messages, but i think it would be useful to have a specific section to display them, like in the example image. Is there a way to do this?

Resolve reverts

Automatically remove entries that are referenced to revert in same changelog set

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.