dt-app
Version:
The Dynatrace App Toolkit is a tool you can use from your command line to create, develop, and deploy apps on your Dynatrace environment.
31 lines (30 loc) • 1.74 kB
TypeScript
import { type FileNamingOptions } from './file-utils';
import { ErrorCause } from './errors';
export type CwdOption = {
/** The current working directory */
cwd: string;
};
interface SearchOption extends Omit<FileNamingOptions, 'suffix'>, Partial<Pick<FileNamingOptions, 'suffix'>> {
/** Relative path where the files are located */
folder?: string;
}
type FileSearchOption = SearchOption & CwdOption;
/**
* Checks if a file with the provided name and suffix exists in the specified folder
* If suffix is not provided, the argument name is assumed to already include the extension
* @param fileSearch Object containing options for building and searching file
* @returns True or false depending on whether file was found
*/
export declare function checkIfFileExists(fileSearch: FileSearchOption): boolean;
/**
* Checks the existence of a file in a specified location.
* If suffix is not provided, the argument name is assumed to already include the extension
* If the file is not found, we will prompt the user for creating the file with a default template.
* If the user does not accept the creation and errorCauseType was set. We will throw an error
* @param FileSearchOption Object containing options for building and searching file
* @param template The template (Default values) we will use, in case of an error, to construct the file
* @param errorCauseType Error type to display in case of error.
* If this value is set, and the file was not found and not created after the prompt, we will throw an error.
*/
export declare function checkIfExistsAndPromptIfNot(FileSearchOption: FileSearchOption, template: Record<string, unknown>, errorCauseType?: keyof typeof ErrorCause): Promise<boolean>;
export {};