Standard-version: feat: add configuration option for GitLab/BitBucket URLs

Created on 29 Nov 2017  路  2Comments  路  Source: conventional-changelog/standard-version

I would like to introduce config options to standard-version, in the form of a .svrc and a standard-version stanza in the package.json; This functionality is built into yargs:

https://github.com/yargs/yargs/blob/master/docs/advanced.md#configuration

I think the first feature we should support is adding the ability to use GitLab and BitBucket style URLs (see https://github.com/conventional-changelog/standard-version/issues/204, https://github.com/conventional-changelog/standard-version/pull/174).

@cdupetit could we potentially simplify the process of providing context for gitlab; it feels like --context requires a lot of variables be specified. I'd prefer that we override a few in the package.json.

enhancement help wanted

Most helpful comment

I was able to produce a working changelog for a self-hosted Bitbucket Server (v5.16.10) using the following configuration in .versionrc.json:

{
  "types": [ ... ],
  "commitUrlFormat": "https://bitbucket.my.domain/projects/{{owner}}/repos/{{repository}}/commits/{{hash}}",
  "compareUrlFormat": "https://bitbucket.my.domain/projects/{{owner}}/repos/{{repository}}/pull-requests?create&targetBranch=refs%2Ftags%2F{{previousTag}}&sourceBranch=refs%2Ftags%2F{{currentTag}}",
  "issueUrlFormat": "https://jira.my.domain/browse/{{id}}",
  "userUrlFormat": "https://bitbucket.my.domain/users/{{user}}"
}

Note that since the comparison feature has been added with v6.3 of Bitbucket Server I'm generating links to create a pull requrest, which does not make much sense by itself, but at least there you can switch to the Diff tab where you can view the changes ;-).
You may wish to adjust the compareUrlFormat to use the real compare with v6.3 instead (where I don't know the URL format yet).

All 2 comments

CC: @Tapppi, @nexdrew, @stevemao

I was able to produce a working changelog for a self-hosted Bitbucket Server (v5.16.10) using the following configuration in .versionrc.json:

{
  "types": [ ... ],
  "commitUrlFormat": "https://bitbucket.my.domain/projects/{{owner}}/repos/{{repository}}/commits/{{hash}}",
  "compareUrlFormat": "https://bitbucket.my.domain/projects/{{owner}}/repos/{{repository}}/pull-requests?create&targetBranch=refs%2Ftags%2F{{previousTag}}&sourceBranch=refs%2Ftags%2F{{currentTag}}",
  "issueUrlFormat": "https://jira.my.domain/browse/{{id}}",
  "userUrlFormat": "https://bitbucket.my.domain/users/{{user}}"
}

Note that since the comparison feature has been added with v6.3 of Bitbucket Server I'm generating links to create a pull requrest, which does not make much sense by itself, but at least there you can switch to the Diff tab where you can view the changes ;-).
You may wish to adjust the compareUrlFormat to use the real compare with v6.3 instead (where I don't know the URL format yet).

Was this page helpful?
0 / 5 - 0 ratings