npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

changesets-format-with-issue-links

v0.3.0

Published

A changelog formatter for Changesets that adds commit, PR, and issue links

Downloads

2,572

Readme

Changesets Format with Git Links

npm version build status test coverage dependencies status

What is this?

Atlassian Changesets is a changelog management tool. Its default formatter generates a plain list of changes, without issue links.

This package adds links to the git commits, issues, and pull requests where your changesets were added.

The result is similar to the output of other common changelog standards, such as standard-version and Release Please.

Setup

If you have already set up Changesets, you only need to install the package and add it to your .changeset/config.json.

You do not need to enable the commit option in your config.

npm install --D changesets-format-with-issue-links
// .changeset/config.json
{
  "changelog": [
    "changesets-format-with-issue-links",
    {
      "repoBaseUrl": "https://github.com/your-username/repo",
      // additional options here
    }
  ]
}

Bitbucket setup

You can change the commit and issue link templates for Bitbucket or any other service:

// .changeset/config.json
{
  "changelog": [
    "changesets-format-with-issue-links",
    {
      "repoBaseUrl": "https://bitbucket.org/your-company/repo",
      // This will generate a Markdown link like `[#123](https://bitbucket.org/your-company/repo/pull-requests/123)`,
      // wrapped in parentheses.
      "issueTemplate": " ([#$issue]($repoBaseUrl/pull-requests/$issue))"
      "commitTemplate": " [$abbrevHash]($repoBaseUrl/commits/$hash)"
    }
  ]
}

Options

repoBaseUrl (required)

A base url -- including https -- which can be used to build links in commitTemplate and issueTemplate. Example: "https://github.com/spautz/changesets-changelog-format"

changesetTemplate (default: "- ${changesetTitle}${issue}${commit}${changesetBody}")

Content that will be added to your changelog.

With the default value, issue and commit links will be inserted at the end of the first line of your changeset message.

See commitTemplate for the $commit variable, issueTemplate for the $issue variable, and Template Variables for other available values.

commitTemplate (default: " ([$abbrevHash]($repoBaseUrl/commit/$hash))")

Content for the $commit variable, based on the commit when the changeset was created. See gitlogOptions below for information on the available fields from the commit.

commitMissingTemplate (default: "")

Content for the $commit variable when no commit could be found. This should generally be left blank.

issuePattern (default: "#(\\d+)\\)")

Regular expression (without the leading and trailing /) used to identify issues and pull requests in the subject line of a commit message. The default will match a number immediately followed by a closing parentheses, like #4).

If the commit message matches this pattern, the Regex result will be available as $issueMatch and the text inside the capturing group ((\d+) in the default) will be available as $issue in the issueTemplate, below.

issueTemplate (default: " ([#$issue]($repoBaseUrl/issues/$issue))")

Content for the $issue variable, based on the value matched by issuePattern.

issueMissingTemplate (default: "")

Content for the $issue variable when no issue or pull request could be found. This should generally be left blank.

gitlogOptions

Default:

{
  "repo": ".",
  "fields": ["hash", "abbrevHash", "authorName", "authorEmail", "authorDate", "subject"],
  "includeMergeCommitFiles": true
}

Options passed to gitlog (see docs here).

This can be used to add additional fields to the template, or to change the behavior of the git log search.

How it works

This works by identifying the git commit when a changeset entry was added, looking for an issue number in its commit message, and then using templates to append any relevant links or info to the changelog entry.

Template variables

Inside any of the templates (changesetTemplate, commitTemplate, commitMissingTemplate, issueTemplate, or issueMissingTemplate), any token that starts with $ or which is wrapped within ${...} will be treated as a variable.

Use \\$ to escape the dollar sign character if you do not want it to be treated as a variable.

Available variables

Information from the changeset entry:

| Variable name | Notes | | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | $changesetTitle | The summary (first line) of your Changesets entry | | $changesetBody | All text after the first line of your Changesets entry, trimmed | | $changesetRawBody | The entire text of your Changesets entry | | $versionType | The semver bump type: "major", "minor", "patch", or "none" | | $changesetInfo | Object containing all of the above, plus any other information from Changesets (e.g.,${changesetInfo.changesetTitle}, ${changesetInfo.versionType}) |

Information from the git commit when the changeset was added:

| Variable name | Notes | | :------------ | :----------------------------------------------------------------------------------------------------------------------------- | | $commit | Text generated from commitTemplate (or commitMissingTemplate if the commit was not found) | | $hash | The full 40-character git hash | | $abbrevHash | The short git hash | | $subject | First line of the commit message | | ... | Anything you requested via gitlogOptions.fields | | $commitInfo | Object containing all of the above (e.g., ${commitInfo.abbrevHash}, ${commitInfo.hash}) |

Information from the matched issue pattern, if any:

| Variable name | Notes | | :------------ | :---------------------------------------------------------------------------------------------------- | | $issue | Text generated from issueTemplate (or issueMissingTemplate if no issue was found) | | $issueMatch | Object containing all of the results from the match against issuePattern (e.g., ${issueMatch[1]}) |

And also any additional values you included in the config options:

| Variable name | Notes | | :------------- | :------------------------------------------------------------------------------------------- | | $repoBaseUrl | Generally used by commitTemplate and issueTemplate | | ... | Anything that wasn't recognized | | $options | Object containing all of the options from .changeset/config.json, merged with the defaults |