@expressots/cli 1.3.3 โ 1.3.4
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/README.md +96 -19
- package/bin/cli.d.ts +1 -1
- package/bin/cli.js +1 -1
- package/bin/generate/form.js +53 -29
- package/bin/generate/templates/controller-service-delete.tpl +10 -13
- package/bin/generate/templates/controller-service-patch.tpl +13 -17
- package/bin/generate/templates/controller-service-post.tpl +9 -12
- package/bin/generate/templates/controller-service-put.tpl +13 -17
- package/bin/generate/templates/controller-service.tpl +9 -12
- package/bin/generate/templates/controller.tpl +6 -14
- package/bin/generate/templates/dto-op.tpl +3 -3
- package/bin/generate/templates/dto.tpl +2 -4
- package/bin/generate/templates/entity.tpl +2 -4
- package/bin/generate/templates/module.tpl +1 -3
- package/bin/generate/templates/provider.tpl +1 -7
- package/bin/generate/templates/usecase-op.tpl +3 -8
- package/bin/generate/templates/usecase-post.tpl +3 -8
- package/bin/generate/templates/usecase.tpl +3 -8
- package/package.json +142 -139
package/README.md
CHANGED
|
@@ -1,33 +1,110 @@
|
|
|
1
|
-
<
|
|
2
|
-
<a href="https://expresso-ts.com/" target="blank"><img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" width="120" alt="Expresso TS Logo" /></a>
|
|
3
|
-
</p>
|
|
1
|
+
<a name="readme-top"></a>
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
<!-- PROJECT SHIELDS -->
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
[![Contributors][contributors-shield]][contributors-url]
|
|
6
|
+
[![Forks][forks-shield]][forks-url]
|
|
7
|
+
[![Stargazers][stars-shield]][stars-url]
|
|
8
|
+
[![Issues][issues-shield]][issues-url]
|
|
9
|
+
[![MIT License][license-shield]][license-url]
|
|
10
|
+
[![LinkedIn][linkedin-shield]][linkedin-url]
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
<!-- PROJECT LOGO -->
|
|
13
|
+
<br />
|
|
14
|
+
<div align="center">
|
|
15
|
+
<a href="https://github.com/othneildrew/Best-README-Template">
|
|
16
|
+
<img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" alt="Logo" width="120">
|
|
17
|
+
</a>
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
<h3 align="center">ExpressoTS Framework</h3>
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
<p align="center">
|
|
22
|
+
Everything you need to know to build applications with ExpressoTS
|
|
23
|
+
<br />
|
|
24
|
+
<a href="https://doc.expresso-ts.com/"><strong>Explore the docs ยป</strong></a>
|
|
25
|
+
<br />
|
|
26
|
+
<br />
|
|
27
|
+
<a href="https://github.com/expressots/expressots/discussions">Let's discuss</a>
|
|
28
|
+
ยท
|
|
29
|
+
<a href="https://github.com/expressots/expressots/issues">Report Bug</a>
|
|
30
|
+
ยท
|
|
31
|
+
<a href="https://github.com/expressots/expressots/issues">Request Feature</a>
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
14
34
|
|
|
15
|
-
|
|
35
|
+
<!-- TABLE OF CONTENTS -->
|
|
36
|
+
<details>
|
|
37
|
+
<summary>Table of Contents</summary>
|
|
38
|
+
<ol>
|
|
39
|
+
<li><a href="#about-the-project">About The Project</a></li>
|
|
40
|
+
<li><a href="#getting-started">Getting Started</a></li>
|
|
41
|
+
<li><a href="#contributing">Contributing</a></li>
|
|
42
|
+
<li><a href="#support-the-project">Support the project</a></li>
|
|
43
|
+
<li><a href="#license">License</a></li>
|
|
44
|
+
</ol>
|
|
45
|
+
</details>
|
|
16
46
|
|
|
17
|
-
|
|
18
|
-
npm i -g @expressots/cli
|
|
19
|
-
```
|
|
47
|
+
<!-- ABOUT THE PROJECT -->
|
|
20
48
|
|
|
21
|
-
|
|
49
|
+
# About The Project
|
|
22
50
|
|
|
23
|
-
|
|
51
|
+
ExpressoTS is a [Typescript](https://www.typescriptlang.org/) + [Node.js](https://nodejs.org/en/) lightweight framework for quick building scalable, easy to read and maintain, server-side applications ๐
|
|
24
52
|
|
|
25
|
-
##
|
|
53
|
+
## Getting Started
|
|
26
54
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
55
|
+
- Here is our [Site](https://expresso-ts.com/)
|
|
56
|
+
- You can find our [Documentation here](https://doc.expresso-ts.com/)
|
|
57
|
+
- Checkout our [First Steps documentation](https://doc.expresso-ts.com/docs/overview/first-steps)
|
|
58
|
+
- Our [CLI Documentation](https://doc.expresso-ts.com/docs/cli/overview)
|
|
59
|
+
|
|
60
|
+
## Contributing
|
|
61
|
+
|
|
62
|
+
Welcome to the ExpressoTS community, a place bustling with innovative minds just like yours. We're absolutely thrilled to have you here!
|
|
63
|
+
ExpressoTS is more than just a TypeScript framework; it's a collective effort by developers who are passionate about creating a more efficient, secure, and robust web ecosystem. We firmly believe that the best ideas come from a diversity of perspectives, backgrounds, and skills.
|
|
64
|
+
|
|
65
|
+
Why Contribute to Documentation?
|
|
66
|
+
|
|
67
|
+
- **Share Knowledge**: If you've figured out something cool, why keep it to yourself?
|
|
68
|
+
- **Build Your Portfolio**: Contributing to an open-source project like ExpressoTS is a great way to showcase your skills.
|
|
69
|
+
- **Join a Network**: Get to know a community of like-minded developers.
|
|
70
|
+
- **Improve the Product**: Help us fill in the gaps, correct errors, or make complex topics easier to understand.
|
|
71
|
+
|
|
72
|
+
Ready to contribute?
|
|
73
|
+
|
|
74
|
+
- [Contributing Guidelines](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md)
|
|
75
|
+
- [How to Contribute](https://github.com/expressots/expressots/blob/main/CONTRIBUTING_HOWTO.md)
|
|
76
|
+
- [Coding Guidelines](https://github.com/rsaz/TypescriptCodingGuidelines)
|
|
77
|
+
|
|
78
|
+
## Support the project
|
|
79
|
+
|
|
80
|
+
ExpressoTS is an independent open source project with ongoing development made possible thanks to your support. If you'd like to help, please consider:
|
|
81
|
+
|
|
82
|
+
- Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
|
|
83
|
+
- Follow the **[organization](https://github.com/expressots)** on GitHub and Star โญ the project
|
|
84
|
+
- Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
|
|
85
|
+
- Join our **[Discord](https://discord.com/invite/PyPJfGK)**
|
|
86
|
+
- Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues)**
|
|
87
|
+
- Share the project with your friends and colleagues
|
|
30
88
|
|
|
31
89
|
## License
|
|
32
90
|
|
|
33
|
-
|
|
91
|
+
Distributed under the MIT License. See [`LICENSE.txt`](https://github.com/expressots/expressots/blob/main/LICENSE) for more information.
|
|
92
|
+
|
|
93
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
94
|
+
|
|
95
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
|
96
|
+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
|
97
|
+
|
|
98
|
+
[contributors-shield]: https://img.shields.io/github/contributors/expressots/expressots-cli?style=for-the-badge
|
|
99
|
+
[contributors-url]: https://github.com/expressots/expressots-cli/graphs/contributors
|
|
100
|
+
[forks-shield]: https://img.shields.io/github/forks/expressots/expressots-cli?style=for-the-badge
|
|
101
|
+
[forks-url]: https://github.com/expressots/expressots-cli/forks
|
|
102
|
+
[stars-shield]: https://img.shields.io/github/stars/expressots/expressots-cli?style=for-the-badge
|
|
103
|
+
[stars-url]: https://github.com/expressots/expressots-cli/stargazers
|
|
104
|
+
[issues-shield]: https://img.shields.io/github/issues/expressots/expressots-cli?style=for-the-badge
|
|
105
|
+
[issues-url]: https://github.com/expressots/expressots-cli/issues
|
|
106
|
+
[license-shield]: https://img.shields.io/github/license/expressots/expressots-cli?style=for-the-badge
|
|
107
|
+
[license-url]: https://github.com/expressots/expressots-cli/blob/main/LICENSE
|
|
108
|
+
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
|
|
109
|
+
[linkedin-url]: https://www.linkedin.com/company/expresso-ts/
|
|
110
|
+
[product-screenshot]: images/screenshot.png
|
package/bin/cli.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export declare const CLI_VERSION = "1.3.
|
|
2
|
+
export declare const CLI_VERSION = "1.3.4";
|
package/bin/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ const helpers_1 = require("yargs/helpers");
|
|
|
10
10
|
const generate_1 = require("./generate");
|
|
11
11
|
const info_1 = require("./info");
|
|
12
12
|
const new_1 = require("./new");
|
|
13
|
-
exports.CLI_VERSION = "1.3.
|
|
13
|
+
exports.CLI_VERSION = "1.3.4";
|
|
14
14
|
console.log(`\n[๐ Expressots]\n`);
|
|
15
15
|
(0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
16
16
|
.scriptName("expressots")
|
package/bin/generate/form.js
CHANGED
|
@@ -46,7 +46,7 @@ const verify_file_exists_1 = require("../utils/verify-file-exists");
|
|
|
46
46
|
const add_module_to_container_1 = require("../utils/add-module-to-container");
|
|
47
47
|
const cli_ui_1 = require("../utils/cli-ui");
|
|
48
48
|
function getFileNameWithoutExtension(filePath) {
|
|
49
|
-
return filePath.split(
|
|
49
|
+
return filePath.split(".")[0];
|
|
50
50
|
}
|
|
51
51
|
const createTemplate = async ({ schematic, path: target, method, }) => {
|
|
52
52
|
var _a, e_1, _b, _c;
|
|
@@ -69,11 +69,13 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
|
|
|
69
69
|
if (schematic !== "service") {
|
|
70
70
|
// add to guarantee that the routing will always be the last part of the path
|
|
71
71
|
let routeSchema = "";
|
|
72
|
-
if (target.includes("/") ||
|
|
72
|
+
if (target.includes("/") ||
|
|
73
|
+
target.includes("\\") ||
|
|
74
|
+
target.includes("//")) {
|
|
73
75
|
routeSchema = path.split("/").pop();
|
|
74
76
|
}
|
|
75
77
|
else {
|
|
76
|
-
routeSchema = path.replace(/\/$/,
|
|
78
|
+
routeSchema = path.replace(/\/$/, "");
|
|
77
79
|
}
|
|
78
80
|
writeTemplate({
|
|
79
81
|
outputPath: `${usecaseDir}/${path}/${file}`,
|
|
@@ -100,7 +102,8 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
|
|
|
100
102
|
console.log(" ", chalk_1.default.greenBright(`[${currentSchematic}]`.padEnd(14)), chalk_1.default.bold.white(`${schematicFile} created! โ๏ธ`));
|
|
101
103
|
let templateBasedMethod = "";
|
|
102
104
|
if (method) {
|
|
103
|
-
if (resource === "controller-service" ||
|
|
105
|
+
if (resource === "controller-service" ||
|
|
106
|
+
resource === "controller") {
|
|
104
107
|
if (method === "get")
|
|
105
108
|
templateBasedMethod = `./templates/${resource}.tpl`;
|
|
106
109
|
else
|
|
@@ -124,11 +127,13 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
|
|
|
124
127
|
}
|
|
125
128
|
// add to guarantee that the routing will always be the last part of the path
|
|
126
129
|
let routeSchema = "";
|
|
127
|
-
if (target.includes("/") ||
|
|
130
|
+
if (target.includes("/") ||
|
|
131
|
+
target.includes("\\") ||
|
|
132
|
+
target.includes("//")) {
|
|
128
133
|
routeSchema = path.split("/").pop();
|
|
129
134
|
}
|
|
130
135
|
else {
|
|
131
|
-
routeSchema = path.replace(/\/$/,
|
|
136
|
+
routeSchema = path.replace(/\/$/, "");
|
|
132
137
|
}
|
|
133
138
|
writeTemplate({
|
|
134
139
|
outputPath: `${usecaseDir}/${path}/${schematicFile}`,
|
|
@@ -162,7 +167,9 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
|
|
|
162
167
|
if (["controller", "service"].includes(schematic)) {
|
|
163
168
|
let moduleExist = false;
|
|
164
169
|
let moduleOutPath = "";
|
|
165
|
-
if (target.includes("/") ||
|
|
170
|
+
if (target.includes("/") ||
|
|
171
|
+
target.includes("\\") ||
|
|
172
|
+
target.includes("//")) {
|
|
166
173
|
if (modulePath === "") {
|
|
167
174
|
moduleExist = (0, fs_1.existsSync)(`${usecaseDir}/${moduleName}.module.ts`);
|
|
168
175
|
moduleOutPath = `${usecaseDir}/${moduleName}.module.ts`;
|
|
@@ -184,22 +191,26 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
|
|
|
184
191
|
}
|
|
185
192
|
}
|
|
186
193
|
let controllerPath = "./";
|
|
187
|
-
const pathCount =
|
|
194
|
+
const pathCount = path.split("/").length;
|
|
188
195
|
if (path === "") {
|
|
189
|
-
controllerPath += `${file.slice(0, file.lastIndexOf(
|
|
196
|
+
controllerPath += `${file.slice(0, file.lastIndexOf("."))}`;
|
|
190
197
|
}
|
|
191
198
|
else if (pathCount === 1) {
|
|
192
|
-
controllerPath += `${path}/${file.slice(0, file.lastIndexOf(
|
|
199
|
+
controllerPath += `${path}/${file.slice(0, file.lastIndexOf("."))}`;
|
|
193
200
|
}
|
|
194
201
|
else if (pathCount === 2) {
|
|
195
|
-
controllerPath += `${path.split("/")[1]}/${file.slice(0, file.lastIndexOf(
|
|
202
|
+
controllerPath += `${path.split("/")[1]}/${file.slice(0, file.lastIndexOf("."))}`;
|
|
196
203
|
}
|
|
197
204
|
else {
|
|
198
|
-
const segments = path
|
|
199
|
-
|
|
205
|
+
const segments = path
|
|
206
|
+
.split("/")
|
|
207
|
+
.filter((segment) => segment !== "");
|
|
208
|
+
controllerPath += `${segments[segments.length - 1]}/${file.slice(0, file.lastIndexOf("."))}`;
|
|
200
209
|
}
|
|
201
210
|
if (moduleExist) {
|
|
202
|
-
if (target.includes("/") ||
|
|
211
|
+
if (target.includes("/") ||
|
|
212
|
+
target.includes("\\") ||
|
|
213
|
+
target.includes("//")) {
|
|
203
214
|
await (0, add_controller_to_module_1.addControllerToModule)(`${usecaseDir}/${modulePath}/${moduleName}.module.ts`, `${className}Controller`, controllerPath);
|
|
204
215
|
}
|
|
205
216
|
else {
|
|
@@ -219,12 +230,14 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
|
|
|
219
230
|
data: {
|
|
220
231
|
moduleName: moduleName[0].toUpperCase() + moduleName.slice(1),
|
|
221
232
|
className,
|
|
222
|
-
path: controllerPath
|
|
233
|
+
path: controllerPath,
|
|
223
234
|
},
|
|
224
235
|
},
|
|
225
236
|
});
|
|
226
237
|
console.log(" ", chalk_1.default.greenBright(`[module]`.padEnd(14)), chalk_1.default.bold.white(`${moduleName}.module created! โ๏ธ`));
|
|
227
|
-
if (target.includes("/") ||
|
|
238
|
+
if (target.includes("/") ||
|
|
239
|
+
target.includes("\\") ||
|
|
240
|
+
target.includes("//")) {
|
|
228
241
|
await (0, add_module_to_container_1.addModuleToContainer)(moduleName, modulePath, path);
|
|
229
242
|
}
|
|
230
243
|
else {
|
|
@@ -242,30 +255,41 @@ const createTemplate = async ({ schematic, path: target, method, }) => {
|
|
|
242
255
|
};
|
|
243
256
|
exports.createTemplate = createTemplate;
|
|
244
257
|
const splitTarget = async ({ target, schematic, }) => {
|
|
245
|
-
const pathContent = target
|
|
258
|
+
const pathContent = target
|
|
259
|
+
.split("/")
|
|
260
|
+
.filter((item) => item !== "");
|
|
246
261
|
const endsWithSlash = target.endsWith("/");
|
|
247
262
|
let path = "";
|
|
248
263
|
let fileName = "";
|
|
249
264
|
let module = "";
|
|
250
265
|
let modulePath = "";
|
|
251
|
-
if (target.includes("/") ||
|
|
266
|
+
if (target.includes("/") ||
|
|
267
|
+
target.includes("\\") ||
|
|
268
|
+
target.includes("//")) {
|
|
252
269
|
//pathContent = target.split("/").filter((item) => item !== "");
|
|
253
270
|
if (schematic === "service")
|
|
254
271
|
schematic = "controller";
|
|
255
|
-
if (schematic === "service" ||
|
|
272
|
+
if (schematic === "service" ||
|
|
273
|
+
(schematic === "controller" && pathContent.length > 4)) {
|
|
256
274
|
(0, cli_ui_1.printError)("Max path depth is 4.", pathContent.join("/"));
|
|
257
275
|
process.exit(1);
|
|
258
276
|
}
|
|
259
277
|
if (endsWithSlash) {
|
|
260
278
|
fileName = pathContent[pathContent.length - 1];
|
|
261
279
|
path = pathContent.join("/");
|
|
262
|
-
module =
|
|
280
|
+
module =
|
|
281
|
+
pathContent.length == 1
|
|
282
|
+
? pathContent[pathContent.length - 1]
|
|
283
|
+
: pathContent[pathContent.length - 2];
|
|
263
284
|
modulePath = pathContent.slice(0, -1).join("/");
|
|
264
285
|
}
|
|
265
286
|
else {
|
|
266
287
|
fileName = pathContent[pathContent.length - 1];
|
|
267
288
|
path = pathContent.slice(0, -1).join("/");
|
|
268
|
-
module =
|
|
289
|
+
module =
|
|
290
|
+
pathContent.length == 2
|
|
291
|
+
? pathContent[pathContent.length - 2]
|
|
292
|
+
: pathContent[pathContent.length - 3];
|
|
269
293
|
modulePath = pathContent.slice(0, -2).join("/");
|
|
270
294
|
}
|
|
271
295
|
return {
|
|
@@ -273,7 +297,7 @@ const splitTarget = async ({ target, schematic, }) => {
|
|
|
273
297
|
file: `${await getNameWithScaffoldPattern(fileName)}.${schematic}.ts`,
|
|
274
298
|
className: (0, boost_ts_1.anyCaseToPascalCase)(fileName),
|
|
275
299
|
moduleName: module,
|
|
276
|
-
modulePath
|
|
300
|
+
modulePath,
|
|
277
301
|
};
|
|
278
302
|
}
|
|
279
303
|
else {
|
|
@@ -293,7 +317,7 @@ const splitTarget = async ({ target, schematic, }) => {
|
|
|
293
317
|
file: `${await getNameWithScaffoldPattern(name)}.${schematic}.ts`,
|
|
294
318
|
className: (0, boost_ts_1.anyCaseToPascalCase)(name),
|
|
295
319
|
moduleName: wordName,
|
|
296
|
-
modulePath:
|
|
320
|
+
modulePath: pathContent[0].split("-")[1],
|
|
297
321
|
};
|
|
298
322
|
}
|
|
299
323
|
// 3. Return the base case
|
|
@@ -302,22 +326,22 @@ const splitTarget = async ({ target, schematic, }) => {
|
|
|
302
326
|
file: `${await getNameWithScaffoldPattern(name)}.${schematic}.ts`,
|
|
303
327
|
className: (0, boost_ts_1.anyCaseToPascalCase)(name),
|
|
304
328
|
moduleName: name,
|
|
305
|
-
modulePath: ""
|
|
329
|
+
modulePath: "",
|
|
306
330
|
};
|
|
307
331
|
}
|
|
308
332
|
};
|
|
309
333
|
const getHttpMethod = (method) => {
|
|
310
334
|
switch (method) {
|
|
311
335
|
case "put":
|
|
312
|
-
return "
|
|
336
|
+
return "Put";
|
|
313
337
|
case "post":
|
|
314
|
-
return "
|
|
338
|
+
return "Post";
|
|
315
339
|
case "patch":
|
|
316
|
-
return "
|
|
340
|
+
return "Patch";
|
|
317
341
|
case "delete":
|
|
318
|
-
return "
|
|
342
|
+
return "Delete";
|
|
319
343
|
default:
|
|
320
|
-
return "
|
|
344
|
+
return "Get";
|
|
321
345
|
}
|
|
322
346
|
};
|
|
323
347
|
const writeTemplate = ({ outputPath, template: { path, data }, }) => {
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { BaseController, StatusCode } from "@expressots/core";
|
|
2
|
-
import { controller, {{method}},
|
|
2
|
+
import { controller, {{method}}, param, response } from "@expressots/adapter-express";
|
|
3
3
|
import { Response } from "express";
|
|
4
4
|
import { {{className}}UseCase } from "./{{fileName}}.usecase";
|
|
5
5
|
import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
|
|
6
6
|
|
|
7
7
|
@controller("/{{{route}}}")
|
|
8
|
-
class {{className}}Controller extends BaseController {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
super("{{construct}}-controller")
|
|
8
|
+
export class {{className}}Controller extends BaseController {
|
|
9
|
+
constructor(private {{useCase}}UseCase: {{className}}UseCase) {
|
|
10
|
+
super();
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.{{useCase}}UseCase.execute(
|
|
13
|
+
@{{method}}("/:id")
|
|
14
|
+
execute(@param("id") id: string, @response() res: Response): I{{className}}ResponseDTO {
|
|
15
|
+
return this.callUseCase(
|
|
16
|
+
this.{{useCase}}UseCase.execute(id),
|
|
18
17
|
res,
|
|
19
18
|
StatusCode.OK,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
);
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
export { {{className}}Controller };
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { BaseController, StatusCode } from "@expressots/core";
|
|
2
|
-
import { controller, {{method}},
|
|
2
|
+
import { controller, {{method}}, body, param, response } from "@expressots/adapter-express";
|
|
3
3
|
import { Response } from "express";
|
|
4
4
|
import { {{className}}UseCase } from "./{{fileName}}.usecase";
|
|
5
5
|
import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
|
|
6
6
|
|
|
7
7
|
@controller("/{{{route}}}")
|
|
8
|
-
class {{className}}Controller extends BaseController {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
super("{{construct}}-controller")
|
|
8
|
+
export class {{className}}Controller extends BaseController {
|
|
9
|
+
constructor(private {{useCase}}UseCase: {{className}}UseCase) {
|
|
10
|
+
super();
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.{{useCase}}UseCase.execute(id, payload),
|
|
13
|
+
@{{method}}("/")
|
|
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),
|
|
22
20
|
res,
|
|
23
21
|
StatusCode.OK,
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
);
|
|
23
|
+
}
|
|
26
24
|
}
|
|
27
|
-
|
|
28
|
-
export { {{className}}Controller };
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { BaseController, StatusCode } from "@expressots/core";
|
|
2
|
-
import { controller, {{method}},
|
|
2
|
+
import { controller, {{method}}, body, response } from "@expressots/adapter-express";
|
|
3
3
|
import { Response } from "express";
|
|
4
4
|
import { {{className}}UseCase } from "./{{fileName}}.usecase";
|
|
5
5
|
import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
|
|
6
6
|
|
|
7
7
|
@controller("/{{{route}}}")
|
|
8
|
-
class {{className}}Controller extends BaseController {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
super("{{construct}}-controller")
|
|
8
|
+
export class {{className}}Controller extends BaseController {
|
|
9
|
+
constructor(private {{useCase}}UseCase: {{className}}UseCase) {
|
|
10
|
+
super();
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
@{{method}}("/")
|
|
14
|
+
execute(@body() payload: I{{className}}RequestDTO, @response() res: Response): I{{className}}ResponseDTO {
|
|
15
|
+
return this.callUseCase(
|
|
17
16
|
this.{{useCase}}UseCase.execute(payload),
|
|
18
17
|
res,
|
|
19
18
|
StatusCode.Created,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
);
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
export { {{className}}Controller };
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { BaseController, StatusCode } from "@expressots/core";
|
|
2
|
-
import { controller, {{method}},
|
|
2
|
+
import { controller, {{method}}, body, param, response } from "@expressots/adapter-express";
|
|
3
3
|
import { Response } from "express";
|
|
4
4
|
import { {{className}}UseCase } from "./{{fileName}}.usecase";
|
|
5
5
|
import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
|
|
6
6
|
|
|
7
7
|
@controller("/{{{route}}}")
|
|
8
|
-
class {{className}}Controller extends BaseController {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
super("{{construct}}-controller")
|
|
8
|
+
export class {{className}}Controller extends BaseController {
|
|
9
|
+
constructor(private {{useCase}}UseCase: {{className}}UseCase) {
|
|
10
|
+
super();
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.{{useCase}}UseCase.execute(id, payload),
|
|
13
|
+
@{{method}}("/")
|
|
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),
|
|
22
20
|
res,
|
|
23
21
|
StatusCode.OK,
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
);
|
|
23
|
+
}
|
|
26
24
|
}
|
|
27
|
-
|
|
28
|
-
export { {{className}}Controller };
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { BaseController, StatusCode } from "@expressots/core";
|
|
2
|
-
import { controller, {{method}}, response } from "
|
|
2
|
+
import { controller, {{method}}, response } from "@expressots/adapter-express";
|
|
3
3
|
import { Response } from "express";
|
|
4
4
|
import { {{className}}UseCase } from "./{{fileName}}.usecase";
|
|
5
5
|
import { I{{className}}ResponseDTO } from "./{{fileName}}.dto";
|
|
6
6
|
|
|
7
7
|
@controller("/{{{route}}}")
|
|
8
|
-
class {{className}}Controller extends BaseController {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
super("{{construct}}-controller")
|
|
8
|
+
export class {{className}}Controller extends BaseController {
|
|
9
|
+
constructor(private {{useCase}}UseCase: {{className}}UseCase) {
|
|
10
|
+
super();
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
@{{method}}("/")
|
|
14
|
+
execute(@response() res: Response): I{{className}}ResponseDTO {
|
|
15
|
+
return this.callUseCase(
|
|
17
16
|
this.{{useCase}}UseCase.execute(),
|
|
18
17
|
res,
|
|
19
18
|
StatusCode.OK,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
);
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
export { {{className}}Controller };
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { BaseController } from "@expressots/core";
|
|
2
|
-
import { controller, {{method}}
|
|
3
|
-
import { Response } from "express";
|
|
2
|
+
import { controller, {{method}} } from "@expressots/adapter-express";
|
|
4
3
|
|
|
5
4
|
@controller("/{{{route}}}")
|
|
6
|
-
class {{className}}Controller extends BaseController {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@{{method}}("/")
|
|
13
|
-
execute(@response() res: Response) {
|
|
14
|
-
return res.send("Hello Expresso TS");
|
|
15
|
-
}
|
|
5
|
+
export class {{className}}Controller extends BaseController {
|
|
6
|
+
@{{method}}("/")
|
|
7
|
+
execute() {
|
|
8
|
+
return "Ok";
|
|
9
|
+
}
|
|
16
10
|
}
|
|
17
|
-
|
|
18
|
-
export { {{className}}Controller };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
interface I{{className}}RequestDTO {
|
|
1
|
+
export interface I{{className}}RequestDTO {
|
|
2
2
|
id: string;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
interface I{{className}}ResponseDTO { }
|
|
5
|
+
export interface I{{className}}ResponseDTO { }
|
|
6
|
+
|
|
6
7
|
|
|
7
|
-
export { I{{className}}RequestDTO, I{{className}}ResponseDTO };
|
|
@@ -2,12 +2,10 @@ import { provide } from "inversify-binding-decorators";
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
|
|
4
4
|
@provide({{className}})
|
|
5
|
-
class {{className}} {
|
|
6
|
-
|
|
5
|
+
export class {{className}} {
|
|
6
|
+
id: string;
|
|
7
7
|
|
|
8
8
|
constructor() {
|
|
9
9
|
this.id = randomUUID();
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
export { {{className}} };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { CreateModule } from "@expressots/core";
|
|
2
2
|
import { {{className}}Controller } from "{{{path}}}";
|
|
3
3
|
|
|
4
|
-
const {{moduleName}}Module = CreateModule([{{className}}Controller]);
|
|
5
|
-
|
|
6
|
-
export { {{moduleName}}Module };
|
|
4
|
+
export const {{moduleName}}Module = CreateModule([{{className}}Controller]);
|
|
@@ -2,13 +2,8 @@ import { provide } from "inversify-binding-decorators";
|
|
|
2
2
|
import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
|
|
3
3
|
|
|
4
4
|
@provide({{className}}UseCase)
|
|
5
|
-
class {{className}}UseCase {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
execute(id: string, payload: I{{className}}RequestDTO): I{{className}}ResponseDTO {
|
|
10
|
-
return "your use case";
|
|
5
|
+
export class {{className}}UseCase {
|
|
6
|
+
execute(payload: I{{className}}RequestDTO): I{{className}}ResponseDTO {
|
|
7
|
+
return "Use Case";
|
|
11
8
|
}
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
export { {{className}}UseCase };
|
|
@@ -2,13 +2,8 @@ import { provide } from "inversify-binding-decorators";
|
|
|
2
2
|
import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
|
|
3
3
|
|
|
4
4
|
@provide({{className}}UseCase)
|
|
5
|
-
class {{className}}UseCase {
|
|
6
|
-
|
|
7
|
-
constructor() {}
|
|
8
|
-
|
|
5
|
+
export class {{className}}UseCase {
|
|
9
6
|
execute(payload: I{{className}}RequestDTO): I{{className}}ResponseDTO {
|
|
10
|
-
return "
|
|
7
|
+
return "Use Case";
|
|
11
8
|
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { {{className}}UseCase };
|
|
9
|
+
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { provide } from "inversify-binding-decorators";
|
|
2
2
|
|
|
3
3
|
@provide({{className}}UseCase)
|
|
4
|
-
class {{className}}UseCase {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
execute(): string {
|
|
9
|
-
return "your use case";
|
|
4
|
+
export class {{className}}UseCase {
|
|
5
|
+
execute() {
|
|
6
|
+
return "Use Case";
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
export { {{className}}UseCase };
|
package/package.json
CHANGED
|
@@ -1,141 +1,144 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
2
|
+
"name": "@expressots/cli",
|
|
3
|
+
"version": "1.3.4",
|
|
4
|
+
"description": "Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)",
|
|
5
|
+
"author": "Richard Zampieri",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/expressots/expressots-cli/issues"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"expressots": "bin/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18.10.0"
|
|
15
|
+
},
|
|
16
|
+
"funding": {
|
|
17
|
+
"type": "github",
|
|
18
|
+
"url": "https://github.com/sponsors/expressots"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/expressots/expressots-cli"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://expresso-ts.com",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"ExpressoTS",
|
|
30
|
+
"CLI",
|
|
31
|
+
"Scaffolding"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"start:build": "npm run build && npm run start",
|
|
35
|
+
"start": "node ./bin/cli.js",
|
|
36
|
+
"start:dev": "tsnd ./src/cli.ts",
|
|
37
|
+
"build": "npm run clean && tsc -p tsconfig.json && yarn cp:templates && chmod +x ./bin/cli.js",
|
|
38
|
+
"cp:templates": "cp -r ./src/generate/templates ./bin/generate/templates",
|
|
39
|
+
"clean": "rimraf ./bin",
|
|
40
|
+
"lint": "eslint .eslintrc.js --ext .ts,.tsx,.js,.jsx .",
|
|
41
|
+
"release": "release-it",
|
|
42
|
+
"prepare": "husky install"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@expressots/boost-ts": "^1.1.1",
|
|
46
|
+
"chalk-animation": "^1",
|
|
47
|
+
"cli-progress": "^3.11.2",
|
|
48
|
+
"degit": "^2.8.4",
|
|
49
|
+
"glob": "^10.2.6",
|
|
50
|
+
"inquirer": "^8.0.0",
|
|
51
|
+
"mustache": "^4.2.0",
|
|
52
|
+
"ts-node": "^10.9.1",
|
|
53
|
+
"yargs": "^17.6.2"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@commitlint/cli": "^17.7.1",
|
|
57
|
+
"@commitlint/config-conventional": "^17.7.0",
|
|
58
|
+
"@release-it/conventional-changelog": "^7.0.1",
|
|
59
|
+
"@types/chalk-animation": "^1.6.1",
|
|
60
|
+
"@types/cli-progress": "^3.11.0",
|
|
61
|
+
"@types/degit": "^2.8.3",
|
|
62
|
+
"@types/inquirer": "^9.0.3",
|
|
63
|
+
"@types/mustache": "^4.2.2",
|
|
64
|
+
"@types/node": "^18.11.19",
|
|
65
|
+
"@types/yargs": "^17.0.22",
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
67
|
+
"@typescript-eslint/parser": "^5.53.0",
|
|
68
|
+
"chalk": "^4.1.2",
|
|
69
|
+
"eslint": "^8.34.0",
|
|
70
|
+
"eslint-config-prettier": "^8.6.0",
|
|
71
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
72
|
+
"husky": "^8.0.3",
|
|
73
|
+
"prettier": "^2.8.4",
|
|
74
|
+
"release-it": "^16.1.5",
|
|
75
|
+
"rimraf": "^4.1.2",
|
|
76
|
+
"ts-node-dev": "^2.0.0",
|
|
77
|
+
"typescript": "^4.9.5"
|
|
78
|
+
},
|
|
79
|
+
"release-it": {
|
|
80
|
+
"git": {
|
|
81
|
+
"commitMessage": "chore: release v${version}"
|
|
82
|
+
},
|
|
83
|
+
"github": {
|
|
84
|
+
"release": true
|
|
85
|
+
},
|
|
86
|
+
"npm": {
|
|
87
|
+
"publish": false
|
|
88
|
+
},
|
|
89
|
+
"plugins": {
|
|
90
|
+
"@release-it/conventional-changelog": {
|
|
91
|
+
"infile": "CHANGELOG.md",
|
|
92
|
+
"preset": {
|
|
93
|
+
"name": "conventionalcommits",
|
|
94
|
+
"types": [
|
|
95
|
+
{
|
|
96
|
+
"type": "feat",
|
|
97
|
+
"section": "Features"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"type": "fix",
|
|
101
|
+
"section": "Bug Fixes"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "perf",
|
|
105
|
+
"section": "Performance Improvements"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"type": "revert",
|
|
109
|
+
"section": "Reverts"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"type": "docs",
|
|
113
|
+
"section": "Documentation"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"type": "style",
|
|
117
|
+
"section": "Styles"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"type": "refactor",
|
|
121
|
+
"section": "Code Refactoring"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"type": "test",
|
|
125
|
+
"section": "Tests"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"type": "build",
|
|
129
|
+
"section": "Build System"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"type": "ci",
|
|
133
|
+
"section": "Continuous Integrations"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"type": "chore",
|
|
137
|
+
"hidden": true
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
141
144
|
}
|