conventional-changelog icon indicating copy to clipboard operation
conventional-changelog copied to clipboard

Support for custom tag pattern

Open sri-vr opened this issue 4 years ago • 4 comments

hey all,

currently i am not sure if there is a way to support custom tag pattern , for eg the following semvar tags are used in application v1.23.0-app-sandbox v1.23.0-app-production v2.1.0-admin-app-sandbox v2.1.0-admin-app-production how can i get the changelog for tag with pattern v1.23.0-app-production i.,e, regex, /*+-app-production$/ is there a way to do it ? shall i put up a PR thats solves this problem? lemme know, thanks

sri-vr avatar Oct 21 '20 06:10 sri-vr

As we track the major version of the CMS we are working with I will also need the option of a custom pattern: v10.0.0.0 (the 10 being the version of the CMS). Is that possible? If so, how?

landwire avatar Mar 25 '21 08:03 landwire

hey all,

currently i am not sure if there is a way to support custom tag pattern , for eg the following semvar tags are used in application v1.23.0-app-sandbox v1.23.0-app-production v2.1.0-admin-app-sandbox v2.1.0-admin-app-production how can i get the changelog for tag with pattern v1.23.0-app-production i.,e, regex, /*+-app-production$/ is there a way to do it ? shall i put up a PR thats solves this problem? lemme know, thanks

I meet the same problem, did you solved it?

linlai163 avatar Sep 27 '21 09:09 linlai163

Hi, I found a solution and you can have a try. You can custom the function generateOn like this:

    conventionalChangelog(
      {
        preset: "angular",
        append: false,
        releaseCount: 0,
        currentTag: tag
      },
      {
        linkReferences: false,
        repoUrl: "",
        issue: "",
        repository: "",
        owner: "terminus",
        host: "",
        currentTag: tag,
      },
      {},
      {},
      {
        headerPartial: changeLogHeader,
        isPatch: true,
        doFlush: false,
        generateOn: function(commit) {
          // write your own logic
         //  you can write regex here
          return commit.version
        }
      }
    )
      .pipe(fs.createWriteStream("./CHANGELOG.md"))
      .on("finish", resolve)
  });

linlai163 avatar Sep 27 '21 11:09 linlai163

let gitRawCommitsOpts = {
  from: 'v2.1.0-admin-app-sandbox'
}

module.exports = Q.all([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts, gitRawCommitsOpts])
  .spread((conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts, gitRawCommitsOpts) => {
    return { context, conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts, gitRawCommitsOpts }
  })

akof1314 avatar Nov 21 '21 08:11 akof1314