Skip to main content
Glama
index.ts1.06 kB
import yaml from "js-yaml"; import { Release, VersionType } from "@changesets/types"; const mdRegex = /\s*---([^]*?)\n\s*---(\s*(?:\n|$)[^]*)/; export default function parseChangesetFile(contents: string): { summary: string; releases: Release[]; } { const execResult = mdRegex.exec(contents); if (!execResult) { throw new Error( `could not parse changeset - invalid frontmatter: ${contents}` ); } let [, roughReleases, roughSummary] = execResult; let summary = roughSummary.trim(); let releases: Release[]; try { const yamlStuff: { [key: string]: VersionType } = yaml.safeLoad(roughReleases); if (yamlStuff) { releases = Object.entries(yamlStuff).map(([name, type]) => ({ name, type, })); } else { releases = []; } } catch (e) { throw new Error( `could not parse changeset - invalid frontmatter: ${contents}` ); } if (!releases) { throw new Error(`could not parse changeset - unknown error: ${contents}`); } return { releases, summary }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ajaystream/hubspot-mcp-custom'

If you have feedback or need assistance with the MCP directory API, please join our Discord server