UNPKG

@expressots/cli

Version:

Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)

124 lines (123 loc) 3.13 kB
import { ExpressoConfig } from "@expressots/shared"; export declare const enum PathStyle { None = "none", Single = "single", Nested = "nested", Sugar = "sugar" } /** * File preparation * @param schematic * @param target * @param method * @param opinionated * @param sourceRoot * @returns the file output */ export type FilePreparation = { schematic: string; target: string; method: string; expressoConfig: ExpressoConfig; }; /** * File output * @param path * @param file * @param className * @param moduleName * @param modulePath * @param outputPath * @param folderToScaffold */ export type FileOutput = { path: string; file: string; className: string; moduleName: string; modulePath: string; outputPath: string; folderToScaffold: string; fileName: string; schematic: string; }; /** * Create a template based on the schematic * @param fp * @returns the file created */ export declare function validateAndPrepareFile(fp: FilePreparation): Promise<{ path: string; file: string; className: string; moduleName: string; modulePath: string; outputPath: string; folderToScaffold: string; fileName: string; schematic: string; }>; /** * Get the file name without the extension * @param filePath * @returns the file name */ export declare function getFileNameWithoutExtension(filePath: string): string; /** * Split the target into path, file, class name, module name and module path * @param target * @param schematic * @returns the split target */ export declare const splitTarget: ({ target, schematic, }: { target: string; schematic: string; }) => Promise<{ path: string; file: string; className: string; moduleName: string; modulePath: string; }>; /** * Write the template based on the http method * @param method - the http method * @returns decorator - the decorator to be used */ export declare const getHttpMethod: (method: string) => string; /** * Write the template based on the schematics * @param outputPath - the output path * @param template - the template to be used * @returns void */ export declare const writeTemplate: ({ outputPath, template: { path, data }, }: { outputPath: string; template: { path: string; data: Record<string, string>; }; }) => void; /** * Returns the folder where the schematic should be placed * @param schematic */ export declare const schematicFolder: (schematic: string) => string | undefined; /** * Get the name with the scaffold pattern * @param name * @returns the name in the scaffold pattern */ export declare const getNameWithScaffoldPattern: (name: string) => Promise<string>; /** * Extract the first word from a file and convert it to the scaffold pattern * @param file * @returns the first word in the scaffold pattern */ export declare function extractFirstWord(file: string): Promise<string>; /** * Check if the path is a nested path, a single path or a sugar path * @param path * @returns the path style */ export declare const checkPathStyle: (path: string) => PathStyle;