@baseplate-dev/sync
Version:
Library for syncing Baseplate descriptions
91 lines • 2.71 kB
TypeScript
import type { Logger } from '#src/utils/evented-logger.js';
import type { GeneratorOutput } from './generator-task-output.js';
import type { FailedCommandInfo } from './post-write-commands/index.js';
import type { OverwriteOptions, PreviousGeneratedPayload } from './prepare-generator-files/index.js';
/**
* Options for writing the generator output
*/
export interface WriteGeneratorOutputOptions {
/**
* Payload for the previously generated codebase
*/
previousGeneratedPayload?: PreviousGeneratedPayload;
/**
* Optional directory to write the generated contents to
*/
generatedContentsDirectory?: string;
/**
* Commands to re-run if there are conflicts
*/
rerunCommands?: string[];
/**
* Logger to use
*/
logger?: Logger;
/**
* The merge driver to use following the custom merge driver command for custom Git merge drivers
* instead of the default 3-way merge driver.
*
* See https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
*/
mergeDriver?: {
name: string;
driver: string;
};
/**
* Abort signal to use for cancelling the write operation.
*/
abortSignal?: AbortSignal;
/**
* Whether to skip running commands.
*/
skipCommands?: boolean;
/**
* Options for overwriting files.
*/
overwriteOptions?: OverwriteOptions;
}
/**
* A file that had a conflict
*/
export interface FileWithConflict {
/**
* The relative path of the file
*/
relativePath: string;
/**
* The relative path of the generated file that had the conflict
*/
generatedConflictRelativePath?: string;
/**
* The type of conflict
*/
conflictType: 'merge-conflict' | 'working-deleted' | 'generated-deleted';
}
/**
* Result of the write generator output operation
*/
export interface WriteGeneratorOutputResult {
/**
* Map of file IDs to relative paths
*/
fileIdToRelativePathMap: Map<string, string>;
/**
* Files that had conflicts
*/
filesWithConflicts: FileWithConflict[];
/**
* Commands that failed to run
*/
failedCommands: FailedCommandInfo[];
}
/**
* Write the generator output to the output directory
*
* @param output - The generator output to write
* @param outputDirectory - The directory to write the output to
* @param options - The write options
* @returns The result of the write operation
*/
export declare function writeGeneratorOutput(output: GeneratorOutput, outputDirectory: string, options?: WriteGeneratorOutputOptions): Promise<WriteGeneratorOutputResult>;
//# sourceMappingURL=write-generator-output.d.ts.map