@geut/chan-core

3.2.7 • Public • Published

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 })

from {vfile}

overwrite {Boolean}

true to overwrite if file already exists. Default to false

addChanges (from, { changes })

from {vfile}

changes {Array}

chast representation for a set of changes.

addRelease (from, { version, date, yanked, gitTemplate, gitBranch, allowYanked, allowPrerelease, mergePrerelease, releasePrefix })

from {vfile}

getMarkdownRelease (from, { version })

from {vfile}

version {String}

The version to extract from file.

Readme

Keywords

none

Package Sidebar

Install

npm i @geut/chan-core

Weekly Downloads

586

Version

3.2.7

License

ISC

Unpacked Size

30.8 kB

Total Files

18

Last publish

Collaborators

  • geutuser
  • the-real-dk
  • tinchoz49
  • estebanprimost