diff --git a/src/generate/form.ts b/src/generate/form.ts index be71c60..8691332 100644 --- a/src/generate/form.ts +++ b/src/generate/form.ts @@ -17,9 +17,9 @@ type CreateTemplateProps = { /** * Create a template based on the schematic - * @param schematic - * @param path - * @param method + * @param schematic - the schematic to create + * @param path - the path to create the schematic + * @param method - the http method * @returns the file created */ export const createTemplate = async ({ diff --git a/src/generate/utils/nonopininated-cmd.ts b/src/generate/utils/nonopininated-cmd.ts index b4539e3..2a3f44b 100644 --- a/src/generate/utils/nonopininated-cmd.ts +++ b/src/generate/utils/nonopininated-cmd.ts @@ -14,6 +14,13 @@ import { writeTemplate, } from "./command-utils"; +/** + * Process the non-opinionated command + * @param schematic - The schematic + * @param target - The target + * @param method - The method + * @param expressoConfig - The expresso config + */ export async function nonOpinionatedProcess( schematic: string, target: string, diff --git a/src/generate/utils/opinionated-cmd.ts b/src/generate/utils/opinionated-cmd.ts index c41d823..2688eb1 100644 --- a/src/generate/utils/opinionated-cmd.ts +++ b/src/generate/utils/opinionated-cmd.ts @@ -16,9 +16,21 @@ import { writeTemplate, } from "./command-utils"; import { addControllerToModule } from "../../utils/add-controller-to-module"; -import { addModuleToContainer, addModuleToContainerNestedPath } from "../../utils/add-module-to-container"; +import { + addModuleToContainer, + addModuleToContainerNestedPath, +} from "../../utils/add-module-to-container"; import { ExpressoConfig } from "../../@types"; +/** + * Process commands for opinionated service scaffolding + * @param schematic - Resource to scaffold + * @param target - Target path + * @param method - HTTP method + * @param expressoConfig - Expresso configuration [expressots.config.ts] + * @param pathStyle - Path command style [sugar, nested, single] + * @returns + */ export async function opinionatedProcess( schematic: string, target: string, @@ -73,7 +85,6 @@ export async function opinionatedProcess( }); if (pathStyle === PathStyle.Sugar) { - console.log("Sugar"); await generateModuleServiceSugarPath( f.outputPath, m.className, @@ -83,7 +94,6 @@ export async function opinionatedProcess( m.folderToScaffold, ); } else if (pathStyle === PathStyle.Nested) { - console.log("Nested"); await generateModuleServiceNestedPath( f.outputPath, m.className, @@ -91,7 +101,6 @@ export async function opinionatedProcess( m.folderToScaffold, ); } else if (pathStyle === PathStyle.Single) { - console.log("Single"); await generateModuleServiceSinglePath( f.outputPath, m.className, @@ -284,6 +293,14 @@ async function generateUseCaseService( }); } +/** + * Generate a use case + * @param outputPath - The output path + * @param className - The class name + * @param moduleName - The module name + * @param path - The path + * @param fileName - The file name + */ async function generateUseCase( outputPath: string, className: string, @@ -444,7 +461,7 @@ async function generateMiddleware( } /** - * Generate a module for service scaffolding + * Generate a module for service scaffolding with sugar path * @param outputPath - The output path * @param className - The class name * @param moduleName - The module name @@ -507,6 +524,13 @@ async function generateModuleServiceSugarPath( ); } +/** + * Generate a module for service scaffolding with single path + * @param outputPath - The output path + * @param className - The class name + * @param moduleName - The module name + * @param path - The path + */ async function generateModuleServiceSinglePath( outputPathController: string, className: string, @@ -562,13 +586,21 @@ async function generateModuleServiceSinglePath( ); } +/** + * Generate a module for service scaffolding with nested path + * @param outputPathController + * @param className + * @param path + * @param folderToScaffold + * @returns + */ async function generateModuleServiceNestedPath( outputPathController: string, className: string, path: string, folderToScaffold: string, ): Promise { - const moduleFileName = nodePath.basename(path, '/'); + const moduleFileName = nodePath.basename(path, "/"); const newModulePath = nodePath .join(folderToScaffold, path, "..") .normalize();