@focuson/cod
Version:
A command line tool to help with the code on demand
23 lines (22 loc) • 1.03 kB
TypeScript
/// <reference types="node" />
import { ParsedPath } from "path";
export interface PathAndSha {
parsedPath: ParsedPath;
sha: string;
}
export interface ContentAndSha {
content: string;
sha: string;
}
export interface SourceAndTargetDir {
sourceDir: string;
targetDir: string;
}
export declare class Files {
forEachFile<Res>(dir: string): (fn: (file: string) => Promise<Res>) => Promise<Res[]>;
validateDirectoryExists(message: string, dir: string): Promise<void>;
createDirectoryForFile(parsedPath: ParsedPath): Promise<void>;
saveFileIfDoesntExist(parsedPath: ParsedPath, content: string, sha: string): Promise<void>;
copyAndChangeFile(fromFileName: ParsedPath, transformer: (raw: string) => string, toFileName: string): Promise<void>;
copyTransformAndSaveFileForContentAddressableData(fromPath: ParsedPath, transformer: (content: string, file: string) => Promise<string>, toFileNameFn: (parsedPath: ParsedPath, sha: string) => ParsedPath): Promise<PathAndSha>;
}