UNPKG

fixit-cli

Version:
58 lines (57 loc) 2.04 kB
import type { SimpleGit } from 'simple-git'; interface ReleaseInfo { version: string; changelog: string; homeUrl: string; } interface Timer { __start: number; __end: number; start: (msg?: string) => void; stop: () => number; } interface Spinner { start: (msg?: string) => void; stop: (msg?: string, code?: number) => void; message: (msg?: string) => void; } /** * import json file * @param {string} relativePath relative path to json file * @returns {any} json object */ declare function importJson(relativePath: string): any; /** * get latest release info from GitHub API * @param {string} repoOwner repo owner * @param {string} repoName repo name * @example getLatestRelease('hugo-fixit', 'FixIt') * @returns {Promise<ReleaseInfo>} release info */ declare function getLatestRelease(repoOwner: string, repoName: string): Promise<ReleaseInfo>; /** * handle target directory * @param {string} targetDir target directory * @returns {Promise<string>} target directory */ declare function handleTargetDir(targetDir: string): Promise<string>; /** * Modify a file's content using a provided modification function * @param {string} filePath Path to the file to be modified * @param {(data: string) => string} modifyFn Function to modify the file content * @param {Spinner} spinner Spinner instance to show progress * @param {string} message Message to display during the modification */ declare function modifyFile(filePath: string, modifyFn: (data: string) => string, spinner: Spinner, message: string): Promise<void>; /** * Remove the remote origin from a git repository * @param {SimpleGit} git SimpleGit instance * @param {Spinner} spinner Spinner instance to show progress */ declare function removeRemoteOrigin(git: SimpleGit, spinner: Spinner): Promise<void>; /** * Timer object to measure elapsed time * @type {Timer} */ declare const timer: Timer; export { getLatestRelease, handleTargetDir, importJson, modifyFile, ReleaseInfo, removeRemoteOrigin, timer, Timer, };