import { type MemFsEditor } from 'mem-fs-editor'; import type { BaseGenerator } from '../generator.js'; type ExtractOverload1 = T extends { (...args: infer P): infer R; (...args: any[]): any; (...args: any[]): any; (...args: any[]): any; } ? (...args: P) => R : never; type ExtractOverload2 = T extends { (...args: any[]): any; (...args: infer P): infer R; (...args: any[]): any; (...args: any[]): any; } ? (...args: P) => R : never; type ReadOverload1 = ExtractOverload1; type ReadOverload2 = ExtractOverload2; type ReadJSONOverload1 = ExtractOverload1; type ReadJSONOverload2 = ExtractOverload2; export type Template[2]>> = { /** * Template file, absolute or relative to templatePath(). */ source: string; /** * Conditional if the template should be written. * @param TemplateData * @param Generator * @returns */ when?: (data: D, generator: G) => boolean; /** * Destination, absolute or relative to destinationPath(). */ destination?: string; /** * Mem-fs-editor copy options */ copyOptions?: NonNullable[3]>; /** * Ejs data */ templateData?: string | D; }; export type Templates[2]>> = Array>; export declare class FsMixin { fs: MemFsEditor; /** * Read file from templates folder. * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.read(this.templatePath(filepath)) */ readTemplate(this: BaseGenerator, ...args: Parameters): ReturnType; readTemplate(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Copy file from templates folder to destination folder. * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.copy(this.templatePath(from), this.destinationPath(to)) */ copyTemplate(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Copy file from templates folder to destination folder. * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.copy(this.templatePath(from), this.destinationPath(to)) */ copyTemplateAsync(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Read file from destination folder * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.read(this.destinationPath(filepath)). */ readDestination(this: BaseGenerator, ...args: Parameters): ReturnType; readDestination(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Read JSON file from destination folder * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.readJSON(this.destinationPath(filepath)). */ readDestinationJSON(this: BaseGenerator, ...args: Parameters): ReturnType; readDestinationJSON(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Write file to destination folder * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.write(this.destinationPath(filepath)). */ writeDestination(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Write json file to destination folder * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.writeJSON(this.destinationPath(filepath)). */ writeDestinationJSON(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Delete file from destination folder * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.delete(this.destinationPath(filepath)). */ deleteDestination(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Copy file from destination folder to another destination folder. * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.copy(this.destinationPath(from), this.destinationPath(to)). */ copyDestination(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Move file from destination folder to another destination folder. * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.move(this.destinationPath(from), this.destinationPath(to)). */ moveDestination(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Exists file on destination folder. * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}. * Shortcut for this.fs!.exists(this.destinationPath(filepath)). */ existsDestination(this: BaseGenerator, ...args: Parameters): ReturnType; /** * Copy a template from templates folder to the destination. * * @param source - template file, absolute or relative to templatePath(). * @param destination - destination, absolute or relative to destinationPath(). * @param templateData - ejs data * @param templateOptions - ejs options * @param copyOptions - mem-fs-editor copy options */ renderTemplate[2]>>(this: BaseGenerator, source?: string | string[], destination?: string | string[], templateData?: string | D, copyOptions?: NonNullable[3]>): void; /** * Copy a template from templates folder to the destination. * * @param source - template file, absolute or relative to templatePath(). * @param destination - destination, absolute or relative to destinationPath(). * @param templateData - ejs data * @param templateOptions - ejs options * @param copyOptions - mem-fs-editor copy options */ renderTemplateAsync[2]>>(this: BaseGenerator, source?: string | string[], destination?: string | string[], templateData?: string | D, copyOptions?: NonNullable[3]>): Promise; /** * Copy templates from templates folder to the destination. */ renderTemplates[2]>>(this: BaseGenerator, templates: Templates, templateData?: string | D): void; /** * Copy templates from templates folder to the destination. * * @param templates - template file, absolute or relative to templatePath(). * @param templateData - ejs data */ renderTemplatesAsync[2]>>(this: BaseGenerator, templates: Templates, templateData?: string | D): Promise; /** * Utility method to get a formatted data for templates. * * @param path - path to the storage key. * @return data to be passed to the templates. */ _templateData(this: BaseGenerator, path?: string): any; } export {};