@expressots/cli 1.12.0 → 3.0.0-beta.2
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.
- package/bin/cli.d.ts +5 -1
- package/bin/cli.js +7 -0
- package/bin/commands/project.commands.js +26 -22
- package/bin/generate/templates/nonopinionated/module.tpl +1 -2
- package/bin/generate/templates/opinionated/controller-service-delete.tpl +6 -14
- package/bin/generate/templates/opinionated/controller-service-get.tpl +7 -15
- package/bin/generate/templates/opinionated/controller-service-patch.tpl +7 -17
- package/bin/generate/templates/opinionated/controller-service-post.tpl +7 -14
- package/bin/generate/templates/opinionated/controller-service-put.tpl +7 -17
- package/bin/generate/templates/opinionated/controller-service.tpl +1 -2
- package/bin/generate/templates/opinionated/module-service.tpl +1 -2
- package/bin/generate/templates/opinionated/module.tpl +1 -2
- package/bin/generate/utils/command-utils.d.ts +1 -1
- package/bin/generate/utils/command-utils.js +12 -12
- package/bin/generate/utils/nonopininated-cmd.d.ts +1 -1
- package/bin/generate/utils/nonopininated-cmd.js +12 -12
- package/bin/generate/utils/opinionated-cmd.d.ts +1 -1
- package/bin/generate/utils/opinionated-cmd.js +12 -12
- package/bin/generate/utils/string-utils.d.ts +36 -0
- package/bin/generate/utils/string-utils.js +71 -0
- package/bin/help/form.js +5 -1
- package/bin/index.d.ts +0 -1
- package/bin/index.js +0 -1
- package/bin/info/form.js +3 -13
- package/bin/new/cli.js +1 -1
- package/bin/new/form.d.ts +3 -2
- package/bin/new/form.js +42 -23
- package/bin/providers/add/cli.d.ts +1 -0
- package/bin/providers/add/cli.js +27 -4
- package/bin/providers/add/form.d.ts +2 -1
- package/bin/providers/add/form.js +72 -39
- package/bin/providers/create/form.js +1 -1
- package/bin/utils/add-module-to-container.js +16 -11
- package/bin/utils/compiler.d.ts +1 -1
- package/package.json +19 -20
- package/bin/@types/config.d.ts +0 -39
- package/bin/@types/config.js +0 -2
- package/bin/@types/index.d.ts +0 -1
- package/bin/@types/index.js +0 -17
- package/bin/app.container.d.ts +0 -1
- package/bin/app.container.js +0 -8
- package/bin/commands/__tests__/project.commands.spec.d.ts +0 -1
- package/bin/commands/__tests__/project.commands.spec.js +0 -8
- package/bin/types.d.ts +0 -1
- package/bin/types.js +0 -17
package/bin/cli.d.ts
CHANGED
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"));
|
|
@@ -17,6 +18,11 @@ const providers_1 = require("./providers");
|
|
|
17
18
|
const cli_2 = require("./providers/create/cli");
|
|
18
19
|
const cli_ui_1 = require("./utils/cli-ui");
|
|
19
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";
|
|
20
26
|
process_1.stdout.write(`\n${[chalk_1.default.bold.green("🐎 Expressots")]}\n\n`);
|
|
21
27
|
(0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
22
28
|
.scriptName("expressots")
|
|
@@ -26,6 +32,7 @@ process_1.stdout.write(`\n${[chalk_1.default.bold.green("🐎 Expressots")]}\n\n
|
|
|
26
32
|
.command(project_commands_1.prodCommand)
|
|
27
33
|
.command((0, cli_2.createExternalProviderCMD)())
|
|
28
34
|
.command((0, providers_1.addProviderCMD)())
|
|
35
|
+
.command((0, providers_1.removeProviderCMD)())
|
|
29
36
|
.command((0, generate_1.generateProject)())
|
|
30
37
|
.command((0, scripts_1.scriptsCommand)())
|
|
31
38
|
.command((0, info_1.infoProject)())
|
|
@@ -59,22 +59,26 @@ function getOutDir() {
|
|
|
59
59
|
* @param compiler The compiler to load the configuration from
|
|
60
60
|
* @returns The configuration
|
|
61
61
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
async function opinionatedConfig() {
|
|
63
|
+
const { entryPoint } = await compiler_1.default.loadConfig();
|
|
64
|
+
const config = [
|
|
65
|
+
"--watch",
|
|
66
|
+
"-r",
|
|
67
|
+
"tsconfig-paths/register",
|
|
68
|
+
`./src/${entryPoint}.ts`,
|
|
69
|
+
];
|
|
70
|
+
return config;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Load the configuration from the compiler
|
|
74
|
+
* @param compiler The compiler to load the configuration from
|
|
75
|
+
* @returns The configuration
|
|
76
|
+
*/
|
|
77
|
+
async function nonOpinionatedConfig() {
|
|
78
|
+
const { entryPoint } = await compiler_1.default.loadConfig();
|
|
79
|
+
const config = ["--watch", `./src/${entryPoint}.ts`];
|
|
80
|
+
return config;
|
|
81
|
+
}
|
|
78
82
|
/**
|
|
79
83
|
* Dev command module
|
|
80
84
|
* @type {CommandModule<object, object>}
|
|
@@ -182,12 +186,14 @@ const clearScreen = () => {
|
|
|
182
186
|
* @param command The command to run
|
|
183
187
|
*/
|
|
184
188
|
const runCommand = async ({ command, }) => {
|
|
185
|
-
const { opinionated } = await compiler_1.default.loadConfig();
|
|
189
|
+
const { opinionated, entryPoint } = await compiler_1.default.loadConfig();
|
|
186
190
|
const outDir = getOutDir();
|
|
187
191
|
try {
|
|
188
192
|
switch (command) {
|
|
189
193
|
case "dev":
|
|
190
|
-
execCmd("
|
|
194
|
+
execCmd("tsx", opinionated
|
|
195
|
+
? await opinionatedConfig()
|
|
196
|
+
: await nonOpinionatedConfig());
|
|
191
197
|
break;
|
|
192
198
|
case "build":
|
|
193
199
|
if (!outDir) {
|
|
@@ -206,15 +212,13 @@ const runCommand = async ({ command, }) => {
|
|
|
206
212
|
let config = [];
|
|
207
213
|
if (opinionated) {
|
|
208
214
|
config = [
|
|
209
|
-
"-r",
|
|
210
|
-
"dotenv/config",
|
|
211
215
|
"-r",
|
|
212
216
|
`./${outDir}/register-path.js`,
|
|
213
|
-
`./${outDir}/src
|
|
217
|
+
`./${outDir}/src/${entryPoint}.js`,
|
|
214
218
|
];
|
|
215
219
|
}
|
|
216
220
|
else {
|
|
217
|
-
config = [
|
|
221
|
+
config = [`./${outDir}/${entryPoint}.js`];
|
|
218
222
|
}
|
|
219
223
|
clearScreen();
|
|
220
224
|
execCmd("node", config);
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
9
|
-
|
|
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
|
|
15
|
-
return this.
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
6
|
+
export class {{className}}Controller {
|
|
7
|
+
@inject({{className}}UseCase) private {{useCase}}UseCase: {{className}}UseCase;
|
|
8
|
+
|
|
13
9
|
@Get("/")
|
|
14
|
-
execute(
|
|
15
|
-
return this.
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
4
|
+
import { I{{className}}RequestDTO } from "./{{fileName}}.dto";
|
|
6
5
|
|
|
7
6
|
@controller("/{{{route}}}")
|
|
8
|
-
export class {{className}}Controller
|
|
9
|
-
|
|
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
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
4
|
+
import { I{{className}}RequestDTO } from "./{{fileName}}.dto";
|
|
6
5
|
|
|
7
6
|
@controller("/{{{route}}}")
|
|
8
|
-
export class {{className}}Controller
|
|
9
|
-
|
|
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
|
|
15
|
-
return this.
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
4
|
+
import { I{{className}}RequestDTO } from "./{{fileName}}.dto";
|
|
6
5
|
|
|
7
6
|
@controller("/{{{route}}}")
|
|
8
|
-
export class {{className}}Controller
|
|
9
|
-
|
|
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
|
-
|
|
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
|
|
4
|
+
export class {{className}}Controller {
|
|
6
5
|
@{{method}}("/")
|
|
7
6
|
execute() {
|
|
8
7
|
return "Ok";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ContainerModule } from "
|
|
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]);
|
|
@@ -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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
256
|
+
return (0, string_utils_1.anyCaseToLowerCase)(name);
|
|
257
257
|
case "kebab-case" /* Pattern.KEBAB_CASE */:
|
|
258
|
-
return (0,
|
|
258
|
+
return (0, string_utils_1.anyCaseToKebabCase)(name);
|
|
259
259
|
case "PascalCase" /* Pattern.PASCAL_CASE */:
|
|
260
|
-
return (0,
|
|
260
|
+
return (0, string_utils_1.anyCaseToPascalCase)(name);
|
|
261
261
|
case "camelCase" /* Pattern.CAMEL_CASE */:
|
|
262
|
-
return (0,
|
|
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,
|
|
286
|
+
return (0, string_utils_1.anyCaseToLowerCase)(firstWord);
|
|
287
287
|
case "kebab-case" /* Pattern.KEBAB_CASE */:
|
|
288
|
-
return (0,
|
|
288
|
+
return (0, string_utils_1.anyCaseToKebabCase)(firstWord);
|
|
289
289
|
case "PascalCase" /* Pattern.PASCAL_CASE */:
|
|
290
|
-
return (0,
|
|
290
|
+
return (0, string_utils_1.anyCaseToPascalCase)(firstWord);
|
|
291
291
|
case "camelCase" /* Pattern.CAMEL_CASE */:
|
|
292
|
-
return (0,
|
|
292
|
+
return (0, string_utils_1.anyCaseToCamelCase)(firstWord);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
exports.extractFirstWord = extractFirstWord;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nonOpinionatedProcess = void 0;
|
|
4
|
-
const
|
|
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,
|
|
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,
|
|
133
|
+
useCase: (0, string_utils_1.anyCaseToCamelCase)(className),
|
|
134
134
|
route: className
|
|
135
135
|
? className.toLowerCase()
|
|
136
136
|
: path.replace(/\/$/, ""),
|
|
137
|
-
construct: (0,
|
|
137
|
+
construct: (0, string_utils_1.anyCaseToKebabCase)(className),
|
|
138
138
|
method: (0, command_utils_1.getHttpMethod)(method),
|
|
139
|
-
schematic: (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
244
|
-
: (0,
|
|
243
|
+
? (0, string_utils_1.anyCaseToPascalCase)(className)
|
|
244
|
+
: (0, string_utils_1.anyCaseToPascalCase)(moduleName),
|
|
245
245
|
path,
|
|
246
|
-
schematic: (0,
|
|
246
|
+
schematic: (0, string_utils_1.anyCaseToPascalCase)(schematic),
|
|
247
247
|
},
|
|
248
248
|
},
|
|
249
249
|
});
|
|
@@ -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
|
|
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,
|
|
164
|
+
useCase: (0, string_utils_1.anyCaseToCamelCase)(className),
|
|
165
165
|
route: path.replace(/\/$/, ""),
|
|
166
|
-
construct: (0,
|
|
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,
|
|
255
|
+
useCase: (0, string_utils_1.anyCaseToCamelCase)(className),
|
|
256
256
|
route: path.replace(/\/$/, ""),
|
|
257
|
-
construct: (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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;
|