Skip to content

Commit

Permalink
fix: controller path when importing it to the module (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorCaminha authored Aug 5, 2023
1 parent 063d367 commit 98b340a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/generate/form.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path, * as nodePath from "path";
import * as nodePath from "path";
import { mkdirSync, readFileSync } from "node:fs";
import { render } from "mustache";
import { writeFileSync, existsSync } from "fs";
Expand Down Expand Up @@ -166,7 +166,7 @@ export const createTemplate = async ({
} else if (pathCount === 2) {
controllerPath += `${path.split("/")[1]}/${file.slice(0, file.lastIndexOf('.'))}`;
} else {
const segments: string[] = path.split("/");
const segments: string[] = path.split("/").filter((segment) => segment !== "");
controllerPath += `${segments[segments.length-1]}/${file.slice(0, file.lastIndexOf('.'))}`;
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/templates/module.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CreateModule } from "@expressots/core";
import { {{className}}Controller } from "./{{{path}}}";
import { {{className}}Controller } from "{{{path}}}";

const {{moduleName}}Module = CreateModule([{{className}}Controller]);

Expand Down

0 comments on commit 98b340a

Please sign in to comment.