changeset_reader.ts view source
ChangesetInfo filename
stringpackages
Array<{name: string; bump_type: BumpType}>summary
stringChangeset parsing and version prediction from
.changeset/*.mdfiles.Reads changesets to determine which packages need publishing and their version bumps. For auto-generating changesets during publishing, see changeset_generator.ts.
7 declarations
changeset_reader.ts view source
ChangesetInfo filenamestringpackagesArray<{name: string; bump_type: BumpType}>summarystringchangeset_reader.ts view source
(changesets: ChangesetInfo[], package_name: string): BumpType | null Determines the bump type for a package from its changesets.
When multiple changesets exist for the same package, returns the highest bump type (major > minor > patch) to ensure the most significant change is reflected in the version bump.
changesetsChangesetInfo[]package_namestringBumpType | null the highest bump type, or null if package has no changesets
changeset_reader.ts view source
(repo: LocalRepo): Promise<boolean> Checks if a repo has any changeset files (excluding README.md).
Used by preflight checks and publishing workflow to determine which packages need to be published. Returns false if .changeset directory doesn't exist or contains only README.md.
repoPromise<boolean> true if repo has unpublished changesets
changeset_reader.ts view source
(content: string, filename?: string): ChangesetInfo | null Parses changeset content string from markdown format.
Pure function for testability - no file I/O, just string parsing. Extracts package names, bump types, and summary from YAML frontmatter format. Returns null if format is invalid or no packages found.
Expected format: --- "package-name": patch "@scope/package": minor ---
Summary of changes
contentchangeset markdown with YAML frontmatter
stringfilenameoptional filename for error reporting context
string'changeset.md'ChangesetInfo | null parsed changeset info or null if invalid format
changeset_reader.ts view source
(filepath: string, log?: Logger | undefined): Promise<ChangesetInfo | null> filepathstringlog?Logger | undefinedPromise<ChangesetInfo | null> changeset_reader.ts view source
(repo: LocalRepo, log?: Logger | undefined): Promise<{ version: string; bump_type: BumpType; } | null> Predicts the next version by analyzing all changesets in a repo.
Reads all changesets, determines the highest bump type for the package, and calculates the next version. Returns null if no changesets found.
Critical for dry-run mode accuracy - allows simulating publishes without
actually running gro publish which consumes changesets.
repolog?Logger | undefinedPromise<{ version: string; bump_type: BumpType; } | null> predicted version and bump type, or null if no changesets
changeset_reader.ts view source
(repo: LocalRepo, log?: Logger | undefined): Promise<ChangesetInfo[]> repolog?Logger | undefinedPromise<ChangesetInfo[]>