Skip to content

@changesets/parse

v1.0.0-next.6RepositoryChangelog

Parse a changeset from its written format to a data object.

Installation

bash
$ pnpm add -D @changesets/parse
bash
$ npm install -D @changesets/parse
bash
$ yarn add -D @changesets/parse

Usage

ts
import { parseChangesetFile } from "@changesets/parse";

const changeset = `---
"pkg-a": minor
"pkg-b": patch
---

A summary of the change`;

const parsedChangeset = parseChangesetFile(changeset);
// {
//   "summary": "A summary of the change",
//   "releases": [
//     { "name": "pkg-a", "type": "minor" },
//     { "name": "pkg-b", "type": "patch" }
//   ]
// }

Note that this does not include the changeset id, but it is normally given as the file name, which parse is not aware of.