Gatsby transformer plugin for files in the keepachangelog format
Parses files which are written in the keepachangelog format.
Every file with the name CHANGELOG.md is picked up by the transformer.
npm install --save gatsby-transformer-keepachangelog
Note: You also need to have gatsby-source-filesystem
installed and configured so it points to your files.
In your gatsby-config.js
module.exports = {
plugins: [
`gatsby-transformer-keepachangelog`,
{
resolve: `gatsby-source-filesystem`,
options: {
path: `./src/data/`,
},
},
],
}
Where the source folder ./src/data/
contains the CHANGELOG.md
files.
You can query the nodes using GraphQL, like from the GraphiQL browser: http://localhost:8000/___graphql
.
{
allChangelog {
nodes {
versions {
tag
date
changes {
html
}
}
}
}
}
Which would return:
{
"data": {
"allChangelog": {
"nodes": [
{
"versions": [
{
"tag": "1.0.0",
"date": "2020-04-09T00:00:00.000Z",
"changes": {
"html": "<h3>Fixed</h3>..."
}
},
{
"tag": "1.0.0-RC1",
"date": "2020-03-26T00:00:00.000Z",
"changes": {
"html": "<h3>Added</h3>..."
}
}
]
}
]
}
}
}