import { PinionContext, Callable } from '../core.js'; import { WriteFileOptions } from './helpers.js'; export type FileNameOptions = { createFolders: boolean; prompt: string; }; declare const fileName: (options: FileNameOptions) => (...targets: Callable[]) => { (ctx: C): Promise; file: FileNameOptions; }; export type FileCallable = ReturnType>; export declare const file: (...targets: Callable[]) => { (ctx: C): Promise; file: FileNameOptions; }; export declare const toFile: (...targets: Callable[]) => { (ctx: C): Promise; file: FileNameOptions; }; export declare const fromFile: (...targets: Callable[]) => { (ctx: C): Promise; file: FileNameOptions; }; export type JSONData = { [key: string]: any; }; /** * Recursively copy all files from a folder to a destination. * Will prompt if the to file already exists. * * @param from The (local) folder to copy files from * @param to The destination to copy the files to * @param options File copy options (e.g. `{ force: true }`) * @returns The current context */ export declare const copyFiles: (from: Callable, to: Callable, options?: Partial) => (ctx: C) => Promise; /** * Load a JSON file and merge the data into the context * * @param file The name of the JSON file * @param converter A converter that returns the data that will be merged into the context * @returns The current context */ export declare const loadJSON: (file: Callable, converter?: (data: JSONData, ctx: C) => X, fallback?: Callable) => (ctx: C) => Promise; /** * Write formatted JSON to a file * * @param json The JSON data to write * @param file The filename to write to * @returns The current context */ export declare const writeJSON: (json: Callable, file: Callable, options?: Partial) => (ctx: C) => Promise; /** * Merge an existing JSON file with new data * * @param json The JSON data to add to the file * @param file The filename to write to * @returns The current context */ export declare const mergeJSON: (json: Callable, file: Callable) => (ctx: C) => Promise; export {};