Skip to content

Changesets

Terminal window
npm i -D @unirelman/plugin-changesets
unirelman.config.ts
import { createChangesetsPlugin } from "@unirelman/plugin-changesets";
createChangesetsPlugin();
Phase Behavior
getChanges Reads the changesets of .unirelman/changesets/. Each changeset gives one change per listed scope.
generateFileOperations Deletes the changesets of the changes being released.
.unirelman/changesets/1767268800000-1f2e3d4c.md
---
scopes: @example/core,@example/ui
level: minor
---
add a feature
Part Format
scopes Comma-separated scope names, each one a scope the plugin is registered for.
level patch, minor or major, case-insensitive.
Body Message of the change, non-empty.

A changeset is a .md file with a frontmatter block delimited by ---. Its filename is free.

Creates a changeset in .unirelman/changesets/, named <timestamp>-<random>.md.

Terminal window
unirelman changesets create [--scopes <scopes>] [--level <level>] [--message <message>]
Option Description
--scopes Comma-separated scope names, such as @example/core,@example/ui. Prompted when missing.
--level Level of the change, case-insensitive. Prompted when missing.
--message Message of the change. Prompted when missing.

With --json, the command prints this document, validated by changesetsCreateOutputSchema from @unirelman/plugin-changesets:

{
"path": ".unirelman/changesets/1767268800000-1f2e3d4c.md",
"scopes": ["@example/core"],
"level": "minor",
"message": "add a feature"
}
Field Type Description
path string Path of the changeset, relative to the project root.
scopes string[] Scopes of the changeset.
level "patch" | "minor" | "major" Level of the changeset.
message string Message of the changeset.

Changes from this plugin carry meta.changesets.path, the filename of their changeset. The exported type guard checks it:

import { isChangesetsChangeMeta } from "@unirelman/plugin-changesets";
Error Cause
ChangesetsInvalidScopesError --scopes, or a changeset, lists a scope the plugin is not registered for.
ChangesetsInvalidLevelError --level, or the level of a changeset, is other than patch, minor or major.
ChangesetsMissingFrontmatterError A changeset has no frontmatter block delimited by ---.
ChangesetsMissingFieldError A changeset has no scopes, no level, or no message.
ChangesetsInvalidFileError A changeset is invalid. Its cause is one of the errors of this table, and its filePath the file.