Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templating Documentation #68

Open
derekgreer opened this issue May 11, 2018 · 2 comments
Open

Templating Documentation #68

derekgreer opened this issue May 11, 2018 · 2 comments

Comments

@derekgreer
Copy link

I've just stumbled upon conventional-github-releaser, having used standard-version for awhile and searching for a way to customize how the CHANGELOG.md is generated. It appears that the templating system may be provided by the underlying conventional-changelog tool, but I can't seem to find any documentation at any level of these tools which actually walks you through how to create a custom template. The help output says:

    -c, --context             A filepath of a javascript that is used to define template variables

... but I can't find any documentation as to what the contents of this file is supposed to look like. Are there some existing docs that I'm missing?

Thanks.

@hutson
Copy link
Contributor

hutson commented Jun 6, 2018

It appears that the templating system may be provided by the underlying conventional-changelog tool

That is the case. You can customize the data used by the templates, and you can just straight up replace templates with your own custom.

I can't seem to find any documentation at any level of these tools which actually walks you through how to create a custom template

That is also correct. There is not, to my knowledge, any documentation explaining how to work with context and the templates settings to customize the CHANGELOG output.

@martinmosegaard
Copy link

If you run the tool with verbose output, conventional-github-releaser -v, it should print the "final context", which may give an indication of the keys to put in there. The trick with the JavaScript file is to use module exports like they do in the example file given for the --config-script option.

I am able to specify values like this:

$ cat release-context.js
module.exports = {
  version: 'some custom value',
  previousTag: '1.1.0',
  currentTag: '1.3.0',
  ...
};
$ conventional-github-releaser -v --context release-context.js
...
(final context includes my values)

It would be great if the help text included a link to a useful context file, like it does for the config option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants