README
chan-core
API to work with chast
Note
Since v3.0 this module is ESM only.
Install
npm install @geut/chan-core
Use
import toVFile from 'to-vfile'
import { initialize, addChanges, addRelease, getMarkdownRelease } from '@geut/chan-core'
const file = toVFile.readSync('CHANGELOG.md')
await initialize(file)
await addChanges(file, {
changes: [
{ action: 'Security', value: 'alguna cosa' },
{
action: 'Changed',
value: 'vaaamos',
group: 'package2'
},
{
version: '0.0.1',
action: 'Fixed',
value: 'fixed algo viejo',
group: 'package1'
}
]
})
await addRelease(file, {
version: '0.0.2',
gitTemplate: 'https://github.com/geut/chan/compare/[prev]...[next]',
gitBranch: 'HEAD',
mergePrerelease: true,
releasePrefix: 'v'
})
await getMarkdownRelease(file, { version: '0.0.1' })
API
initialize (from, { overwrite })
{vfile} from
{Boolean} overwrite
true to overwrite if file already exists. Default to false
addChanges (from, { changes })
{vfile} from
{Array} changes
chast representation for a set of changes.
addRelease (from, { version, date, yanked, gitTemplate, gitBranch, allowYanked, allowPrerelease, mergePrerelease, releasePrefix })
{vfile} from
getMarkdownRelease (from, { version })
{vfile} from
{String} version
The version to extract from file.