UNPKG

@ossjs/release

Version:

Minimalistic, opinionated, and predictable release automation tool.

41 lines (35 loc) 856 B
import type { GitInfo } from '#/src/utils/git/get-info.js' import type { TagPointer } from '#/src/utils/git/get-tag.js' export interface ReleaseContext { repo: GitInfo latestRelease?: TagPointer nextRelease: { version: string readonly tag: string publishedAt: Date } } export interface ReleaseContextInput { repo: GitInfo latestRelease?: TagPointer nextRelease: { version: string publishedAt: Date } } export function createContext(input: ReleaseContextInput): ReleaseContext { const context: ReleaseContext = { repo: input.repo, latestRelease: input.latestRelease || undefined, nextRelease: { ...input.nextRelease, tag: null as any, }, } Object.defineProperty(context.nextRelease, 'tag', { get() { return `v${context.nextRelease.version}` }, }) return context }