semantic-release-yarn
Version:
semantic-release plugin to publish a npm package with yarn
85 lines (84 loc) • 2.48 kB
TypeScript
/// <reference types="node" />
import type { CiEnv } from "env-ci";
import type stream from "node:stream";
import type { Commit, Options } from "semantic-release";
/**
* Define context types. Documentation seems to not be up to date with the
* source code.
*
* Source: https://github.com/semantic-release/semantic-release/blob/master/index.js
* Docs: https://semantic-release.gitbook.io/semantic-release/developer-guide/plugin#context
*/
export type CommonContext = {
cwd: string;
env: typeof process.env;
stdout: stream.Writable;
stderr: stream.Writable;
envCi: CiEnv;
logger: {
error: (...message: string[]) => void;
log: (...message: string[]) => void;
success: (...message: string[]) => void;
};
options: Options;
branches: BranchSpec[];
branch: BranchSpec;
};
export type VerifyConditionsContext = CommonContext;
type CommonContext2 = CommonContext & {
releases: Release[];
};
type GenerateNotesContext1 = CommonContext2 & {
commits: Commit[];
lastRelease: Release;
nextRelease: Release;
};
export type AddChannelContext = CommonContext2 & {
commits: Commit[];
lastRelease: Release;
currentRelease: Release;
nextRelease: Release;
};
type SuccessContext1 = CommonContext2 & {
commits: Commit[];
lastRelease: Release;
nextRelease: Release;
};
type CommonContext3 = CommonContext2 & {
lastRelease: Release;
commits: Commit[];
};
export type AnalyzeCommitsContext = CommonContext3;
type CommonContext4 = CommonContext3 & {
nextRelease: Release;
commits: Commit[];
};
export type VerifyReleaseContext = CommonContext4;
type GenerateNotesContext2 = CommonContext4;
export type GenerateNotesContext = GenerateNotesContext1 | GenerateNotesContext2;
export type PrepareContext = CommonContext4;
export type PublishContext = CommonContext4;
type SuccessContext2 = CommonContext4;
export type SuccessContext = SuccessContext1 | SuccessContext2;
export type FailContext = CommonContext & {
errors: unknown[];
};
export type BranchSpec = {
name: string;
tags?: Tag[];
};
export type Tag = {
version?: string;
channel?: string;
gitTag?: string;
gitHead?: string;
};
export type Release = {
version: string;
type?: "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease" | "build" | undefined;
channel?: string | null;
gitTag?: string;
name?: string;
gitHead?: string;
};
export {};