Changeset creation is the process of declaring release intentions through interactive CLI prompts. This creates markdown files with YAML frontmatter that describe which packages should be released and at what semver level.
The primary CLI command for creating changesets through interactive prompts.
# Create changeset interactively
changeset
changeset add
# Create empty changeset (for CI workflows)
changeset add --empty
# Create changeset and open in external editor
changeset add --openUsage Examples:
# Start interactive changeset creation
changeset
# The CLI will prompt you to:
# 1. Select which packages to include in the changeset
# 2. Choose the type of change (major, minor, patch)
# 3. Write a summary of the changes
# For CI workflows that require changesets but no changes
changeset add --empty
# Create changeset and immediately open in your default editor
changeset add --openThe interactive creation process guides users through declaring their release intentions:
Interactive Steps:
Changeset File Format:
Created changesets are markdown files with YAML frontmatter:
---
"@myorg/ui": minor
"@myorg/utils": patch
---
Add new Button component with improved accessibility features
- New Button component with ARIA support
- Fixed focus management in Modal component
- Updated utility functions for better TypeScript supportDisplays changeset summary before final confirmation.
/**
* Displays changeset summary before confirmation
* @param changeset - Changeset object with releases and summary
* @param repoHasMultiplePackages - Whether repository has multiple packages
*/
function printConfirmationMessage(
changeset: {releases: Array<Release>, summary: string},
repoHasMultiplePackages: boolean
): void;The changeset creation process includes several interactive prompts:
Interactive prompt utilities used throughout the changeset creation process:
/**
* Interactive multi-select prompt with autocomplete
* @param message - Prompt message to display
* @param choices - Array of available choices
* @param format - Optional formatting function for choices
* @returns Promise resolving to array of selected choice values
*/
function askCheckboxPlus(
message: string,
choices: Array<any>,
format?: (arg: any) => any
): Promise<Array<string>>;
/**
* Simple text input prompt
* @param message - Prompt message to display
* @returns Promise resolving to user input string
*/
function askQuestion(message: string): Promise<string>;
/**
* Opens external editor for text input
* @param message - Prompt message to display
* @returns User input string from external editor
*/
function askQuestionWithEditor(message: string): string;
/**
* Yes/no confirmation prompt
* @param message - Confirmation message to display
* @returns Promise resolving to boolean confirmation result
*/
function askConfirm(message: string): Promise<boolean>;
/**
* Single select list prompt
* @param message - Prompt message to display
* @param choices - Array of available choices
* @returns Promise resolving to selected choice
*/
function askList<Choice extends string>(
message: string,
choices: Choice[]
): Promise<Choice>;A typical changeset file contains YAML frontmatter with package versions and a markdown summary:
---
"@myorg/ui": patch
"@myorg/utils": minor
---
Fixed button styling issue and added new utility functions for date formatting.Empty changesets contain no package releases but still satisfy CI requirements:
---
---
This change doesn't require a release.When using the --open flag, changesets will open the created file in the user's configured editor:
changeset add --openFor CI workflows that require changesets but don't need package releases:
changeset add --emptyIf the commit option is configured, changesets will automatically commit the created changeset files:
{
"commit": ["@changesets/cli/commit", { "skipCI": false }]
}--empty)interface Release {
name: string;
type: "major" | "minor" | "patch";
}
interface Package {
packageJson: PackageJSON;
dir: string;
}
interface PackageJSON {
name: string;
version: string;
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
peerDependencies?: Record<string, string>;
}