Skip to content

valeriobelli/changesets-changelog-entry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

changesets-changelog-entry

This library extracts the logic of internal functions of https://github.com/changesets/action to be consumed externally. It offers two ways of consumption:

  • CLI
  • library

Installation

yarn add --dev changesets-changelog-entry

Usage

CLI

yarn changesets-changelog-entry ./pathname/to/changelog.md @megacorpinc/example-lib@1.0.0-evil

Library

const { getChangelogEntry, getChangelogEntryFromFile } = require('changesets-changelog-entry')

const changelog = `# @megacorpinc/example-lib

## 1.0.0-evil

### Major changes

- Destroy the earth
`

const entryFromStringContent = getChangelogEntry(changelog, '1.0.0-evil')

console.log(entryFromStringContent.content)
console.log(entryFromStringContent.highestLevel)

const entryFromFile = getChangelogEntryFromFile('./CHANGELOG.md', '1.0.0-evil')

console.log(entryFromFile.content)
console.log(entryFromFile.highestLevel)