@baseplate-dev/sync
Version:
Library for syncing Baseplate descriptions
43 lines • 1.97 kB
TypeScript
import type { TemplateExtractorGeneratorEntry } from '../configs/index.js';
import type { TemplateExtractorContext } from './template-extractor-context.js';
/**
* The API for the template extractor with helper functions for writing files.
*/
export declare class TemplateExtractorApi {
protected context: TemplateExtractorContext;
protected extractorName: string;
constructor(context: TemplateExtractorContext, extractorName: string);
readOutputFileBuffer(absolutePath: string): Promise<Buffer>;
readOutputFile(absolutePath: string): Promise<string>;
/**
* Gets the generator info for the given generator name.
*
* @param generatorName - The name of the generator.
* @returns The generator info.
*/
getGeneratorInfo(generatorName: string): TemplateExtractorGeneratorEntry;
/**
* Gets the directory of the given generator.
*
* @param generatorName - The name of the generator.
* @returns The directory of the generator.
*/
getGeneratorDirectory(generatorName: string): string;
/**
* Writes a template file to the generator's templates directory.
*
* @param generatorName - The name of the generator.
* @param generatorTemplatePath - The path of the template file in the generator's templates directory.
* @param contents - The contents of the template file.
*/
writeTemplateFile(generatorName: string, generatorTemplatePath: string, contents: string | Buffer): Promise<void>;
/**
* Writes a generated file to the generator's generated directory.
*
* @param generatorName - The name of the generator.
* @param relativePath - The relative path of the file in the generator's generated directory.
* @param contents - The contents of the file.
*/
writeGeneratedFile(generatorName: string, relativePath: string, contents: string | Buffer): Promise<void>;
}
//# sourceMappingURL=template-extractor-api.d.ts.map