UNPKG

@cuba-platform/front-generator

Version:
40 lines (39 loc) 1.83 kB
import * as Base from "yeoman-generator"; import { Entity } from "./model/cuba-model"; /** * Remove illegal symbols and normalize class name by standard js notation. * * @param {string} elementName 'my-app-custom' | 'myAppCustom' | 'my app custom' * @returns {string} class name MyAppCustom */ export declare const elementNameToClass: (elementName: string) => string; export declare const capitalizeFirst: (part: string) => string; export declare const unCapitalizeFirst: (part: string) => string; export declare const splitByCapitalLetter: (word: string) => string; export declare function convertToUnixPath(input: string): string; /** * Convert java class fully qualified name to compilable TS class name * * @param fqn java class fqn */ export declare function fqnToName(fqn: string): string; export declare function getEntityModulePath(entity: Entity, prefix?: string): string; export declare function isBlank(str: string | undefined): boolean; /** * Ensure that the path contains only forward slashes and no backward slashes, and has a trailing forward slash. * * @param relPath */ export declare function normalizeRelativePath(relPath: string | undefined): string; /** * The preferable method of throwing an error in Yeoman is using Environment.error() method. * It will prevent execution of the subsequent code, however, TypeScript compiler doesn't know about that. * Therefore, using Environment.error() in a function that returns a value will require e.g. throwing an error manually * or returning an empty value. * In such cases this helper function can be used. It returns `never`, which means that compiler won't consider * the code after this function reachable. * * @param generator * @param error */ export declare function throwError(generator: Pick<Base, 'env'>, error: string): never;