@expressots/cli 1.11.1 → 3.0.0-beta.1

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.
Files changed (48) hide show
  1. package/bin/cli.d.ts +5 -1
  2. package/bin/cli.js +9 -1
  3. package/bin/commands/project.commands.js +4 -15
  4. package/bin/generate/templates/nonopinionated/module.tpl +1 -2
  5. package/bin/generate/templates/opinionated/controller-service-delete.tpl +6 -14
  6. package/bin/generate/templates/opinionated/controller-service-get.tpl +7 -15
  7. package/bin/generate/templates/opinionated/controller-service-patch.tpl +7 -17
  8. package/bin/generate/templates/opinionated/controller-service-post.tpl +7 -14
  9. package/bin/generate/templates/opinionated/controller-service-put.tpl +7 -17
  10. package/bin/generate/templates/opinionated/controller-service.tpl +1 -2
  11. package/bin/generate/templates/opinionated/module-service.tpl +1 -2
  12. package/bin/generate/templates/opinionated/module.tpl +1 -2
  13. package/bin/generate/utils/command-utils.d.ts +1 -1
  14. package/bin/generate/utils/command-utils.js +12 -12
  15. package/bin/generate/utils/nonopininated-cmd.d.ts +1 -1
  16. package/bin/generate/utils/nonopininated-cmd.js +12 -12
  17. package/bin/generate/utils/opinionated-cmd.d.ts +1 -1
  18. package/bin/generate/utils/opinionated-cmd.js +12 -12
  19. package/bin/generate/utils/string-utils.d.ts +36 -0
  20. package/bin/generate/utils/string-utils.js +71 -0
  21. package/bin/help/form.js +6 -2
  22. package/bin/index.d.ts +0 -1
  23. package/bin/index.js +0 -1
  24. package/bin/info/form.js +3 -13
  25. package/bin/new/form.js +37 -21
  26. package/bin/providers/add/cli.d.ts +1 -0
  27. package/bin/providers/add/cli.js +27 -4
  28. package/bin/providers/add/form.d.ts +2 -1
  29. package/bin/providers/add/form.js +72 -39
  30. package/bin/providers/create/form.js +1 -1
  31. package/bin/scripts/cli.d.ts +3 -0
  32. package/bin/scripts/cli.js +24 -0
  33. package/bin/scripts/form.d.ts +1 -0
  34. package/bin/scripts/form.js +107 -0
  35. package/bin/scripts/index.d.ts +1 -0
  36. package/bin/{@types → scripts}/index.js +1 -1
  37. package/bin/utils/add-module-to-container.js +16 -11
  38. package/bin/utils/compiler.d.ts +1 -1
  39. package/package.json +19 -20
  40. package/bin/@types/config.d.ts +0 -39
  41. package/bin/@types/config.js +0 -2
  42. package/bin/@types/index.d.ts +0 -1
  43. package/bin/app.container.d.ts +0 -1
  44. package/bin/app.container.js +0 -8
  45. package/bin/commands/__tests__/project.commands.spec.d.ts +0 -1
  46. package/bin/commands/__tests__/project.commands.spec.js +0 -8
  47. package/bin/types.d.ts +0 -1
  48. package/bin/types.js +0 -17
package/bin/cli.d.ts CHANGED
@@ -1,2 +1,6 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ /**
3
+ * The current version of the ExpressoTS Bundle.
4
+ * core, adapters, and cli.
5
+ */
6
+ export declare const BUNDLE_VERSION = "3.0.0-beta.1";
package/bin/cli.js CHANGED
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.BUNDLE_VERSION = void 0;
7
8
  const chalk_1 = __importDefault(require("chalk"));
8
9
  const process_1 = require("process");
9
10
  const yargs_1 = __importDefault(require("yargs"));
@@ -16,6 +17,12 @@ const new_1 = require("./new");
16
17
  const providers_1 = require("./providers");
17
18
  const cli_2 = require("./providers/create/cli");
18
19
  const cli_ui_1 = require("./utils/cli-ui");
20
+ const scripts_1 = require("./scripts");
21
+ /**
22
+ * The current version of the ExpressoTS Bundle.
23
+ * core, adapters, and cli.
24
+ */
25
+ exports.BUNDLE_VERSION = "3.0.0-beta.1";
19
26
  process_1.stdout.write(`\n${[chalk_1.default.bold.green("🐎 Expressots")]}\n\n`);
20
27
  (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
21
28
  .scriptName("expressots")
@@ -25,7 +32,9 @@ process_1.stdout.write(`\n${[chalk_1.default.bold.green("🐎 Expressots")]}\n\n
25
32
  .command(project_commands_1.prodCommand)
26
33
  .command((0, cli_2.createExternalProviderCMD)())
27
34
  .command((0, providers_1.addProviderCMD)())
35
+ .command((0, providers_1.removeProviderCMD)())
28
36
  .command((0, generate_1.generateProject)())
37
+ .command((0, scripts_1.scriptsCommand)())
29
38
  .command((0, info_1.infoProject)())
30
39
  .command((0, cli_1.helpCommand)())
31
40
  .demandCommand(1, "You need at least one command before moving on")
@@ -33,7 +42,6 @@ process_1.stdout.write(`\n${[chalk_1.default.bold.green("🐎 Expressots")]}\n\n
33
42
  .fail((msg, err, yargs) => {
34
43
  if (msg) {
35
44
  if (msg.includes("Unknown argument")) {
36
- // Get the command name
37
45
  const command = process.argv[2];
38
46
  if (command === "run") {
39
47
  (0, cli_ui_1.printError)(`The "run" command has been removed. Use "dev", "prod" or "build" instead.`, "expressots help");
@@ -60,21 +60,12 @@ function getOutDir() {
60
60
  * @returns The configuration
61
61
  */
62
62
  const opinionatedConfig = [
63
- "--transpile-only",
64
- "--clear",
65
- "-r",
66
- "dotenv/config",
63
+ "--watch",
67
64
  "-r",
68
65
  "tsconfig-paths/register",
69
66
  "./src/main.ts",
70
67
  ];
71
- const nonOpinionatedConfig = [
72
- "--transpile-only",
73
- "--clear",
74
- "-r",
75
- "dotenv/config",
76
- "./src/main.ts",
77
- ];
68
+ const nonOpinionatedConfig = ["--watch", "./src/main.ts"];
78
69
  /**
79
70
  * Dev command module
80
71
  * @type {CommandModule<object, object>}
@@ -187,7 +178,7 @@ const runCommand = async ({ command, }) => {
187
178
  try {
188
179
  switch (command) {
189
180
  case "dev":
190
- execCmd("tsnd", opinionated ? opinionatedConfig : nonOpinionatedConfig);
181
+ execCmd("tsx", opinionated ? opinionatedConfig : nonOpinionatedConfig);
191
182
  break;
192
183
  case "build":
193
184
  if (!outDir) {
@@ -206,15 +197,13 @@ const runCommand = async ({ command, }) => {
206
197
  let config = [];
207
198
  if (opinionated) {
208
199
  config = [
209
- "-r",
210
- "dotenv/config",
211
200
  "-r",
212
201
  `./${outDir}/register-path.js`,
213
202
  `./${outDir}/src/main.js`,
214
203
  ];
215
204
  }
216
205
  else {
217
- config = ["-r", "dotenv/config", `./${outDir}/main.js`];
206
+ config = [`./${outDir}/main.js`];
218
207
  }
219
208
  clearScreen();
220
209
  execCmd("node", config);
@@ -1,4 +1,3 @@
1
- import { ContainerModule } from "inversify";
2
- import { CreateModule } from "@expressots/core";
1
+ import { ContainerModule, CreateModule } from "@expressots/core";
3
2
 
4
3
  export const {{moduleName}}{{schematic}}: ContainerModule = CreateModule([]);
@@ -1,21 +1,13 @@
1
- import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, Delete, param, response } from "@expressots/adapter-express";
3
- import { Response } from "express";
1
+ import { controller, Delete, param } from "@expressots/adapter-express";
2
+ import { inject } from "@expressots/core";
4
3
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
- import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
6
4
 
7
5
  @controller("/{{{route}}}")
8
- export class {{className}}Controller extends BaseController {
9
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
- super();
11
- }
6
+ export class {{className}}Controller {
7
+ @inject({{className}}UseCase) private {{useCase}}UseCase: {{className}}UseCase;
12
8
 
13
9
  @Delete("/:id")
14
- execute(@param("id") id: string, @response() res: Response): I{{className}}ResponseDTO {
15
- return this.callUseCase(
16
- this.{{useCase}}UseCase.execute(id),
17
- res,
18
- StatusCode.OK,
19
- );
10
+ execute(@param("id") id: string) {
11
+ return this.{{useCase}}UseCase.execute(id);
20
12
  }
21
13
  }
@@ -1,21 +1,13 @@
1
- import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, Get, response } from "@expressots/adapter-express";
3
- import { Response } from "express";
1
+ import { controller, Get } from "@expressots/adapter-express";
2
+ import { inject } from "@expressots/core";
4
3
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
- import { I{{className}}ResponseDTO } from "./{{fileName}}.dto";
6
4
 
7
5
  @controller("/{{{route}}}")
8
- export class {{className}}Controller extends BaseController {
9
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
- super();
11
- }
12
-
6
+ export class {{className}}Controller {
7
+ @inject({{className}}UseCase) private {{useCase}}UseCase: {{className}}UseCase;
8
+
13
9
  @Get("/")
14
- execute(@response() res: Response): I{{className}}ResponseDTO {
15
- return this.callUseCase(
16
- this.{{useCase}}UseCase.execute(),
17
- res,
18
- StatusCode.OK,
19
- );
10
+ execute() {
11
+ return this.{{useCase}}UseCase.execute();
20
12
  }
21
13
  }
@@ -1,24 +1,14 @@
1
- import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, Patch, body, param, response } from "@expressots/adapter-express";
3
- import { Response } from "express";
1
+ import { controller, Patch, body } from "@expressots/adapter-express";
2
+ import { inject } from "@expressots/core";
4
3
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
- import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
4
+ import { I{{className}}RequestDTO } from "./{{fileName}}.dto";
6
5
 
7
6
  @controller("/{{{route}}}")
8
- export class {{className}}Controller extends BaseController {
9
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
- super();
11
- }
7
+ export class {{className}}Controller {
8
+ @inject({{className}}UseCase) private {{useCase}}UseCase: {{className}}UseCase;
12
9
 
13
10
  @Patch("/")
14
- execute(
15
- @body() payload: I{{className}}RequestDTO,
16
- @response() res: Response,
17
- ): I{{className}}ResponseDTO {
18
- return this.callUseCase(
19
- this.{{useCase}}UseCase.execute(payload),
20
- res,
21
- StatusCode.OK,
22
- );
11
+ execute(@body() payload: I{{className}}RequestDTO) {
12
+ return this.{{useCase}}UseCase.execute(payload);
23
13
  }
24
14
  }
@@ -1,21 +1,14 @@
1
- import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, Post, body, response } from "@expressots/adapter-express";
3
- import { Response } from "express";
1
+ import { body, controller, Post } from "@expressots/adapter-express";
2
+ import { inject } from "@expressots/core";
4
3
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
- import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
4
+ import { I{{className}}RequestDTO } from "./{{fileName}}.dto";
6
5
 
7
6
  @controller("/{{{route}}}")
8
- export class {{className}}Controller extends BaseController {
9
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
- super();
11
- }
7
+ export class {{className}}Controller {
8
+ @inject({{className}}UseCase) private {{useCase}}UseCase: {{className}}UseCase;
12
9
 
13
10
  @Post("/")
14
- execute(@body() payload: I{{className}}RequestDTO, @response() res: Response): I{{className}}ResponseDTO {
15
- return this.callUseCase(
16
- this.{{useCase}}UseCase.execute(payload),
17
- res,
18
- StatusCode.Created,
19
- );
11
+ execute(@body() payload: I{{className}}RequestDTO) {
12
+ return this.{{useCase}}UseCase.execute(payload);
20
13
  }
21
14
  }
@@ -1,24 +1,14 @@
1
- import { BaseController, StatusCode } from "@expressots/core";
2
- import { controller, Put, body, param, response } from "@expressots/adapter-express";
3
- import { Response } from "express";
1
+ import { body, controller, Put } from "@expressots/adapter-express";
2
+ import { inject } from "@expressots/core";
4
3
  import { {{className}}UseCase } from "./{{fileName}}.usecase";
5
- import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
4
+ import { I{{className}}RequestDTO } from "./{{fileName}}.dto";
6
5
 
7
6
  @controller("/{{{route}}}")
8
- export class {{className}}Controller extends BaseController {
9
- constructor(private {{useCase}}UseCase: {{className}}UseCase) {
10
- super();
11
- }
7
+ export class {{className}}Controller {
8
+ @inject({{className}}UseCase) private {{useCase}}UseCase: {{className}}UseCase;
12
9
 
13
10
  @Put("/")
14
- execute(
15
- @body() payload: I{{className}}RequestDTO,
16
- @response() res: Response,
17
- ): I{{className}}ResponseDTO {
18
- return this.callUseCase(
19
- this.{{useCase}}UseCase.execute(payload),
20
- res,
21
- StatusCode.OK,
22
- );
11
+ execute(@body() payload: I{{className}}RequestDTO) {
12
+ return this.{{useCase}}UseCase.execute(payload);
23
13
  }
24
14
  }
@@ -1,8 +1,7 @@
1
- import { BaseController } from "@expressots/core";
2
1
  import { controller, {{method}} } from "@expressots/adapter-express";
3
2
 
4
3
  @controller("/{{{route}}}")
5
- export class {{className}}Controller extends BaseController {
4
+ export class {{className}}Controller {
6
5
  @{{method}}("/")
7
6
  execute() {
8
7
  return "Ok";
@@ -1,5 +1,4 @@
1
- import { ContainerModule } from "inversify";
2
- import { CreateModule } from "@expressots/core";
1
+ import { CreateModule, ContainerModule } from "@expressots/core";
3
2
  import { {{className}}Controller } from "{{{path}}}";
4
3
 
5
4
  export const {{moduleName}}Module: ContainerModule = CreateModule([{{className}}Controller]);
@@ -1,4 +1,3 @@
1
- import { ContainerModule } from "inversify";
2
- import { CreateModule } from "@expressots/core";
1
+ import { CreateModule, ContainerModule } from "@expressots/core";
3
2
 
4
3
  export const {{moduleName}}Module: ContainerModule = CreateModule([]);
@@ -1,4 +1,4 @@
1
- import { ExpressoConfig } from "../../types";
1
+ import { ExpressoConfig } from "@expressots/shared";
2
2
  export declare const enum PathStyle {
3
3
  None = "none",
4
4
  Single = "single",
@@ -30,7 +30,7 @@ exports.checkPathStyle = exports.extractFirstWord = exports.getNameWithScaffoldP
30
30
  const node_fs_1 = require("node:fs");
31
31
  const nodePath = __importStar(require("node:path"));
32
32
  const mustache_1 = require("mustache");
33
- const boost_ts_1 = require("@expressots/boost-ts");
33
+ const string_utils_1 = require("./string-utils");
34
34
  const cli_ui_1 = require("../../utils/cli-ui");
35
35
  const verify_file_exists_1 = require("../../utils/verify-file-exists");
36
36
  const compiler_1 = __importDefault(require("../../utils/compiler"));
@@ -148,7 +148,7 @@ const splitTarget = async ({ target, schematic, }) => {
148
148
  return {
149
149
  path,
150
150
  file: `${await (0, exports.getNameWithScaffoldPattern)(fileName)}.${schematic}.ts`,
151
- className: (0, boost_ts_1.anyCaseToPascalCase)(fileName),
151
+ className: (0, string_utils_1.anyCaseToPascalCase)(fileName),
152
152
  moduleName: module,
153
153
  modulePath,
154
154
  };
@@ -172,7 +172,7 @@ const splitTarget = async ({ target, schematic, }) => {
172
172
  return {
173
173
  path: `${wordName}/${pathEdgeCase(path)}${pathEdgeCase(remainingPath)}`,
174
174
  file: `${await (0, exports.getNameWithScaffoldPattern)(name)}.${schematic}.ts`,
175
- className: (0, boost_ts_1.anyCaseToPascalCase)(name),
175
+ className: (0, string_utils_1.anyCaseToPascalCase)(name),
176
176
  moduleName: wordName,
177
177
  modulePath: pathContent[0].split("-")[1],
178
178
  };
@@ -181,7 +181,7 @@ const splitTarget = async ({ target, schematic, }) => {
181
181
  return {
182
182
  path: "",
183
183
  file: `${await (0, exports.getNameWithScaffoldPattern)(name)}.${schematic}.ts`,
184
- className: (0, boost_ts_1.anyCaseToPascalCase)(name),
184
+ className: (0, string_utils_1.anyCaseToPascalCase)(name),
185
185
  moduleName: name,
186
186
  modulePath: "",
187
187
  };
@@ -253,13 +253,13 @@ const getNameWithScaffoldPattern = async (name) => {
253
253
  const configObject = await compiler_1.default.loadConfig();
254
254
  switch (configObject.scaffoldPattern) {
255
255
  case "lowercase" /* Pattern.LOWER_CASE */:
256
- return (0, boost_ts_1.anyCaseToLowerCase)(name);
256
+ return (0, string_utils_1.anyCaseToLowerCase)(name);
257
257
  case "kebab-case" /* Pattern.KEBAB_CASE */:
258
- return (0, boost_ts_1.anyCaseToKebabCase)(name);
258
+ return (0, string_utils_1.anyCaseToKebabCase)(name);
259
259
  case "PascalCase" /* Pattern.PASCAL_CASE */:
260
- return (0, boost_ts_1.anyCaseToPascalCase)(name);
260
+ return (0, string_utils_1.anyCaseToPascalCase)(name);
261
261
  case "camelCase" /* Pattern.CAMEL_CASE */:
262
- return (0, boost_ts_1.anyCaseToCamelCase)(name);
262
+ return (0, string_utils_1.anyCaseToCamelCase)(name);
263
263
  }
264
264
  };
265
265
  exports.getNameWithScaffoldPattern = getNameWithScaffoldPattern;
@@ -283,13 +283,13 @@ async function extractFirstWord(file) {
283
283
  const config = await compiler_1.default.loadConfig();
284
284
  switch (config.scaffoldPattern) {
285
285
  case "lowercase" /* Pattern.LOWER_CASE */:
286
- return (0, boost_ts_1.anyCaseToLowerCase)(firstWord);
286
+ return (0, string_utils_1.anyCaseToLowerCase)(firstWord);
287
287
  case "kebab-case" /* Pattern.KEBAB_CASE */:
288
- return (0, boost_ts_1.anyCaseToKebabCase)(firstWord);
288
+ return (0, string_utils_1.anyCaseToKebabCase)(firstWord);
289
289
  case "PascalCase" /* Pattern.PASCAL_CASE */:
290
- return (0, boost_ts_1.anyCaseToPascalCase)(firstWord);
290
+ return (0, string_utils_1.anyCaseToPascalCase)(firstWord);
291
291
  case "camelCase" /* Pattern.CAMEL_CASE */:
292
- return (0, boost_ts_1.anyCaseToCamelCase)(firstWord);
292
+ return (0, string_utils_1.anyCaseToCamelCase)(firstWord);
293
293
  }
294
294
  }
295
295
  exports.extractFirstWord = extractFirstWord;
@@ -1,4 +1,4 @@
1
- import { ExpressoConfig } from "../../@types";
1
+ import { ExpressoConfig } from "@expressots/shared";
2
2
  /**
3
3
  * Process the non-opinionated command
4
4
  * @param schematic - The schematic
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nonOpinionatedProcess = void 0;
4
- const boost_ts_1 = require("@expressots/boost-ts");
4
+ const string_utils_1 = require("./string-utils");
5
5
  const cli_ui_1 = require("../../utils/cli-ui");
6
6
  const command_utils_1 = require("./command-utils");
7
7
  /**
@@ -108,7 +108,7 @@ async function generateUseCase(outputPath, className, moduleName, path, fileName
108
108
  fileName,
109
109
  schematic: schematic === "usecase"
110
110
  ? "UseCase"
111
- : (0, boost_ts_1.anyCaseToPascalCase)(schematic),
111
+ : (0, string_utils_1.anyCaseToPascalCase)(schematic),
112
112
  },
113
113
  },
114
114
  });
@@ -130,13 +130,13 @@ async function generateController(outputPath, className, path, method, file, sch
130
130
  data: {
131
131
  className,
132
132
  fileName: (0, command_utils_1.getFileNameWithoutExtension)(file),
133
- useCase: (0, boost_ts_1.anyCaseToCamelCase)(className),
133
+ useCase: (0, string_utils_1.anyCaseToCamelCase)(className),
134
134
  route: className
135
135
  ? className.toLowerCase()
136
136
  : path.replace(/\/$/, ""),
137
- construct: (0, boost_ts_1.anyCaseToKebabCase)(className),
137
+ construct: (0, string_utils_1.anyCaseToKebabCase)(className),
138
138
  method: (0, command_utils_1.getHttpMethod)(method),
139
- schematic: (0, boost_ts_1.anyCaseToPascalCase)(schematic),
139
+ schematic: (0, string_utils_1.anyCaseToPascalCase)(schematic),
140
140
  },
141
141
  },
142
142
  });
@@ -157,7 +157,7 @@ async function generateDTO(outputPath, className, moduleName, path, schematic) {
157
157
  className,
158
158
  moduleName,
159
159
  path,
160
- schematic: (0, boost_ts_1.anyCaseToPascalCase)(schematic),
160
+ schematic: (0, string_utils_1.anyCaseToPascalCase)(schematic),
161
161
  },
162
162
  },
163
163
  });
@@ -178,7 +178,7 @@ async function generateProvider(outputPath, className, moduleName, path, schemat
178
178
  className,
179
179
  moduleName,
180
180
  path,
181
- schematic: (0, boost_ts_1.anyCaseToPascalCase)(schematic),
181
+ schematic: (0, string_utils_1.anyCaseToPascalCase)(schematic),
182
182
  },
183
183
  },
184
184
  });
@@ -199,7 +199,7 @@ async function generateEntity(outputPath, className, moduleName, path, schematic
199
199
  className,
200
200
  moduleName,
201
201
  path,
202
- schematic: (0, boost_ts_1.anyCaseToPascalCase)(schematic),
202
+ schematic: (0, string_utils_1.anyCaseToPascalCase)(schematic),
203
203
  },
204
204
  },
205
205
  });
@@ -220,7 +220,7 @@ async function generateMiddleware(outputPath, className, moduleName, path, schem
220
220
  className,
221
221
  moduleName,
222
222
  path,
223
- schematic: (0, boost_ts_1.anyCaseToPascalCase)(schematic),
223
+ schematic: (0, string_utils_1.anyCaseToPascalCase)(schematic),
224
224
  },
225
225
  },
226
226
  });
@@ -240,10 +240,10 @@ async function generateModule(outputPath, className, moduleName, path, schematic
240
240
  data: {
241
241
  className,
242
242
  moduleName: className
243
- ? (0, boost_ts_1.anyCaseToPascalCase)(className)
244
- : (0, boost_ts_1.anyCaseToPascalCase)(moduleName),
243
+ ? (0, string_utils_1.anyCaseToPascalCase)(className)
244
+ : (0, string_utils_1.anyCaseToPascalCase)(moduleName),
245
245
  path,
246
- schematic: (0, boost_ts_1.anyCaseToPascalCase)(schematic),
246
+ schematic: (0, string_utils_1.anyCaseToPascalCase)(schematic),
247
247
  },
248
248
  },
249
249
  });
@@ -1,4 +1,4 @@
1
- import { ExpressoConfig } from "../../@types";
1
+ import { ExpressoConfig } from "@expressots/shared";
2
2
  /**
3
3
  * Process commands for opinionated service scaffolding
4
4
  * @param schematic - Resource to scaffold
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.opinionatedProcess = void 0;
30
- const boost_ts_1 = require("@expressots/boost-ts");
30
+ const string_utils_1 = require("./string-utils");
31
31
  const nodePath = __importStar(require("node:path"));
32
32
  const fs_1 = __importDefault(require("fs"));
33
33
  const cli_ui_1 = require("../../utils/cli-ui");
@@ -161,9 +161,9 @@ async function generateControllerService(outputPath, className, path, method, fi
161
161
  data: {
162
162
  className,
163
163
  fileName: (0, command_utils_1.getFileNameWithoutExtension)(file),
164
- useCase: (0, boost_ts_1.anyCaseToCamelCase)(className),
164
+ useCase: (0, string_utils_1.anyCaseToCamelCase)(className),
165
165
  route: path.replace(/\/$/, ""),
166
- construct: (0, boost_ts_1.anyCaseToKebabCase)(className),
166
+ construct: (0, string_utils_1.anyCaseToKebabCase)(className),
167
167
  method: (0, command_utils_1.getHttpMethod)(method),
168
168
  },
169
169
  },
@@ -252,9 +252,9 @@ async function generateController(outputPath, className, path, method, file) {
252
252
  data: {
253
253
  className,
254
254
  fileName: (0, command_utils_1.getFileNameWithoutExtension)(file),
255
- useCase: (0, boost_ts_1.anyCaseToCamelCase)(className),
255
+ useCase: (0, string_utils_1.anyCaseToCamelCase)(className),
256
256
  route: path.replace(/\/$/, ""),
257
- construct: (0, boost_ts_1.anyCaseToKebabCase)(className),
257
+ construct: (0, string_utils_1.anyCaseToKebabCase)(className),
258
258
  method: (0, command_utils_1.getHttpMethod)(method),
259
259
  },
260
260
  },
@@ -373,12 +373,12 @@ async function generateModuleServiceSugarPath(outputPathController, className, m
373
373
  path: "../templates/opinionated/module-service.tpl",
374
374
  data: {
375
375
  className,
376
- moduleName: (0, boost_ts_1.anyCaseToPascalCase)(moduleName),
376
+ moduleName: (0, string_utils_1.anyCaseToPascalCase)(moduleName),
377
377
  path: controllerToModule,
378
378
  },
379
379
  },
380
380
  });
381
- await (0, add_module_to_container_1.addModuleToContainer)((0, boost_ts_1.anyCaseToPascalCase)(moduleName), `${moduleName}/${file.replace(".ts", "")}`, path);
381
+ await (0, add_module_to_container_1.addModuleToContainer)((0, string_utils_1.anyCaseToPascalCase)(moduleName), `${moduleName}/${file.replace(".ts", "")}`, path);
382
382
  }
383
383
  /**
384
384
  * Generate a module for service scaffolding with single path
@@ -411,12 +411,12 @@ async function generateModuleServiceSinglePath(outputPathController, className,
411
411
  path: "../templates/opinionated/module-service.tpl",
412
412
  data: {
413
413
  className,
414
- moduleName: (0, boost_ts_1.anyCaseToPascalCase)(moduleName),
414
+ moduleName: (0, string_utils_1.anyCaseToPascalCase)(moduleName),
415
415
  path: controllerToModule,
416
416
  },
417
417
  },
418
418
  });
419
- await (0, add_module_to_container_1.addModuleToContainer)((0, boost_ts_1.anyCaseToPascalCase)(moduleName), `${moduleName}/${file.replace(".ts", "")}`, path);
419
+ await (0, add_module_to_container_1.addModuleToContainer)((0, string_utils_1.anyCaseToPascalCase)(moduleName), `${moduleName}/${file.replace(".ts", "")}`, path);
420
420
  }
421
421
  /**
422
422
  * Generate a module for service scaffolding with nested path
@@ -452,12 +452,12 @@ async function generateModuleServiceNestedPath(outputPathController, className,
452
452
  path: "../templates/opinionated/module-service.tpl",
453
453
  data: {
454
454
  className,
455
- moduleName: (0, boost_ts_1.anyCaseToPascalCase)(moduleFileName),
455
+ moduleName: (0, string_utils_1.anyCaseToPascalCase)(moduleFileName),
456
456
  path: controllerToModule,
457
457
  },
458
458
  },
459
459
  });
460
- await (0, add_module_to_container_1.addModuleToContainerNestedPath)((0, boost_ts_1.anyCaseToPascalCase)(moduleFileName), path);
460
+ await (0, add_module_to_container_1.addModuleToContainerNestedPath)((0, string_utils_1.anyCaseToPascalCase)(moduleFileName), path);
461
461
  }
462
462
  /**
463
463
  * Generate a module
@@ -473,7 +473,7 @@ async function generateModule(outputPath, className, moduleName, path) {
473
473
  path: "../templates/opinionated/module.tpl",
474
474
  data: {
475
475
  className,
476
- moduleName: (0, boost_ts_1.anyCaseToPascalCase)(moduleName),
476
+ moduleName: (0, string_utils_1.anyCaseToPascalCase)(moduleName),
477
477
  path,
478
478
  },
479
479
  },
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Converts a string from any case (camelCase, PascalCase, kebab-case, snake_case) to camelCase.
3
+ * @param str - The input string to be converted.
4
+ * @returns The converted string in camelCase.
5
+ */
6
+ export declare function anyCaseToCamelCase(str: string): string;
7
+ /**
8
+ * Converts a string from any case (camelCase, PascalCase, kebab-case, snake_case) to kebab-case.
9
+ * @param str - The input string to be converted.
10
+ * @returns The converted string in kebab-case.
11
+ */
12
+ export declare function anyCaseToKebabCase(str: string): string;
13
+ /**
14
+ * Converts a string from any case (camelCase, PascalCase, kebab-case, snake_case) to PascalCase.
15
+ * @param str - The input string to be converted.
16
+ * @returns The converted string in PascalCase.
17
+ */
18
+ export declare function anyCaseToPascalCase(str: string): string;
19
+ /**
20
+ * Converts a string from any case (camelCase, PascalCase, kebab-case, snake_case) to snake_case.
21
+ * @param str - The input string to be converted.
22
+ * @returns The converted string in snake_case.
23
+ */
24
+ export declare function anyCaseToSnakeCase(str: string): string;
25
+ /**
26
+ * Converts a string from any case (camelCase, PascalCase, kebab-case, snake_case) to UPPER CASE.
27
+ * @param str - The input string to be converted.
28
+ * @returns The converted string in UPPER CASE.
29
+ */
30
+ export declare function anyCaseToUpperCase(str: string): string;
31
+ /**
32
+ * Converts a string from any case (camelCase, PascalCase, kebab-case, snake_case) to lower case.
33
+ * @param str - The input string to be converted.
34
+ * @returns The converted string in lower case.
35
+ */
36
+ export declare function anyCaseToLowerCase(str: string): string;