UNPKG

@atomist/automation-client

Version:
51 lines 2.36 kB
import { File } from "../File"; import { FileStream, ProjectAsync } from "../Project"; /** * Promise of an array of files. Usually sourced from Project.streamFiles */ export declare function toPromise(stream: FileStream): Promise<File[]>; /** * Allows conveniently passing one or many glob patterns to utility functions */ export declare type GlobOptions = string | string[]; /** * Does at least one file matching the given predicate exist in this project? * No guarantees about ordering * @param p * @param globPatterns positive and negative globs to match * @param test * @return {Promise<boolean>} */ export declare function fileExists<T>(p: ProjectAsync, globPatterns: GlobOptions, test: (f: File) => boolean): Promise<boolean>; /** * Gather data from a set of files * @param project project to act on * @param globPatterns glob patterns for files to match * @param gather function that saves a value from a file or discards it * by returning undefined * @return {Promise<T>} */ export declare function saveFromFiles<T>(project: ProjectAsync, globPatterns: GlobOptions, gather: (f: File) => T | undefined): Promise<T[]>; /** * Same as saveFromFiles, but works with promise returns * @param {ProjectAsync} project to act on * @param {string} globPatterns glob pattern for files to match * @param {(f: File) => Promise<T>} gather function returning a promise from each file * @return {Promise<T[]>} */ export declare function saveFromFilesAsync<T>(project: ProjectAsync, globPatterns: GlobOptions, gather: (f: File) => Promise<T> | undefined): Promise<T[]>; /** * Perform the same operation on all the files. * @param project project to act on * @param globPatterns glob patterns to match * @param op operation to perform on files. Can return void or a promise. */ export declare function doWithFiles<P extends ProjectAsync>(project: P, globPatterns: GlobOptions, op: (f: File) => void | Promise<any>): Promise<P>; /** * Delete files matching the glob pattern and extra test (if supplied) * @param project project to act on * @param globPatterns glob patterns for files to delete * @param test additional, optional test for files to be deleted */ export declare function deleteFiles<T>(project: ProjectAsync, globPatterns: GlobOptions, test?: (f: File) => boolean): Promise<number>; //# sourceMappingURL=projectUtils.d.ts.map