UNPKG

@adonisjs/ace

Version:

Commandline apps framework used by AdonisJs

58 lines (57 loc) 1.6 kB
import { GeneratorFileOptions, GeneratorFileContract } from '../Contracts'; /** * Exposes the API to construct the output file content, path * and template source. */ export declare class GeneratorFile implements GeneratorFileContract { private name; private options; private stubContents; private isStubRaw; private templateData; private customDestinationPath?; private customAppRoot?; private mustache; state: 'persisted' | 'removed' | 'pending'; constructor(name: string, options?: GeneratorFileOptions); /** * Returns relative path for the file. Useful for * printing log info */ private getFileRelativePath; /** * Set stub for the contents source. When `raw` is true, then string * is considered as the raw content and not the file path. */ stub(fileOrContents: string, options?: { raw: boolean; }): this; /** * Optionally define destination directory from the project root. */ destinationDir(directory: string): this; /** * Define `appRoot`. This is just to shorten the logged * file names. For example: */ appRoot(directory: string): this; /** * Instruct to use mustache */ useMustache(): this; /** * Variables for stub subsitution */ apply(contents: any): this; /** * Returns the file json */ toJSON(): { filename: string; filepath: string; relativepath: string; extension: string; contents: any; state: "persisted" | "removed" | "pending"; }; }