Code Monkey home page Code Monkey logo

changeset-conventional-commits's Introduction

changeset-conventional-commits

Generate changesets based on the conventional commits.

npm Known Vulnerabilities Code Climate GitHub license

Use without adding as a dev dependancy

  • Using pnpm
pnpm dlx changeset-conventional-commits
  • Using npx
npx changeset-conventional-commits

Install

pnpm add -D changeset-conventional-commits

Usage

  1. Make sure the project is setup with changesets.
  2. Run pnpm changeset-conventional in the root.

This will generate changeset for each commit.

Note

This library is created based on this PR. There are issues created in changesets for this functionality and there is not update on this yet. So I created this library till that support is implemented.

changeset-conventional-commits's People

Contributors

github-actions[bot] avatar iamchathu avatar jakub-hajduk avatar nerdgore avatar

Stargazers

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

Watchers

 avatar  avatar

changeset-conventional-commits's Issues

Critical bug: commit message body is ignored

There seems to be a bug in the code that is not picking up commits with multiple lines.
When I run the git command used to describe the commit, I do not get an error, but the body is ignored as implied by the formatting function (%s only containing the subject).

Impact

Crucial information may be missing from changelogs, including but not limited to message body and footers (possibly containing ticket refs and information about breaking changes).

Current behavior

Given a commit message with a body matching the convetional commit spec
WHEN I run changeset-conventional
THEN an error is logged: fatal: No tags can describe 'sha1'.
THEN the change is not added as changeset

Expected behavior

Given a commit message with a body matching the convetional commit spec
WHEN I run changeset-conventional
THEN the change is added as changeset

How to reproduce

Add a commit message as allowed by the conventional commit spec.

Add a commit to your repo with the following content:

feat(scope): a commit subject

Add a body paragraph to explain the change.

Follow by a second paragraph as allowed by the conventional
commit spec.

Refs: #123

Possible fix

Replace %s token in the git pretty format with %B to retrieve the unwrapped message body instead of the message subject.

Only works for public packages

Hi ๐Ÿ‘‹

First of all, let me thank you in advance for your for making this a public npm package.

My question is probably better suited to the pull request that served as the basis for this package. Nevertheless, is there a reason why this package purposely drops private packages?

In my use case, I have a set of private packages from which I'd like to generate a changeset based on the conventional commits pattern.

Feature request: sha and message body in changeset message

Hi, thanks for your great project.
While trying to set up changesets and conventional commits we discovered that there is one issue that may or may not be intentional that is breaking the changelog (for us).

When creating a PR with multiple comits we want to run changeset-conventional to create the changesets and add a comit to the PR. This works great, however, the only reference the changelogs have is the commit when the changesets have been added.

This means that if there is a PR that deals with multiple workspaces and dependency updates the log is not very helpful. The format used may drop essential information.

There are multiple options, depending on how far you want to go. I could also take a stab at implementing if you are willing to accept PRs. I have just briefly looked into the code and maybe this change is not necessary, given the has is already in the returned object. Basically we want to be able to generate a changelog like this:

[**scope**](link-to-repository?id=commitHash): feat: some message

The git command here could be updated to either be configurable or by default add all information to the changelog. This could open the tokens up to be used by a formatter - or simply return the message with the hash included (snas the regex magic) and use a changeset custom log format to do this.

const commitsWithMessages = commitsSinceBase.map((commitHash) => {
  const commitMessage = execSync(`git log -n 1 --pretty=format:%s\n\n%b ${commitHash}`)
  const [,type, scope, breaking, subject, body] = commitMessage.match(/([^(:]+)(?:\(([^)]+)\))?(!)?: (.+)(?:\n{2,}([\s\S]+))?/))
  return {
    commitData: { type, scope, breaking, subject, body },
    commitHash,
    commitMessage: 
  }
});

Let me know if I should elaborate more.

Does nothing

I'm not sure if I'm doing this correctly. I'm using npm running npx changeset-conventional does nothing really.

Can only generate changesets once?

I'm looking at integrating this into the release flow for a new monorepo I'm working on.

I generated the changesets once locally, but then deleted them all (still working on the bugs of the workflow). But then when I run pnpm dlx changeset-conventional-commits again, I don't get anything generated...

Is this expected behavior? (Or maybe I'm doing something stupid?)

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.