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.
51 lines (50 loc) • 2.29 kB
TypeScript
export declare const INVALID_FILENAME = "The intended action name is not allowed. Names can only contain:\n - ASCII letters & numbers\n - underscore (_)\n - dot (.)\n - and hyphen (-)\n but they can only start with either underscore (_) or letters and cannot end with hyphen (-) or dot (.)\n ";
/**
* Get the filename without extension for a given path
* @param path to a file
* @returns filename without extension
*/
export declare function getFileName(path: string): string;
/**
* Removes a file or directory if it exists
* @param path to a file or directory
*/
export declare function rm(path: string): void;
/**
* Creates a folder, if it does not exist
* @remark not real mkdir -p! only one level! To have multi-level we should use the package node-mkdirp
* @param path folder path
*/
export declare function mkdirp(path: string): void;
export interface FileNamingOptions {
/** The name of the entity (function, action, widget, etc.) to be converted into a file name. */
name: string;
/** The suffix to be appended to the file name. */
suffix: string;
/** A flag indicating whether nested directories are allowed in the file name. */
allowNested?: boolean;
/** Flag that indicates whether the filename should be formatted to a kebab case */
overrideNameWithKebabCase?: boolean;
}
/** Converts the provided name into a file name by appending the provided suffix and optionally allowing nested directories. */
export declare function nameToFileName({ name, suffix, allowNested, }: FileNamingOptions): string;
interface TSConfig {
compilerOptions: {
typeRoots: string[];
[key: string]: unknown;
};
[key: string]: unknown;
}
/**
* @param directory where tsconfig file will be located
* @param tsconfig tsconfig to be updated
* @returns tsconfig that has updated typeRoots property
*/
export declare function updateTsConfigTypeRoots(dir: string, tsconfig: TSConfig): TSConfig;
/**
* Validates whether the name for the new action/function contain valid characters
* @param name The name we want to validate
* @returns True if name contain allowed characters
*/
export declare function checkIfNameIsValid(name: string): boolean;
export {};