UNPKG

1.28 kBTypeScriptView Raw
1import { file } from 'mrm-core';
2import { File } from '../Base/File';
3/**
4 * Exposes the API to generate source files from template files.
5 */
6export declare class MustacheFile extends File {
7 private templatePath;
8 private partialsPaths;
9 private templateData;
10 protected actions: never[];
11 filePointer: ReturnType<typeof file>;
12 removeOnRollback: boolean;
13 overwrite: boolean;
14 constructor(basePath: string, filename: string, templatePath: string);
15 /**
16 * Returns a key-value pair of partial names and their contents
17 */
18 private getPartials;
19 /**
20 * Returns the contents of the template file
21 */
22 private readTemplate;
23 /**
24 * Returns existing contents for a template file
25 */
26 get(): string;
27 /**
28 * A boolean telling if the file already exists
29 */
30 exists(): boolean;
31 /**
32 * Define one or more partials by defining key-value
33 * pair of partial name and path to the file.
34 */
35 partials(partials: {
36 [key: string]: string;
37 }): this;
38 /**
39 * Apply contents to the template to evaluate it's output
40 */
41 apply(contents?: any): this;
42 /**
43 * Commit changes
44 */
45 commit(): void;
46 /**
47 * Rollback changes
48 */
49 rollback(): void;
50}