UNPKG

kist

Version:

Package Pipeline Processor

46 lines (45 loc) 1.91 kB
import { Action } from "../../core/pipeline/Action"; import { ActionOptionsType } from "../../types"; /** * VersionWriteAction is a step action responsible for replacing a version * string in one or more specified files. The version is located and replaced * based on a specified key and pattern. */ export declare class VersionWriteAction extends Action { /** * Executes the version writing action. * @param options - The options specific to version writing, including the * files, key, and version string or a flag to retrieve it from * `package.json`. * @returns A Promise that resolves when the version has been successfully * replaced in all specified files, or rejects with an error if the * action fails. */ execute(options: ActionOptionsType): Promise<void>; /** * Retrieves the version string from the `package.json` file. * @returns A promise that resolves to the version string or `undefined` * if not found. * @throws {Error} Throws an error if `package.json` cannot be read. */ private getVersionFromPackageJson; /** * Replaces a version string in a file for a specific key. * This method reads the file, replaces the version for the key, and * writes the updated content back to the file. * * @param filePath - The file path where the version should be replaced. * @param version - The new version string to replace in the file. * @param key - The key prefix that identifies the version line (e.g., * `version:`). * @returns A promise that resolves when the version has been successfully * replaced. * @throws {Error} Throws an error if reading or writing the file fails. */ private replaceVersionInFile; /** * Provides a description of the action. * @returns A string description of the action. */ describe(): string; }