europa-build
Version:
Tool for generating and maintaining Europa plugins and presets
103 lines (102 loc) • 4.73 kB
TypeScript
import { Logger } from 'winston';
import { ScriptProvider } from "./ScriptProvider";
declare const _logger: unique symbol;
/**
* An abstract {@link ScriptProvider} that provides common logic across the majority of implementations.
*/
export declare abstract class CommonScriptProvider implements ScriptProvider {
private readonly [_logger];
/**
* Creates an instance of {@link CommonScriptProvider} using the `options` provided.
*
* @param options - The options to be used.
*/
protected constructor(options: CommonScriptProviderOptions);
afterScript(directoryPath: string): Promise<void>;
/**
* Copies the specified bundled config file to the directory provided.
*
* @param directoryPath - The path of the directory to which the bundled config file is to be copied.
* @param fileName - The name of the bundled config file to be copied.
* @throws If an error occurs while attempting to copy the bundled config file.
*/
protected copyBundledConfigFile(directoryPath: string, fileName: string): Promise<void>;
/**
* Copies the specified bundled config files to the directory provided.
*
* @param directoryPath - The path of the directory to which the bundled config files are to be copied.
* @param fileNames - The names of the bundled config files to be copied.
* @throws If an error occurs while attempting to copy any bundled config file.
*/
protected copyBundledConfigFiles(directoryPath: string, fileNames: string[]): Promise<void>;
/**
* Deletes the subdirectories at the specified path within the directory provided.
*
* @param directoryPath - The path of the directory to which `subdirectoryPaths` are resolved.
* @param subdirectoryPaths - The paths of the subdirectories to be deleted relative to `directoryPath`
* @throws If an error occurs while attempting to delete any subdirectory.
*/
protected deleteDirectories(directoryPath: string, subdirectoryPaths: string[]): Promise<void>;
/**
* Deletes the subdirectory at the specified path within the directory provided.
*
* @param directoryPath - The path of the directory to which `subdirectoryPath` is resolved.
* @param subdirectoryPath - The path of the subdirectory to be deleted relative to `directoryPath`
* @throws If an error occurs while attempting to delete the subdirectory.
*/
protected deleteDirectory(directoryPath: string, subdirectoryPath: string): Promise<void>;
/**
* Deletes the file at the specified path within the directory provided.
*
* @param directoryPath - The path of the directory to which `filePath` is resolved.
* @param filePath - The path of the file to be deleted relative to `directoryPath`
* @throws If an error occurs while attempting to delete the file.
*/
protected deleteFile(directoryPath: string, filePath: string): Promise<void>;
/**
* Deletes the files at the specified paths within the directory provided.
*
* @param directoryPath - The path of the directory to which `filePaths` are resolved.
* @param filePaths - The paths of the files to be deleted relative to `directoryPath`
* @throws If an error occurs while attempting to delete any file.
*/
protected deleteFiles(directoryPath: string, filePaths: string[]): Promise<void>;
/**
* Returns the absolute path of the bundled config file with the specified name.
*
* @param fileName - The name of the bundled config file to be resolved.
* @return The absolute path of the bundled config file.
*/
protected getBundledConfigFilePath(fileName: string): Promise<string>;
/**
* Returns the absolute path of the bundled file/directory at the specified paths.
*
* @param filePaths - The paths of the bundled file/directory to be resolved.
* @return The absolute path of the bundled file/directory.
*/
protected getBundledPath(...filePaths: string[]): Promise<string>;
/**
* Returns the logger for this {@link CommonScriptProvider}.
*
* @return The logger.
*/
protected getLogger(): Logger;
/**
* Returns the name of the logger to be created for this {@link CommonScriptProvider}.
*
* @return The logger name.
*/
protected abstract getLoggerName(): string;
abstract getName(): string;
abstract runScript(directoryPath: string): Promise<void>;
}
/**
* The options used by {@link CommonScriptProvider}.
*/
export declare type CommonScriptProviderOptions = {
/**
* The parent logger to be used to create any children loggers.
*/
readonly parentLogger: Logger;
};
export {};