@expressots/cli 1.6.0 → 1.7.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.
- package/bin/@types/config.d.ts +9 -0
- package/bin/app.container.js +4 -5
- package/bin/cli.d.ts +1 -1
- package/bin/cli.js +2 -2
- package/bin/generate/cli.js +2 -2
- package/bin/generate/form.d.ts +13 -0
- package/bin/generate/form.js +17 -377
- package/bin/generate/templates/nonopinionated/controller.tpl +4 -0
- package/bin/generate/templates/nonopinionated/dto.tpl +3 -0
- package/bin/generate/templates/nonopinionated/entity.tpl +4 -0
- package/bin/generate/templates/nonopinionated/middleware.tpl +10 -0
- package/bin/generate/templates/nonopinionated/module.tpl +4 -0
- package/bin/generate/templates/nonopinionated/provider.tpl +4 -0
- package/bin/generate/templates/nonopinionated/usecase.tpl +4 -0
- package/bin/generate/templates/{controller-service-delete.tpl → opinionated/controller-service-delete.tpl} +2 -2
- package/bin/generate/templates/{controller-service.tpl → opinionated/controller-service-get.tpl} +2 -2
- package/bin/generate/templates/{controller-service-patch.tpl → opinionated/controller-service-patch.tpl} +2 -2
- package/bin/generate/templates/{controller-service-post.tpl → opinionated/controller-service-post.tpl} +2 -2
- package/bin/generate/templates/{controller-service-put.tpl → opinionated/controller-service-put.tpl} +2 -2
- package/bin/generate/templates/{entity.tpl → opinionated/entity.tpl} +2 -2
- package/bin/generate/templates/opinionated/usecase-service-delete.tpl +8 -0
- package/bin/generate/utils/command-utils.d.ts +123 -0
- package/bin/generate/utils/command-utils.js +310 -0
- package/bin/generate/utils/nonopininated-cmd.d.ts +9 -0
- package/bin/generate/utils/nonopininated-cmd.js +248 -0
- package/bin/generate/utils/opinionated-cmd.d.ts +11 -0
- package/bin/generate/utils/opinionated-cmd.js +480 -0
- package/bin/help/cli.d.ts +4 -0
- package/bin/help/cli.js +15 -0
- package/bin/help/form.d.ts +2 -0
- package/bin/help/form.js +28 -0
- package/bin/help/index.d.ts +1 -0
- package/bin/help/index.js +2 -0
- package/bin/info/form.d.ts +1 -1
- package/bin/info/form.js +8 -11
- package/bin/new/form.js +1 -0
- package/bin/utils/add-controller-to-module.d.ts +1 -2
- package/bin/utils/add-module-to-container.d.ts +2 -1
- package/bin/utils/add-module-to-container.js +37 -4
- package/bin/utils/cli-ui.d.ts +2 -0
- package/bin/utils/cli-ui.js +10 -2
- package/bin/utils/verify-file-exists.d.ts +1 -1
- package/bin/utils/verify-file-exists.js +6 -4
- package/package.json +4 -1
- package/bin/generate/templates/dto-op.tpl +0 -7
- package/bin/generate/templates/usecase-post.tpl +0 -9
- /package/bin/generate/templates/{controller.tpl → opinionated/controller-service.tpl} +0 -0
- /package/bin/generate/templates/{dto.tpl → opinionated/dto.tpl} +0 -0
- /package/bin/generate/templates/{middleware.tpl → opinionated/middleware.tpl} +0 -0
- /package/bin/generate/templates/{module.tpl → opinionated/module-service.tpl} +0 -0
- /package/bin/generate/templates/{module-default.tpl → opinionated/module.tpl} +0 -0
- /package/bin/generate/templates/{provider.tpl → opinionated/provider.tpl} +0 -0
- /package/bin/generate/templates/{usecase-op.tpl → opinionated/usecase-service.tpl} +0 -0
- /package/bin/generate/templates/{usecase.tpl → opinionated/usecase.tpl} +0 -0
package/bin/utils/cli-ui.js
CHANGED
|
@@ -3,9 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.printError = void 0;
|
|
6
|
+
exports.printGenerateSuccess = exports.printGenerateError = exports.printError = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
function printError(message, component) {
|
|
9
|
-
console.error(chalk_1.default.red(
|
|
9
|
+
console.error(chalk_1.default.red(`${message}:`, chalk_1.default.bold(chalk_1.default.white(`[${component}] ❌`))));
|
|
10
10
|
}
|
|
11
11
|
exports.printError = printError;
|
|
12
|
+
async function printGenerateError(schematic, file) {
|
|
13
|
+
console.error(" ", chalk_1.default.redBright(`[${schematic}]`.padEnd(14)), chalk_1.default.bold.white(`${file.split(".")[0]} not created! ❌`));
|
|
14
|
+
}
|
|
15
|
+
exports.printGenerateError = printGenerateError;
|
|
16
|
+
async function printGenerateSuccess(schematic, file) {
|
|
17
|
+
console.log(" ", chalk_1.default.greenBright(`[${schematic}]`.padEnd(14)), chalk_1.default.bold.white(`${file.split(".")[0]} created! ✔️`));
|
|
18
|
+
}
|
|
19
|
+
exports.printGenerateSuccess = printGenerateSuccess;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function verifyIfFileExists(path: string): Promise<void>;
|
|
1
|
+
declare function verifyIfFileExists(path: string, schematic?: string): Promise<void>;
|
|
2
2
|
export { verifyIfFileExists };
|
|
@@ -7,20 +7,22 @@ exports.verifyIfFileExists = void 0;
|
|
|
7
7
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const cli_ui_1 = require("./cli-ui");
|
|
10
|
-
async function verifyIfFileExists(path) {
|
|
10
|
+
async function verifyIfFileExists(path, schematic) {
|
|
11
11
|
const fileExists = node_fs_1.default.existsSync(path);
|
|
12
|
+
const fileName = path.split("/").pop();
|
|
12
13
|
if (fileExists) {
|
|
13
14
|
const answer = await inquirer_1.default.prompt([
|
|
14
15
|
{
|
|
15
16
|
type: "confirm",
|
|
16
17
|
name: "confirm",
|
|
17
|
-
message:
|
|
18
|
+
message: `File [${fileName}] exists. Overwrite?`,
|
|
18
19
|
default: true,
|
|
19
20
|
},
|
|
20
21
|
]);
|
|
21
|
-
const fileName = path.split("/").pop();
|
|
22
22
|
if (!answer.confirm) {
|
|
23
|
-
|
|
23
|
+
schematic
|
|
24
|
+
? (0, cli_ui_1.printGenerateError)(schematic, fileName)
|
|
25
|
+
: (0, cli_ui_1.printError)("File not created!", fileName);
|
|
24
26
|
process.exit(1);
|
|
25
27
|
}
|
|
26
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)",
|
|
5
5
|
"author": "Richard Zampieri",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
"build": "npm run clean && tsc -p tsconfig.json && yarn cp:templates && chmod +x ./bin/cli.js",
|
|
39
39
|
"cp:templates": "cp -r ./src/generate/templates ./bin/generate/templates && cp -r ./src/providers/prisma/templates ./bin/providers/prisma/templates",
|
|
40
40
|
"clean": "rimraf ./bin",
|
|
41
|
+
"prepublish": "npm run build && npm pack",
|
|
42
|
+
"publish": "npm publish --tag latest",
|
|
41
43
|
"format": "prettier --write \"./src/**/*.ts\" --cache",
|
|
42
44
|
"lint": "eslint \"./src/**/*.ts\"",
|
|
43
45
|
"lint:fix": "eslint \"./src/**/*.ts\" --fix",
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
"@expressots/boost-ts": "1.1.1",
|
|
51
53
|
"chalk-animation": "2.0.3",
|
|
52
54
|
"cli-progress": "3.11.2",
|
|
55
|
+
"cli-table3": "^0.6.4",
|
|
53
56
|
"degit": "2.8.4",
|
|
54
57
|
"glob": "10.2.6",
|
|
55
58
|
"inquirer": "8.0.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { provide } from "inversify-binding-decorators";
|
|
2
|
-
import { I{{className}}RequestDTO, I{{className}}ResponseDTO } from "./{{fileName}}.dto";
|
|
3
|
-
|
|
4
|
-
@provide({{className}}UseCase)
|
|
5
|
-
export class {{className}}UseCase {
|
|
6
|
-
execute(payload: I{{className}}RequestDTO): I{{className}}ResponseDTO {
|
|
7
|
-
return "Use Case";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|