npm.io
1.0.0 • Published 2 weeks ago

@changesets/parse

Licence
MIT
Version
1.0.0
Deps
2
Size
6 kB
Vulns
0
Weekly
0
Stars
12.3K

@changesets/parse

Open on npmx.dev View changelog

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

Usage

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.