@sprucelabs/spruce-skill-utils
Version:
Loosely coupled classes and functions to make skill development faster! 🏎
40 lines (39 loc) • 1.89 kB
TypeScript
export interface CreateFile {
/** The relative path from the cwd, without a leading forward slash */
relativePath: string;
/** The file contents, built with the template data */
contents: string;
}
declare const diskUtil: {
writeFile(destination: string, contents: string | NodeJS.ArrayBufferView): void;
readDir(destination: string): string[];
readFile(source: string): string;
deleteFile(destination: string): void;
createDir(destination: string): void;
moveDir(source: string, destination: string): void;
moveFile(source: string, destination: string): void;
copyDir(source: string, destination: string): Promise<unknown>;
deleteDir(target: string): void;
doesFileExist(target: string): boolean;
isDir(target: string): boolean;
isDirPath(path: string): boolean;
isFile(target: string): boolean;
doesDirExist(target: string): boolean;
resolveHashSprucePath(cwd: string, ...filePath: string[]): string;
doesHashSprucePathExist(cwd: string, ...filePath: string[]): boolean;
resolveBuiltHashSprucePath(cwd: string, ...filePath: string[]): string;
doesBuiltHashSprucePathExist(cwd: string, ...filePath: string[]): boolean;
isFileDifferent(destination: string, contents: string): boolean;
deleteEmptyDirs(dir: string): void;
resolvePath(cwd: string, ...filePath: string[]): string;
resolveRelativePath(path1: string, path2: string): string;
resolveFile(...pathItems: string[]): string | false;
createTempDir(...files: string[]): string;
createRandomTempDir(): string;
hasFileChanged(...filePath: string[]): boolean;
markFileAsUnchanged(...filePath: string[]): void;
resolveCacheDirForDir(dir: string): string;
resolveFileInHashSpruceDir(cwd: string, ...filePath: string[]): string;
getFileChangedCacheFile(file: string): string;
};
export default diskUtil;