@expressots/cli 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- /* import { AppContainer } from "@expressots/core";
4
- import { AppModule } from "./app.module";
5
- import { UserModule } from "@useCases/user/user.module";
6
-
3
+ //import { AppContainer } from "@expressots/core";
4
+ /*
7
5
  const appContainer = new AppContainer();
8
6
 
9
- const container = appContainer.create([// Add your modules here
10
- AppModule, UserModule]);
11
-
12
- export { container };
7
+ const container = appContainer.create([// Add your modules here, UserModule, UserModule, UserModule]);
13
8
 
14
- */
9
+ export { container };*/
@@ -183,20 +183,20 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
183
183
  moduleOutPath = `${usecaseDir}/${moduleName}/${moduleName}.module.ts`;
184
184
  }
185
185
  }
186
- let controllerPath = "";
186
+ let controllerPath = "./";
187
187
  const pathCount = (path.split("/")).length;
188
188
  if (path === "") {
189
- controllerPath = `${file.slice(0, file.lastIndexOf('.'))}`;
189
+ controllerPath += `${file.slice(0, file.lastIndexOf('.'))}`;
190
190
  }
191
191
  else if (pathCount === 1) {
192
- controllerPath = `${path}/${file.slice(0, file.lastIndexOf('.'))}`;
192
+ controllerPath += `${path}/${file.slice(0, file.lastIndexOf('.'))}`;
193
193
  }
194
194
  else if (pathCount === 2) {
195
- controllerPath = `${path.split("/")[1]}/${file.slice(0, file.lastIndexOf('.'))}`;
195
+ controllerPath += `${path.split("/")[1]}/${file.slice(0, file.lastIndexOf('.'))}`;
196
196
  }
197
197
  else {
198
- const segments = path.split("/");
199
- controllerPath = `${segments[segments.length - 1]}/${file.slice(0, file.lastIndexOf('.'))}`;
198
+ const segments = path.split("/").filter((segment) => segment !== "");
199
+ controllerPath += `${segments[segments.length - 1]}/${file.slice(0, file.lastIndexOf('.'))}`;
200
200
  }
201
201
  if (moduleExist) {
202
202
  if (target.includes("/") || target.includes("\\") || target.includes("//")) {
@@ -1,5 +1,5 @@
1
1
  import { CreateModule } from "@expressots/core";
2
- import { {{className}}Controller } from "./{{{path}}}";
2
+ import { {{className}}Controller } from "{{{path}}}";
3
3
 
4
4
  const {{moduleName}}Module = CreateModule([{{className}}Controller]);
5
5
 
@@ -27,7 +27,7 @@ async function addControllerToModule(filePath, controllerName, controllerPath) {
27
27
  if (!moduleDeclarationMatch) {
28
28
  return;
29
29
  }
30
- const controllers = moduleDeclarationMatch[1].trim().split(',').map((c) => c.trim());
30
+ const controllers = moduleDeclarationMatch[1].trim().split(',').map((c) => c.trim()).filter((c) => c);
31
31
  if (controllers.includes(controllerName)) {
32
32
  return;
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)",
5
5
  "author": "Richard Zampieri",
6
6
  "license": "MIT",