@tsed/cli 3.20.16 → 3.21.0-rc.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/lib/{Cli.js → cjs/Cli.js} +4 -2
- package/lib/cjs/Cli.js.map +1 -0
- package/lib/{bin → cjs/bin}/tsed.js +1 -1
- package/lib/cjs/bin/tsed.js.map +1 -0
- package/lib/{commands → cjs/commands}/add/AddCmd.js +0 -0
- package/lib/cjs/commands/add/AddCmd.js.map +1 -0
- package/lib/{commands → cjs/commands}/generate/GenerateCmd.js +3 -3
- package/lib/cjs/commands/generate/GenerateCmd.js.map +1 -0
- package/lib/{commands → cjs/commands}/generate/ProviderTypes.js +0 -0
- package/lib/cjs/commands/generate/ProviderTypes.js.map +1 -0
- package/lib/{commands → cjs/commands}/index.js +0 -0
- package/lib/cjs/commands/index.js.map +1 -0
- package/lib/{commands → cjs/commands}/init/InitCmd.js +0 -0
- package/lib/cjs/commands/init/InitCmd.js.map +1 -0
- package/lib/{commands → cjs/commands}/run/RunCmd.js +0 -0
- package/lib/cjs/commands/run/RunCmd.js.map +1 -0
- package/lib/{commands → cjs/commands}/update/UpdateCmd.js +0 -0
- package/lib/cjs/commands/update/UpdateCmd.js.map +1 -0
- package/lib/cjs/constants/index.js +18 -0
- package/lib/cjs/constants/index.js.map +1 -0
- package/lib/{index.js → cjs/index.js} +0 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/ArchitectureConvention.js +0 -0
- package/lib/cjs/interfaces/ArchitectureConvention.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/ProjectConvention.js +0 -0
- package/lib/cjs/interfaces/ProjectConvention.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/index.js +0 -0
- package/lib/cjs/interfaces/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/{pipes → cjs/pipes}/ClassNamePipe.js +0 -0
- package/lib/cjs/pipes/ClassNamePipe.js.map +1 -0
- package/lib/{pipes → cjs/pipes}/OutputFilePathPipe.js +0 -0
- package/lib/cjs/pipes/OutputFilePathPipe.js.map +1 -0
- package/lib/{pipes → cjs/pipes}/RoutePipe.js +0 -0
- package/lib/cjs/pipes/RoutePipe.js.map +1 -0
- package/lib/{pipes → cjs/pipes}/index.js +0 -0
- package/lib/cjs/pipes/index.js.map +1 -0
- package/lib/{services → cjs/services}/Features.js +0 -0
- package/lib/cjs/services/Features.js.map +1 -0
- package/lib/{services → cjs/services}/ProvidersInfoService.js +0 -0
- package/lib/cjs/services/ProvidersInfoService.js.map +1 -0
- package/lib/esm/Cli.js +44 -0
- package/lib/esm/Cli.js.map +1 -0
- package/lib/esm/bin/tsed.js +22 -0
- package/lib/esm/bin/tsed.js.map +1 -0
- package/lib/esm/commands/add/AddCmd.js +58 -0
- package/lib/esm/commands/add/AddCmd.js.map +1 -0
- package/lib/esm/commands/generate/GenerateCmd.js +239 -0
- package/lib/esm/commands/generate/GenerateCmd.js.map +1 -0
- package/lib/esm/commands/generate/ProviderTypes.js +104 -0
- package/lib/esm/commands/generate/ProviderTypes.js.map +1 -0
- package/lib/esm/commands/index.js +7 -0
- package/lib/esm/commands/index.js.map +1 -0
- package/lib/esm/commands/init/InitCmd.js +371 -0
- package/lib/esm/commands/init/InitCmd.js.map +1 -0
- package/lib/esm/commands/run/RunCmd.js +65 -0
- package/lib/esm/commands/run/RunCmd.js.map +1 -0
- package/lib/esm/commands/update/UpdateCmd.js +116 -0
- package/lib/esm/commands/update/UpdateCmd.js.map +1 -0
- package/lib/esm/constants/index.js +14 -0
- package/lib/esm/constants/index.js.map +1 -0
- package/lib/esm/index.js +10 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/interfaces/ArchitectureConvention.js +6 -0
- package/lib/esm/interfaces/ArchitectureConvention.js.map +1 -0
- package/lib/esm/interfaces/ProjectConvention.js +6 -0
- package/lib/esm/interfaces/ProjectConvention.js.map +1 -0
- package/lib/esm/interfaces/index.js +3 -0
- package/lib/esm/interfaces/index.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/pipes/ClassNamePipe.js +42 -0
- package/lib/esm/pipes/ClassNamePipe.js.map +1 -0
- package/lib/esm/pipes/OutputFilePathPipe.js +36 -0
- package/lib/esm/pipes/OutputFilePathPipe.js.map +1 -0
- package/lib/esm/pipes/RoutePipe.js +23 -0
- package/lib/esm/pipes/RoutePipe.js.map +1 -0
- package/lib/esm/pipes/index.js +4 -0
- package/lib/esm/pipes/index.js.map +1 -0
- package/lib/esm/services/Features.js +520 -0
- package/lib/esm/services/Features.js.map +1 -0
- package/lib/esm/services/ProvidersInfoService.js +48 -0
- package/lib/esm/services/ProvidersInfoService.js.map +1 -0
- package/lib/{Cli.d.ts → types/Cli.d.ts} +0 -0
- package/lib/{bin → types/bin}/tsed.d.ts +0 -0
- package/lib/{commands → types/commands}/add/AddCmd.d.ts +0 -0
- package/lib/{commands → types/commands}/generate/GenerateCmd.d.ts +0 -0
- package/lib/{commands → types/commands}/generate/ProviderTypes.d.ts +0 -0
- package/lib/{commands → types/commands}/index.d.ts +0 -0
- package/lib/{commands → types/commands}/init/InitCmd.d.ts +0 -0
- package/lib/{commands → types/commands}/run/RunCmd.d.ts +0 -0
- package/lib/{commands → types/commands}/update/UpdateCmd.d.ts +0 -0
- package/lib/{constants → types/constants}/index.d.ts +1 -0
- package/lib/{index.d.ts → types/index.d.ts} +0 -0
- package/lib/{interfaces → types/interfaces}/ArchitectureConvention.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/ProjectConvention.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/index.d.ts +0 -0
- package/lib/{pipes → types/pipes}/ClassNamePipe.d.ts +0 -0
- package/lib/{pipes → types/pipes}/OutputFilePathPipe.d.ts +0 -0
- package/lib/{pipes → types/pipes}/RoutePipe.d.ts +0 -0
- package/lib/{pipes → types/pipes}/index.d.ts +0 -0
- package/lib/{services → types/services}/Features.d.ts +0 -0
- package/lib/{services → types/services}/ProvidersInfoService.d.ts +0 -0
- package/package.json +43 -28
- package/templates/generate/server.hbs +7 -8
- package/templates/init/src/config/index.ts.hbs +4 -4
- package/templates/init/src/config/logger/index.ts.hbs +1 -1
- package/lib/Cli.js.map +0 -1
- package/lib/bin/tsed.js.map +0 -1
- package/lib/commands/add/AddCmd.js.map +0 -1
- package/lib/commands/generate/GenerateCmd.js.map +0 -1
- package/lib/commands/generate/ProviderTypes.js.map +0 -1
- package/lib/commands/index.js.map +0 -1
- package/lib/commands/init/InitCmd.js.map +0 -1
- package/lib/commands/run/RunCmd.js.map +0 -1
- package/lib/commands/update/UpdateCmd.js.map +0 -1
- package/lib/constants/index.js +0 -10
- package/lib/constants/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/interfaces/ArchitectureConvention.js.map +0 -1
- package/lib/interfaces/ProjectConvention.js.map +0 -1
- package/lib/interfaces/index.js.map +0 -1
- package/lib/pipes/ClassNamePipe.js.map +0 -1
- package/lib/pipes/OutputFilePathPipe.js.map +0 -1
- package/lib/pipes/RoutePipe.js.map +0 -1
- package/lib/pipes/index.js.map +0 -1
- package/lib/services/Features.js.map +0 -1
- package/lib/services/ProvidersInfoService.js.map +0 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
var GenerateCmd_1;
|
|
2
|
+
import { __decorate, __metadata } from "tslib";
|
|
3
|
+
import { Command, Inject, ProjectPackageJson, SrcRendererService } from "@tsed/cli-core";
|
|
4
|
+
import { paramCase, pascalCase } from "change-case";
|
|
5
|
+
import { basename, dirname, join } from "path";
|
|
6
|
+
import globby from "globby";
|
|
7
|
+
import normalizePath from "normalize-path";
|
|
8
|
+
import { ClassNamePipe } from "../../pipes/ClassNamePipe.js";
|
|
9
|
+
import { OutputFilePathPipe } from "../../pipes/OutputFilePathPipe.js";
|
|
10
|
+
import { RoutePipe } from "../../pipes/RoutePipe.js";
|
|
11
|
+
import { ProvidersInfoService } from "../../services/ProvidersInfoService.js";
|
|
12
|
+
import { PROVIDER_TYPES } from "./ProviderTypes.js";
|
|
13
|
+
import { ProjectConvention } from "../../interfaces/ProjectConvention.js";
|
|
14
|
+
const DECORATOR_TYPES = [
|
|
15
|
+
{ name: "Class decorator", value: "class" },
|
|
16
|
+
{ name: "Ts.ED middleware and its decorator", value: "middleware" },
|
|
17
|
+
{ name: "Ts.ED endpoint decorator", value: "endpoint" },
|
|
18
|
+
{ name: "Ts.ED property decorator", value: "prop" },
|
|
19
|
+
{ name: "Ts.ED parameter decorator", value: "param" },
|
|
20
|
+
{ name: "Vanilla Method decorator", value: "method" },
|
|
21
|
+
{ name: "Vanilla Property decorator", value: "property" },
|
|
22
|
+
{ name: "Vanilla Parameter decorator", value: "parameter" },
|
|
23
|
+
{ name: "Generic decorator", value: "generic" }
|
|
24
|
+
];
|
|
25
|
+
const searchFactory = (list) => {
|
|
26
|
+
return async (state, keyword) => {
|
|
27
|
+
if (keyword) {
|
|
28
|
+
return list.filter((item) => item.name.toLowerCase().includes(keyword.toLowerCase()));
|
|
29
|
+
}
|
|
30
|
+
return list;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
let GenerateCmd = GenerateCmd_1 = class GenerateCmd {
|
|
34
|
+
constructor(providersList) {
|
|
35
|
+
this.providersList = providersList;
|
|
36
|
+
PROVIDER_TYPES.forEach((info) => {
|
|
37
|
+
this.providersList.add({
|
|
38
|
+
...info
|
|
39
|
+
}, GenerateCmd_1);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
$prompt(initialOptions) {
|
|
43
|
+
const getName = (state) => initialOptions.name || pascalCase(state.name || initialOptions.name || state.type || initialOptions.type);
|
|
44
|
+
const proposedProviders = this.providersList.findProviders(initialOptions.type);
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
type: "autocomplete",
|
|
48
|
+
name: "type",
|
|
49
|
+
message: "Which type of provider?",
|
|
50
|
+
default: initialOptions.type,
|
|
51
|
+
when: () => proposedProviders.length > 1,
|
|
52
|
+
source: searchFactory(proposedProviders)
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "input",
|
|
56
|
+
name: "name",
|
|
57
|
+
message: "Which name?",
|
|
58
|
+
default: getName,
|
|
59
|
+
when: !initialOptions.name
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
message: "Which platform?",
|
|
63
|
+
type: "list",
|
|
64
|
+
name: "platform",
|
|
65
|
+
when(state) {
|
|
66
|
+
return ["server"].includes(state.type || initialOptions.type);
|
|
67
|
+
},
|
|
68
|
+
choices: [
|
|
69
|
+
{
|
|
70
|
+
name: "Express.js",
|
|
71
|
+
checked: true,
|
|
72
|
+
value: "express"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "Koa.js",
|
|
76
|
+
checked: false,
|
|
77
|
+
value: "koa"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: "input",
|
|
83
|
+
name: "route",
|
|
84
|
+
message: "Which route?",
|
|
85
|
+
when(state) {
|
|
86
|
+
return ["controller", "server"].includes(state.type || initialOptions.type);
|
|
87
|
+
},
|
|
88
|
+
default: (state) => {
|
|
89
|
+
return state.type === "server" ? "/rest" : this.routePipe.transform(getName(state));
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: "list",
|
|
94
|
+
name: "directory",
|
|
95
|
+
message: "Which directory?",
|
|
96
|
+
when(state) {
|
|
97
|
+
return ["controller"].includes(state.type || initialOptions.type);
|
|
98
|
+
},
|
|
99
|
+
choices: this.getDirectories("controllers")
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
type: "autocomplete",
|
|
103
|
+
name: "templateType",
|
|
104
|
+
message: (state) => `Which type of ${state.type || initialOptions.type}?`,
|
|
105
|
+
when(state) {
|
|
106
|
+
return ["decorator"].includes(state.type || initialOptions.type);
|
|
107
|
+
},
|
|
108
|
+
source: searchFactory(DECORATOR_TYPES)
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: "list",
|
|
112
|
+
name: "middlewarePosition",
|
|
113
|
+
message: () => `The middleware should be called:`,
|
|
114
|
+
choices: [
|
|
115
|
+
{ name: "Before the endpoint", value: "before" },
|
|
116
|
+
{ name: "After the endpoint", value: "after" }
|
|
117
|
+
],
|
|
118
|
+
when(state) {
|
|
119
|
+
return ["decorator"].includes(state.type || initialOptions.type) && ["middleware"].includes(state.templateType);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
$mapContext(ctx) {
|
|
125
|
+
const { name = "" } = ctx;
|
|
126
|
+
let { type = "" } = ctx;
|
|
127
|
+
type = type.toLowerCase();
|
|
128
|
+
if (ctx.name === "prisma" && ctx.name) {
|
|
129
|
+
type = "prisma.service";
|
|
130
|
+
}
|
|
131
|
+
const symbolName = this.classNamePipe.transform({ name, type, format: ProjectConvention.DEFAULT });
|
|
132
|
+
const symbolParamName = paramCase(symbolName);
|
|
133
|
+
return {
|
|
134
|
+
...ctx,
|
|
135
|
+
type,
|
|
136
|
+
route: ctx.route ? this.routePipe.transform(ctx.route) : "",
|
|
137
|
+
symbolName,
|
|
138
|
+
symbolParamName,
|
|
139
|
+
symbolPath: normalizePath(this.outputFilePathPipe.transform({
|
|
140
|
+
name,
|
|
141
|
+
type,
|
|
142
|
+
subDir: ctx.directory
|
|
143
|
+
})),
|
|
144
|
+
symbolPathBasename: normalizePath(this.classNamePipe.transform({ name, type })),
|
|
145
|
+
express: ctx.platform === "express",
|
|
146
|
+
koa: ctx.platform === "koa",
|
|
147
|
+
platformSymbol: ctx.platform && pascalCase(`Platform ${ctx.platform}`),
|
|
148
|
+
indexControllerPath: this.projectPackageJson.preferences.convention === ProjectConvention.ANGULAR
|
|
149
|
+
? "./controllers/pages/index.controller"
|
|
150
|
+
: "./controllers/pages/IndexController"
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
async $exec(ctx) {
|
|
154
|
+
const { symbolPath } = ctx;
|
|
155
|
+
if (this.providersList.isMyProvider(ctx.type, GenerateCmd_1)) {
|
|
156
|
+
const type = [ctx.type, ctx.templateType].filter(Boolean).join(".");
|
|
157
|
+
const template = `generate/${type}.hbs`;
|
|
158
|
+
return [
|
|
159
|
+
{
|
|
160
|
+
title: `Generate ${ctx.type} file to '${symbolPath}.ts'`,
|
|
161
|
+
task: () => this.srcRenderService.render(template, ctx, {
|
|
162
|
+
output: `${symbolPath}.ts`
|
|
163
|
+
})
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
title: `Update bin/index`,
|
|
167
|
+
skip() {
|
|
168
|
+
return ctx.type !== "command";
|
|
169
|
+
},
|
|
170
|
+
task: () => {
|
|
171
|
+
return this.srcRenderService.update("bin/index.ts", [
|
|
172
|
+
{
|
|
173
|
+
type: "import",
|
|
174
|
+
content: `import {${ctx.symbolName}} from "./${basename(symbolPath)}";`
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
type: "insert-after",
|
|
178
|
+
pattern: /commands: \[/,
|
|
179
|
+
content: ` ${ctx.symbolName}`
|
|
180
|
+
}
|
|
181
|
+
]);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
];
|
|
185
|
+
}
|
|
186
|
+
return [];
|
|
187
|
+
}
|
|
188
|
+
getDirectories(dir) {
|
|
189
|
+
const directories = globby.sync("**/*", {
|
|
190
|
+
cwd: join(this.srcRenderService.rootDir, dir),
|
|
191
|
+
ignore: ["__*"]
|
|
192
|
+
});
|
|
193
|
+
const set = new Set(directories.map((dir) => {
|
|
194
|
+
return dirname(dir);
|
|
195
|
+
}));
|
|
196
|
+
set.delete(".");
|
|
197
|
+
return [...set];
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
__decorate([
|
|
201
|
+
Inject(),
|
|
202
|
+
__metadata("design:type", ClassNamePipe)
|
|
203
|
+
], GenerateCmd.prototype, "classNamePipe", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
Inject(),
|
|
206
|
+
__metadata("design:type", OutputFilePathPipe)
|
|
207
|
+
], GenerateCmd.prototype, "outputFilePathPipe", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
Inject(),
|
|
210
|
+
__metadata("design:type", RoutePipe)
|
|
211
|
+
], GenerateCmd.prototype, "routePipe", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
Inject(),
|
|
214
|
+
__metadata("design:type", SrcRendererService)
|
|
215
|
+
], GenerateCmd.prototype, "srcRenderService", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
Inject(),
|
|
218
|
+
__metadata("design:type", ProjectPackageJson)
|
|
219
|
+
], GenerateCmd.prototype, "projectPackageJson", void 0);
|
|
220
|
+
GenerateCmd = GenerateCmd_1 = __decorate([
|
|
221
|
+
Command({
|
|
222
|
+
name: "generate",
|
|
223
|
+
alias: "g",
|
|
224
|
+
description: "Generate a new provider class",
|
|
225
|
+
args: {
|
|
226
|
+
type: {
|
|
227
|
+
description: "Type of the provider (Injectable, Controller, Pipe, etc...)",
|
|
228
|
+
type: String
|
|
229
|
+
},
|
|
230
|
+
name: {
|
|
231
|
+
description: "Name of the class",
|
|
232
|
+
type: String
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}),
|
|
236
|
+
__metadata("design:paramtypes", [ProvidersInfoService])
|
|
237
|
+
], GenerateCmd);
|
|
238
|
+
export { GenerateCmd };
|
|
239
|
+
//# sourceMappingURL=GenerateCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenerateCmd.js","sourceRoot":"","sources":["../../../../src/commands/generate/GenerateCmd.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAoB,OAAO,EAAmB,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAC3H,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAC,MAAM,MAAM,CAA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DAAC;AAGvC;IADC,MAAM,EAAE;8BACE,SAAS;8CAAC;AAGrB;IADC,MAAM,EAAE;8BACS,kBAAkB;qDAAC;AAGrC;IADC,MAAM,EAAE;8BACW,kBAAkB;uDAAC;AAd5B,WAAW;IAfvB,OAAO,CAAC;QACP,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,WAAW,EAAE,6DAA6D;gBAC1E,IAAI,EAAE,MAAM;aACb;YACD,IAAI,EAAE;gBACJ,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,MAAM;aACb;SACF;KACF,CAAC;qCAiBmC,oBAAoB;GAhB5C,WAAW,CA8MvB;SA9MY,WAAW","sourcesContent":["import {CliDefaultOptions, Command, CommandProvider, Inject, ProjectPackageJson, SrcRendererService} from \"@tsed/cli-core\";\nimport {paramCase, pascalCase} from \"change-case\";\nimport {basename, dirname, join} from \"path\";\nimport globby from \"globby\";\nimport normalizePath from \"normalize-path\";\nimport {ClassNamePipe} from \"../../pipes/ClassNamePipe\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {RoutePipe} from \"../../pipes/RoutePipe\";\nimport {ProvidersInfoService} from \"../../services/ProvidersInfoService\";\nimport {PROVIDER_TYPES} from \"./ProviderTypes\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\n\nexport interface GenerateCmdContext extends CliDefaultOptions {\n type: string;\n name: string;\n route: string;\n directory: string;\n platform: string;\n templateType: string;\n symbolName: string;\n symbolPath: string;\n symbolPathBasename: string;\n convention: ProjectConvention;\n}\n\nconst DECORATOR_TYPES = [\n {name: \"Class decorator\", value: \"class\"},\n {name: \"Ts.ED middleware and its decorator\", value: \"middleware\"},\n {name: \"Ts.ED endpoint decorator\", value: \"endpoint\"},\n {name: \"Ts.ED property decorator\", value: \"prop\"},\n {name: \"Ts.ED parameter decorator\", value: \"param\"},\n {name: \"Vanilla Method decorator\", value: \"method\"},\n {name: \"Vanilla Property decorator\", value: \"property\"},\n {name: \"Vanilla Parameter decorator\", value: \"parameter\"},\n {name: \"Generic decorator\", value: \"generic\"}\n];\n\nconst searchFactory = (list: any) => {\n return async (state: any, keyword: string) => {\n if (keyword) {\n return list.filter((item: any) => item.name.toLowerCase().includes(keyword.toLowerCase()));\n }\n\n return list;\n };\n};\n\n@Command({\n name: \"generate\",\n alias: \"g\",\n description: \"Generate a new provider class\",\n args: {\n type: {\n description: \"Type of the provider (Injectable, Controller, Pipe, etc...)\",\n type: String\n },\n name: {\n description: \"Name of the class\",\n type: String\n }\n }\n})\nexport class GenerateCmd implements CommandProvider {\n @Inject()\n classNamePipe: ClassNamePipe;\n\n @Inject()\n outputFilePathPipe: OutputFilePathPipe;\n\n @Inject()\n routePipe: RoutePipe;\n\n @Inject()\n srcRenderService: SrcRendererService;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n constructor(private providersList: ProvidersInfoService) {\n PROVIDER_TYPES.forEach((info) => {\n this.providersList.add(\n {\n ...info\n },\n GenerateCmd\n );\n });\n }\n\n $prompt(initialOptions: Partial<GenerateCmdContext>) {\n const getName = (state: any) =>\n initialOptions.name || pascalCase(state.name || initialOptions.name || state.type || initialOptions.type);\n\n const proposedProviders = this.providersList.findProviders(initialOptions.type);\n\n return [\n {\n type: \"autocomplete\",\n name: \"type\",\n message: \"Which type of provider?\",\n default: initialOptions.type,\n when: () => proposedProviders.length > 1,\n source: searchFactory(proposedProviders)\n },\n {\n type: \"input\",\n name: \"name\",\n message: \"Which name?\",\n default: getName,\n when: !initialOptions.name\n },\n {\n message: \"Which platform?\",\n type: \"list\",\n name: \"platform\",\n when(state: any) {\n return [\"server\"].includes(state.type || initialOptions.type);\n },\n choices: [\n {\n name: \"Express.js\",\n checked: true,\n value: \"express\"\n },\n {\n name: \"Koa.js\",\n checked: false,\n value: \"koa\"\n }\n ]\n },\n {\n type: \"input\",\n name: \"route\",\n message: \"Which route?\",\n when(state: any) {\n return [\"controller\", \"server\"].includes(state.type || initialOptions.type);\n },\n default: (state: GenerateCmdContext) => {\n return state.type === \"server\" ? \"/rest\" : this.routePipe.transform(getName(state));\n }\n },\n {\n type: \"list\",\n name: \"directory\",\n message: \"Which directory?\",\n when(state: any) {\n return [\"controller\"].includes(state.type || initialOptions.type);\n },\n choices: this.getDirectories(\"controllers\")\n },\n {\n type: \"autocomplete\",\n name: \"templateType\",\n message: (state: any) => `Which type of ${state.type || initialOptions.type}?`,\n when(state: any) {\n return [\"decorator\"].includes(state.type || initialOptions.type);\n },\n source: searchFactory(DECORATOR_TYPES)\n },\n {\n type: \"list\",\n name: \"middlewarePosition\",\n message: () => `The middleware should be called:`,\n choices: [\n {name: \"Before the endpoint\", value: \"before\"},\n {name: \"After the endpoint\", value: \"after\"}\n ],\n when(state: any) {\n return [\"decorator\"].includes(state.type || initialOptions.type) && [\"middleware\"].includes(state.templateType);\n }\n }\n ];\n }\n\n $mapContext(ctx: Partial<GenerateCmdContext>): GenerateCmdContext {\n const {name = \"\"} = ctx;\n let {type = \"\"} = ctx;\n type = type.toLowerCase();\n\n if (ctx.name === \"prisma\" && ctx.name) {\n type = \"prisma.service\";\n }\n\n const symbolName = this.classNamePipe.transform({name, type, format: ProjectConvention.DEFAULT});\n const symbolParamName = paramCase(symbolName);\n\n return {\n ...ctx,\n type,\n route: ctx.route ? this.routePipe.transform(ctx.route) : \"\",\n symbolName,\n symbolParamName,\n symbolPath: normalizePath(\n this.outputFilePathPipe.transform({\n name,\n type,\n subDir: ctx.directory\n })\n ),\n symbolPathBasename: normalizePath(this.classNamePipe.transform({name, type})),\n express: ctx.platform === \"express\",\n koa: ctx.platform === \"koa\",\n platformSymbol: ctx.platform && pascalCase(`Platform ${ctx.platform}`),\n indexControllerPath:\n this.projectPackageJson.preferences.convention === ProjectConvention.ANGULAR\n ? \"./controllers/pages/index.controller\"\n : \"./controllers/pages/IndexController\"\n } as GenerateCmdContext;\n }\n\n async $exec(ctx: GenerateCmdContext) {\n const {symbolPath} = ctx;\n\n if (this.providersList.isMyProvider(ctx.type, GenerateCmd)) {\n const type = [ctx.type, ctx.templateType].filter(Boolean).join(\".\");\n\n const template = `generate/${type}.hbs`;\n\n return [\n {\n title: `Generate ${ctx.type} file to '${symbolPath}.ts'`,\n task: () =>\n this.srcRenderService.render(template, ctx, {\n output: `${symbolPath}.ts`\n })\n },\n {\n title: `Update bin/index`,\n skip() {\n return ctx.type !== \"command\";\n },\n task: () => {\n return this.srcRenderService.update(\"bin/index.ts\", [\n {\n type: \"import\",\n content: `import {${ctx.symbolName}} from \"./${basename(symbolPath)}\";`\n },\n {\n type: \"insert-after\",\n pattern: /commands: \\[/,\n content: ` ${ctx.symbolName}`\n }\n ]);\n }\n }\n ];\n }\n\n return [];\n }\n\n getDirectories(dir: string) {\n const directories = globby.sync(\"**/*\", {\n cwd: join(this.srcRenderService.rootDir, dir),\n ignore: [\"__*\"]\n });\n\n const set = new Set(\n directories.map((dir) => {\n return dirname(dir);\n })\n );\n\n set.delete(\".\");\n\n return [...set];\n }\n}\n"]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export const PROVIDER_TYPES = [
|
|
2
|
+
{
|
|
3
|
+
name: "Controller",
|
|
4
|
+
value: "controller",
|
|
5
|
+
model: "{{symbolName}}.controller"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
name: "Middleware",
|
|
9
|
+
value: "middleware",
|
|
10
|
+
model: "{{symbolName}}.middleware"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "Service",
|
|
14
|
+
value: "service",
|
|
15
|
+
baseDir: "services",
|
|
16
|
+
model: "{{symbolName}}.service"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "Model",
|
|
20
|
+
value: "model",
|
|
21
|
+
model: "{{symbolName}}.model"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "Interface",
|
|
25
|
+
value: "interface",
|
|
26
|
+
model: "{{symbolName}}.interface?"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "Decorator",
|
|
30
|
+
value: "decorator",
|
|
31
|
+
model: "{{symbolName}}.decorator?"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "Module",
|
|
35
|
+
value: "module",
|
|
36
|
+
model: "{{symbolName}}.module"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Pipe",
|
|
40
|
+
value: "pipe",
|
|
41
|
+
baseDir: "pipes",
|
|
42
|
+
model: "{{symbolName}}.pipe"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "Interceptor",
|
|
46
|
+
value: "interceptor",
|
|
47
|
+
baseDir: "interceptors",
|
|
48
|
+
model: "{{symbolName}}.interceptor"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "Async Factory",
|
|
52
|
+
value: "async.factory",
|
|
53
|
+
baseDir: "services",
|
|
54
|
+
model: "{{symbolName}}.factory?"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "Factory",
|
|
58
|
+
value: "factory",
|
|
59
|
+
baseDir: "services",
|
|
60
|
+
model: "{{symbolName}}.factory?"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "Value",
|
|
64
|
+
value: "value",
|
|
65
|
+
baseDir: "services",
|
|
66
|
+
model: "{{symbolName}}.value?"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "Server",
|
|
70
|
+
value: "server",
|
|
71
|
+
model: "{{symbolName}}.server"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "Exception Filter",
|
|
75
|
+
value: "exception-filter",
|
|
76
|
+
baseDir: "filters",
|
|
77
|
+
model: "{{symbolName}}.exception-filter"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "Response Filter",
|
|
81
|
+
value: "response-filter",
|
|
82
|
+
baseDir: "filters",
|
|
83
|
+
model: "{{symbolName}}.response-filter"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "Command",
|
|
87
|
+
value: "command",
|
|
88
|
+
baseDir: "bin",
|
|
89
|
+
model: "{{symbolName}}.command"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "Prisma Service",
|
|
93
|
+
value: "prisma.service",
|
|
94
|
+
baseDir: "services",
|
|
95
|
+
model: "{{symbolName}}.service"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "Repository",
|
|
99
|
+
value: "repository",
|
|
100
|
+
baseDir: "services",
|
|
101
|
+
model: "{{symbolName}}.repository"
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
//# sourceMappingURL=ProviderTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProviderTypes.js","sourceRoot":"","sources":["../../../../src/commands/generate/ProviderTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;QACE,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,2BAA2B;KACnC;IACD;QACE,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,2BAA2B;KACnC;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,wBAAwB;KAChC;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,sBAAsB;KAC9B;IACD;QACE,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,2BAA2B;KACnC;IACD;QACE,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,2BAA2B;KACnC;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,uBAAuB;KAC/B;I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\n value: \"controller\",\n model: \"{{symbolName}}.controller\"\n },\n {\n name: \"Middleware\",\n value: \"middleware\",\n model: \"{{symbolName}}.middleware\"\n },\n {\n name: \"Service\",\n value: \"service\",\n baseDir: \"services\",\n model: \"{{symbolName}}.service\"\n },\n {\n name: \"Model\",\n value: \"model\",\n model: \"{{symbolName}}.model\"\n },\n {\n name: \"Interface\",\n value: \"interface\",\n model: \"{{symbolName}}.interface?\"\n },\n {\n name: \"Decorator\",\n value: \"decorator\",\n model: \"{{symbolName}}.decorator?\"\n },\n {\n name: \"Module\",\n value: \"module\",\n model: \"{{symbolName}}.module\"\n },\n {\n name: \"Pipe\",\n value: \"pipe\",\n baseDir: \"pipes\",\n model: \"{{symbolName}}.pipe\"\n },\n {\n name: \"Interceptor\",\n value: \"interceptor\",\n baseDir: \"interceptors\",\n model: \"{{symbolName}}.interceptor\"\n },\n {\n name: \"Async Factory\",\n value: \"async.factory\",\n baseDir: \"services\",\n model: \"{{symbolName}}.factory?\"\n },\n {\n name: \"Factory\",\n value: \"factory\",\n baseDir: \"services\",\n model: \"{{symbolName}}.factory?\"\n },\n {\n name: \"Value\",\n value: \"value\",\n baseDir: \"services\",\n model: \"{{symbolName}}.value?\"\n },\n {\n name: \"Server\",\n value: \"server\",\n model: \"{{symbolName}}.server\"\n },\n {\n name: \"Exception Filter\",\n value: \"exception-filter\",\n baseDir: \"filters\",\n model: \"{{symbolName}}.exception-filter\"\n },\n {\n name: \"Response Filter\",\n value: \"response-filter\",\n baseDir: \"filters\",\n model: \"{{symbolName}}.response-filter\"\n },\n {\n name: \"Command\",\n value: \"command\",\n baseDir: \"bin\",\n model: \"{{symbolName}}.command\"\n },\n {\n name: \"Prisma Service\",\n value: \"prisma.service\",\n baseDir: \"services\",\n model: \"{{symbolName}}.service\"\n },\n {\n name: \"Repository\",\n value: \"repository\",\n baseDir: \"services\",\n model: \"{{symbolName}}.repository\"\n }\n];\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InitCmd } from "./init/InitCmd.js";
|
|
2
|
+
import { GenerateCmd } from "./generate/GenerateCmd.js";
|
|
3
|
+
import { UpdateCmd } from "./update/UpdateCmd.js";
|
|
4
|
+
import { AddCmd } from "./add/AddCmd.js";
|
|
5
|
+
import { RunCmd } from "./run/RunCmd.js";
|
|
6
|
+
export default [AddCmd, InitCmd, GenerateCmd, UpdateCmd, RunCmd];
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEpC,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import {InitCmd} from \"./init/InitCmd\";\nimport {GenerateCmd} from \"./generate/GenerateCmd\";\nimport {UpdateCmd} from \"./update/UpdateCmd\";\nimport {AddCmd} from \"./add/AddCmd\";\nimport {RunCmd} from \"./run/RunCmd\";\n\nexport default [AddCmd, InitCmd, GenerateCmd, UpdateCmd, RunCmd];\n"]}
|