@tsed/cli 3.25.0 → 3.26.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/lib/cjs/Cli.js.map +1 -1
- package/lib/cjs/commands/generate/GenerateCmd.js +4 -8
- package/lib/cjs/commands/generate/GenerateCmd.js.map +1 -1
- package/lib/cjs/commands/init/InitCmd.js +102 -40
- package/lib/cjs/commands/init/InitCmd.js.map +1 -1
- package/lib/cjs/commands/init/config/FeaturesPrompt.js +406 -0
- package/lib/cjs/commands/init/config/FeaturesPrompt.js.map +1 -0
- package/lib/cjs/commands/init/config/InitFileSchema.js +53 -0
- package/lib/cjs/commands/init/config/InitFileSchema.js.map +1 -0
- package/lib/cjs/commands/init/interfaces/InitCmdContext.js +3 -0
- package/lib/cjs/commands/init/interfaces/InitCmdContext.js.map +1 -0
- package/lib/cjs/commands/init/interfaces/InitOptions.js +3 -0
- package/lib/cjs/commands/init/interfaces/InitOptions.js.map +1 -0
- package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js +3 -0
- package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
- package/lib/cjs/commands/init/mappers/mapToContext.js +16 -0
- package/lib/cjs/commands/init/mappers/mapToContext.js.map +1 -0
- package/lib/cjs/commands/init/mappers/mapUniqFeatures.js +18 -0
- package/lib/cjs/commands/init/mappers/mapUniqFeatures.js.map +1 -0
- package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js +25 -0
- package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
- package/lib/cjs/commands/init/utils/hasFeature.js +13 -0
- package/lib/cjs/commands/init/utils/hasFeature.js.map +1 -0
- package/lib/cjs/commands/init/utils/isPlatform.js +8 -0
- package/lib/cjs/commands/init/utils/isPlatform.js.map +1 -0
- package/lib/cjs/index.js +5 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/PlatformType.js +9 -0
- package/lib/cjs/interfaces/PlatformType.js.map +1 -0
- package/lib/cjs/interfaces/index.js +1 -0
- package/lib/cjs/interfaces/index.js.map +1 -1
- package/lib/cjs/utils/fillImports.js +48 -0
- package/lib/cjs/utils/fillImports.js.map +1 -0
- package/lib/esm/Cli.js.map +1 -1
- package/lib/esm/commands/generate/GenerateCmd.js +4 -8
- package/lib/esm/commands/generate/GenerateCmd.js.map +1 -1
- package/lib/esm/commands/init/InitCmd.js +105 -43
- package/lib/esm/commands/init/InitCmd.js.map +1 -1
- package/lib/esm/commands/init/config/FeaturesPrompt.js +402 -0
- package/lib/esm/commands/init/config/FeaturesPrompt.js.map +1 -0
- package/lib/esm/commands/init/config/InitFileSchema.js +50 -0
- package/lib/esm/commands/init/config/InitFileSchema.js.map +1 -0
- package/lib/esm/commands/init/interfaces/InitCmdContext.js +2 -0
- package/lib/esm/commands/init/interfaces/InitCmdContext.js.map +1 -0
- package/lib/esm/commands/init/interfaces/InitOptions.js +2 -0
- package/lib/esm/commands/init/interfaces/InitOptions.js.map +1 -0
- package/lib/esm/commands/init/interfaces/InitPromptAnswers.js +2 -0
- package/lib/esm/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
- package/lib/esm/commands/init/mappers/mapToContext.js +12 -0
- package/lib/esm/commands/init/mappers/mapToContext.js.map +1 -0
- package/lib/esm/commands/init/mappers/mapUniqFeatures.js +14 -0
- package/lib/esm/commands/init/mappers/mapUniqFeatures.js.map +1 -0
- package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +21 -0
- package/lib/esm/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
- package/lib/esm/commands/init/utils/hasFeature.js +8 -0
- package/lib/esm/commands/init/utils/hasFeature.js.map +1 -0
- package/lib/esm/commands/init/utils/isPlatform.js +4 -0
- package/lib/esm/commands/init/utils/isPlatform.js.map +1 -0
- package/lib/esm/index.js +5 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/PlatformType.js +6 -0
- package/lib/esm/interfaces/PlatformType.js.map +1 -0
- package/lib/esm/interfaces/index.js +1 -0
- package/lib/esm/interfaces/index.js.map +1 -1
- package/lib/esm/utils/fillImports.js +44 -0
- package/lib/esm/utils/fillImports.js.map +1 -0
- package/lib/types/Cli.d.ts +2 -2
- package/lib/types/commands/init/InitCmd.d.ts +9 -24
- package/lib/types/commands/init/config/FeaturesPrompt.d.ts +98 -0
- package/lib/types/commands/init/config/InitFileSchema.d.ts +49 -0
- package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +6 -0
- package/lib/types/commands/init/interfaces/InitOptions.d.ts +19 -0
- package/lib/types/commands/init/interfaces/InitPromptAnswers.d.ts +16 -0
- package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -0
- package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +3 -0
- package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +2 -0
- package/lib/types/commands/init/utils/hasFeature.d.ts +2 -0
- package/lib/types/commands/init/utils/isPlatform.d.ts +1 -0
- package/lib/types/index.d.ts +5 -1
- package/lib/types/interfaces/PlatformType.d.ts +4 -0
- package/lib/types/interfaces/index.d.ts +1 -0
- package/lib/types/utils/fillImports.d.ts +1 -0
- package/package.json +4 -2
- package/readme.md +97 -0
- package/templates/generate/server.hbs +4 -23
- package/templates/init/.barrelsby.json.hbs +1 -7
- package/lib/cjs/services/Features.js +0 -528
- package/lib/cjs/services/Features.js.map +0 -1
- package/lib/esm/services/Features.js +0 -519
- package/lib/esm/services/Features.js.map +0 -1
- package/lib/types/services/Features.d.ts +0 -412
package/readme.md
CHANGED
|
@@ -48,6 +48,103 @@ https_proxy=http://username:password@host:port
|
|
|
48
48
|
> Note: The following environment variables can be also used to configure the proxy `HTTPS_PROXY`, `HTTP_PROXY`
|
|
49
49
|
> and `NODE_TLS_REJECT_UNAUTHORIZED`.
|
|
50
50
|
|
|
51
|
+
## Commands
|
|
52
|
+
|
|
53
|
+
```shell
|
|
54
|
+
Usage: tsed [options] [command]
|
|
55
|
+
|
|
56
|
+
Options:
|
|
57
|
+
-V, --version output the version number
|
|
58
|
+
-h, --help display help for command
|
|
59
|
+
|
|
60
|
+
Commands:
|
|
61
|
+
add [options] [name] Add cli plugin to the current project
|
|
62
|
+
generate|g [options] [type] [name] Generate a new provider class
|
|
63
|
+
update [options] Update all Ts.ED packages used by your project
|
|
64
|
+
init [options] [root] Init a new Ts.ED project
|
|
65
|
+
run [options] <command> Run a project level command
|
|
66
|
+
help [command] display help for commands
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Init project
|
|
70
|
+
|
|
71
|
+
```shell
|
|
72
|
+
Usage: tsed init [options] [root]
|
|
73
|
+
|
|
74
|
+
Init a new Ts.ED project
|
|
75
|
+
|
|
76
|
+
Arguments:
|
|
77
|
+
root Root directory to initialize the Ts.ED project (default: ".")
|
|
78
|
+
|
|
79
|
+
Options:
|
|
80
|
+
-n, --project-name <projectName> Set the project name. By default, the project is the same as the name directory. (default: "")
|
|
81
|
+
-a, --arch <architecture> Set the default architecture convention (default or feature) (default: "default")
|
|
82
|
+
-c, --convention <convention> Set the default project convention (default or feature) (default: "default")
|
|
83
|
+
-p, --platform <platform> Set the default platform for Ts.ED (express or koa) (default: "express")
|
|
84
|
+
--features <features...> List of the Ts.ED features. (default: [])
|
|
85
|
+
-m, --package-manager <packageManager> The default package manager to install the project (default: "yarn")
|
|
86
|
+
-t, --tsed-version <version> Use a specific version of Ts.ED (format: 5.x.x). (default: "latest")
|
|
87
|
+
-f, --file <path> Location of a file in which the features are defined.
|
|
88
|
+
-s, --skip-prompt Skip the prompt. (default: false)
|
|
89
|
+
-r, --root-dir <path> Project root directory
|
|
90
|
+
--verbose Verbose mode
|
|
91
|
+
-h, --help display help for command
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Interactive prompt:
|
|
95
|
+
|
|
96
|
+
```shell
|
|
97
|
+
tsed init .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Skip prompt:
|
|
101
|
+
|
|
102
|
+
```shell
|
|
103
|
+
tsed init . --platform express --package-manager yarn --features swagger,jest,eslint,lintstaged,prettier --skip-prompt
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Use file to generate project
|
|
107
|
+
|
|
108
|
+
A file can be defined to generate project. For example create a `tsed.template.yml` and add this code:
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
projectName: project-example
|
|
112
|
+
platform: express
|
|
113
|
+
architecture: default
|
|
114
|
+
convention: default
|
|
115
|
+
skipPrompt: true
|
|
116
|
+
packageManager: yarn
|
|
117
|
+
features:
|
|
118
|
+
- graphql
|
|
119
|
+
- socketio
|
|
120
|
+
- swagger
|
|
121
|
+
- oidc
|
|
122
|
+
- passportjs
|
|
123
|
+
- commands
|
|
124
|
+
- db
|
|
125
|
+
- prisma
|
|
126
|
+
- mongoose
|
|
127
|
+
- typeorm
|
|
128
|
+
- typeorm:mysql
|
|
129
|
+
- testing
|
|
130
|
+
- jest
|
|
131
|
+
- mocha
|
|
132
|
+
- linter
|
|
133
|
+
- eslint
|
|
134
|
+
- lintstaged
|
|
135
|
+
- prettier
|
|
136
|
+
- bundler
|
|
137
|
+
- babel
|
|
138
|
+
- babel:webpack
|
|
139
|
+
```
|
|
140
|
+
> Note: The CLI support `yml` and `json` file!
|
|
141
|
+
|
|
142
|
+
Then:
|
|
143
|
+
|
|
144
|
+
```shell
|
|
145
|
+
tsed init . --file ./tsed.template.yml
|
|
146
|
+
```
|
|
147
|
+
|
|
51
148
|
## Run Cli from code
|
|
52
149
|
|
|
53
150
|
```typescript
|
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import {join} from "path";
|
|
2
2
|
import {Configuration, Inject} from "@tsed/di";
|
|
3
3
|
import {PlatformApplication} from "@tsed/common";
|
|
4
|
-
{{#if
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import methodOverride from "method-override";
|
|
9
|
-
import cors from "cors";
|
|
10
|
-
{{/if}}{{#if koa}}import "@tsed/platform-koa"; // /!\ keep this import
|
|
11
|
-
import bodyParser from "koa-bodyparser";
|
|
12
|
-
import compress from "koa-compress";
|
|
13
|
-
import cors from "@koa/cors";
|
|
14
|
-
import methodOverride from "koa-override";
|
|
15
|
-
{{/if}}
|
|
16
|
-
import "@tsed/ajv";{{#if swagger}}
|
|
17
|
-
import "@tsed/swagger";{{/if}}{{#if mongoose}}
|
|
18
|
-
import "@tsed/mongoose";{{/if}}{{#if oidc}}
|
|
19
|
-
import "@tsed/oidc-provider";{{/if}}{{#if graphql}}
|
|
20
|
-
import "@tsed/typegraphql";
|
|
21
|
-
import "./datasources/index";
|
|
22
|
-
import "./resolvers/index";{{/if}}
|
|
23
|
-
import {config} from "./config/index";
|
|
24
|
-
import * as rest from "./controllers/rest/index";{{#if swagger}}
|
|
25
|
-
import * as pages from "./controllers/pages/index";{{/if}}{{#if oidc}}
|
|
26
|
-
import {InteractionsController} from "./controllers/oidc/InteractionsController";{{/if}}
|
|
4
|
+
{{#forEach imports}}{{#if tsIngore}}
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
{{/if}}import {{symbols}}{{#if symbols}} from {{/if}}"{{from}}";{{comment}}
|
|
7
|
+
{{/forEach}}
|
|
27
8
|
|
|
28
9
|
@Configuration({
|
|
29
10
|
...config,
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"directory":
|
|
3
|
-
"./src/controllers/rest"{{#or swagger oidc}},
|
|
4
|
-
"./src/controllers/pages"{{/or}}{{#if oidc}},
|
|
5
|
-
"./src/interactions"{{/if}}{{#if graphql}},
|
|
6
|
-
"./src/datasources",
|
|
7
|
-
"./src/resolvers"{{/if}}
|
|
8
|
-
],
|
|
2
|
+
"directory": {{{barrels}}},
|
|
9
3
|
"exclude": [
|
|
10
4
|
"__mock__",
|
|
11
5
|
"__mocks__",
|
|
@@ -1,528 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFeaturesChoicesValues = exports.parseFeaturesFile = exports.FEATURES_TYPEORM_CONNECTION_TYPES = exports.isPlatform = exports.hasValue = exports.hasFeature = exports.Features = void 0;
|
|
4
|
-
const cli_core_1 = require("@tsed/cli-core");
|
|
5
|
-
const core_1 = require("@tsed/core");
|
|
6
|
-
const interfaces_1 = require("../interfaces");
|
|
7
|
-
function Features() {
|
|
8
|
-
return (0, cli_core_1.Inject)(Features);
|
|
9
|
-
}
|
|
10
|
-
exports.Features = Features;
|
|
11
|
-
function hasFeature(feature) {
|
|
12
|
-
return (ctx) => !!ctx.features.find((item) => item.type === feature);
|
|
13
|
-
}
|
|
14
|
-
exports.hasFeature = hasFeature;
|
|
15
|
-
function hasValue(expression, value) {
|
|
16
|
-
return (ctx) => (0, core_1.getValue)(expression, ctx) === value;
|
|
17
|
-
}
|
|
18
|
-
exports.hasValue = hasValue;
|
|
19
|
-
function isPlatform(...types) {
|
|
20
|
-
return (ctx) => [types].includes(ctx.platform);
|
|
21
|
-
}
|
|
22
|
-
exports.isPlatform = isPlatform;
|
|
23
|
-
exports.FEATURES_TYPEORM_CONNECTION_TYPES = [
|
|
24
|
-
{
|
|
25
|
-
name: "MySQL",
|
|
26
|
-
value: {
|
|
27
|
-
type: "typeorm:mysql",
|
|
28
|
-
dependencies: {
|
|
29
|
-
mysql2: "latest"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "MariaDB",
|
|
35
|
-
value: {
|
|
36
|
-
type: "typeorm:mariadb",
|
|
37
|
-
dependencies: {
|
|
38
|
-
mariadb: "latest"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "Postgres",
|
|
44
|
-
value: {
|
|
45
|
-
type: "typeorm:postgres",
|
|
46
|
-
dependencies: {
|
|
47
|
-
pg: "latest"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "CockRoachDB",
|
|
53
|
-
value: {
|
|
54
|
-
type: "typeorm:postgres",
|
|
55
|
-
dependencies: {
|
|
56
|
-
cockroachdb: "latest"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "SQLite",
|
|
62
|
-
value: {
|
|
63
|
-
type: "typeorm:sqlite",
|
|
64
|
-
dependencies: {
|
|
65
|
-
sqlite3: "latest"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "Better SQLite3",
|
|
71
|
-
value: {
|
|
72
|
-
type: "typeorm:better-sqlite3",
|
|
73
|
-
dependencies: {
|
|
74
|
-
"better-sqlite3": "latest"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: "Cordova",
|
|
80
|
-
value: {
|
|
81
|
-
type: "typeorm:cordova"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "NativeScript",
|
|
86
|
-
value: {
|
|
87
|
-
type: "typeorm:nativescript"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "Oracle",
|
|
92
|
-
value: {
|
|
93
|
-
type: "typeorm:oracle",
|
|
94
|
-
dependencies: {
|
|
95
|
-
oracledb: "latest"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "MsSQL",
|
|
101
|
-
value: {
|
|
102
|
-
type: "typeorm:mssql",
|
|
103
|
-
dependencies: {
|
|
104
|
-
mssql: "latest"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "MongoDB",
|
|
110
|
-
value: {
|
|
111
|
-
type: "typeorm:mongodb",
|
|
112
|
-
dependencies: {
|
|
113
|
-
mongodb: "latest"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: "SQL.js",
|
|
119
|
-
value: {
|
|
120
|
-
type: "typeorm:sqljs",
|
|
121
|
-
dependencies: {}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "ReactNative",
|
|
126
|
-
value: {
|
|
127
|
-
type: "typeorm:reactnative",
|
|
128
|
-
dependencies: {}
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: "Expo",
|
|
133
|
-
value: {
|
|
134
|
-
type: "typeorm:expo",
|
|
135
|
-
dependencies: {}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
];
|
|
139
|
-
const babelDevDependencies = {
|
|
140
|
-
"@babel/cli": "latest",
|
|
141
|
-
"@babel/core": "latest",
|
|
142
|
-
"@babel/node": "latest",
|
|
143
|
-
"@babel/plugin-proposal-class-properties": "latest",
|
|
144
|
-
"@babel/plugin-proposal-decorators": "latest",
|
|
145
|
-
"@babel/preset-env": "latest",
|
|
146
|
-
"@babel/preset-typescript": "latest",
|
|
147
|
-
"babel-plugin-transform-typescript-metadata": "latest",
|
|
148
|
-
"babel-watch": "latest"
|
|
149
|
-
};
|
|
150
|
-
const platformChoices = [
|
|
151
|
-
{
|
|
152
|
-
name: "Express.js",
|
|
153
|
-
checked: true,
|
|
154
|
-
value: "express"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "Koa.js",
|
|
158
|
-
checked: false,
|
|
159
|
-
value: "koa"
|
|
160
|
-
}
|
|
161
|
-
];
|
|
162
|
-
const conventionChoices = [
|
|
163
|
-
{
|
|
164
|
-
name: "Ts.ED",
|
|
165
|
-
checked: true,
|
|
166
|
-
value: interfaces_1.ProjectConvention.DEFAULT
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: "Angular",
|
|
170
|
-
checked: false,
|
|
171
|
-
value: interfaces_1.ProjectConvention.ANGULAR
|
|
172
|
-
}
|
|
173
|
-
];
|
|
174
|
-
const featureChoices = (cliVersion) => [
|
|
175
|
-
{
|
|
176
|
-
name: "TypeGraphQL",
|
|
177
|
-
value: {
|
|
178
|
-
type: "graphql",
|
|
179
|
-
dependencies: {
|
|
180
|
-
"@tsed/typegraphql": "{{tsedVersion}}"
|
|
181
|
-
},
|
|
182
|
-
devDependencies: {
|
|
183
|
-
"@tsed/cli-plugin-typegraphql": cliVersion
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: "Database",
|
|
189
|
-
value: { type: "db" }
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: "Passport.js",
|
|
193
|
-
when: isPlatform("express"),
|
|
194
|
-
value: {
|
|
195
|
-
type: "passportjs",
|
|
196
|
-
devDependencies: {
|
|
197
|
-
"@tsed/cli-plugin-passport": cliVersion
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
name: "Socket.io",
|
|
203
|
-
value: {
|
|
204
|
-
type: "socketio",
|
|
205
|
-
dependencies: {
|
|
206
|
-
"@tsed/socketio": "{{tsedVersion}}",
|
|
207
|
-
"socket.io": "latest"
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: "Swagger",
|
|
213
|
-
value: {
|
|
214
|
-
type: "swagger",
|
|
215
|
-
dependencies: {
|
|
216
|
-
"@tsed/swagger": "{{tsedVersion}}"
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
name: "OpenID Connect provider",
|
|
222
|
-
value: {
|
|
223
|
-
type: "oidc",
|
|
224
|
-
devDependencies: {
|
|
225
|
-
"@tsed/cli-plugin-oidc-provider": cliVersion
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
name: "Testing",
|
|
231
|
-
value: {
|
|
232
|
-
type: "testing",
|
|
233
|
-
dependencies: {},
|
|
234
|
-
devDependencies: {
|
|
235
|
-
"@types/supertest": "latest",
|
|
236
|
-
supertest: "latest"
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: "Linter",
|
|
242
|
-
value: {
|
|
243
|
-
type: "linter"
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
name: "Bundler",
|
|
248
|
-
value: {
|
|
249
|
-
type: "bundler"
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
name: "Commands",
|
|
254
|
-
value: {
|
|
255
|
-
type: "commands",
|
|
256
|
-
dependencies: {
|
|
257
|
-
"@tsed/cli-core": cliVersion
|
|
258
|
-
},
|
|
259
|
-
devDependencies: {
|
|
260
|
-
"@types/inquirer": "latest"
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
];
|
|
265
|
-
const featuresDbChoices = (cliVersion) => [
|
|
266
|
-
{
|
|
267
|
-
name: "Prisma",
|
|
268
|
-
value: {
|
|
269
|
-
type: "prisma",
|
|
270
|
-
devDependencies: {
|
|
271
|
-
"@tsed/cli-plugin-prisma": cliVersion
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
name: "Mongoose",
|
|
277
|
-
value: {
|
|
278
|
-
type: "mongoose",
|
|
279
|
-
devDependencies: {
|
|
280
|
-
"@tsed/cli-plugin-mongoose": cliVersion
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
name: "TypeORM",
|
|
286
|
-
value: {
|
|
287
|
-
type: "typeorm",
|
|
288
|
-
devDependencies: {
|
|
289
|
-
"@tsed/cli-plugin-typeorm": cliVersion
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
];
|
|
294
|
-
const featuresTestingChoices = (cliVersion) => [
|
|
295
|
-
{
|
|
296
|
-
name: "Jest",
|
|
297
|
-
value: {
|
|
298
|
-
type: "jest",
|
|
299
|
-
devDependencies: {
|
|
300
|
-
"@tsed/cli-plugin-jest": cliVersion
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
name: "Mocha + Chai + Sinon",
|
|
306
|
-
value: {
|
|
307
|
-
type: "mocha",
|
|
308
|
-
devDependencies: {
|
|
309
|
-
"@tsed/cli-plugin-mocha": cliVersion
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
];
|
|
314
|
-
const featuresLinterChoices = (cliVersion) => [
|
|
315
|
-
{
|
|
316
|
-
name: "EsLint",
|
|
317
|
-
checked: true,
|
|
318
|
-
value: {
|
|
319
|
-
type: "eslint",
|
|
320
|
-
devDependencies: {
|
|
321
|
-
"@tsed/cli-plugin-eslint": cliVersion
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
];
|
|
326
|
-
const featuresExtraLinterChoices = [
|
|
327
|
-
{
|
|
328
|
-
name: "Prettier",
|
|
329
|
-
value: {
|
|
330
|
-
type: "prettier"
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
name: "Lint on commit",
|
|
335
|
-
value: {
|
|
336
|
-
type: "lintstaged"
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
];
|
|
340
|
-
const featuresBundlerChoices = [
|
|
341
|
-
{
|
|
342
|
-
name: "Babel",
|
|
343
|
-
value: {
|
|
344
|
-
type: "babel",
|
|
345
|
-
devDependencies: {
|
|
346
|
-
...babelDevDependencies
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
name: "Webpack",
|
|
352
|
-
value: {
|
|
353
|
-
type: "babel:webpack",
|
|
354
|
-
devDependencies: {
|
|
355
|
-
...babelDevDependencies,
|
|
356
|
-
"babel-loader": "latest",
|
|
357
|
-
webpack: "latest",
|
|
358
|
-
"webpack-cli": "latest"
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
];
|
|
363
|
-
const packageManagerChoices = [
|
|
364
|
-
{
|
|
365
|
-
name: "Yarn",
|
|
366
|
-
checked: true,
|
|
367
|
-
value: "yarn"
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
name: "NPM",
|
|
371
|
-
checked: false,
|
|
372
|
-
value: "npm"
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
name: "PNPM - experimental",
|
|
376
|
-
checked: false,
|
|
377
|
-
value: "pnpm"
|
|
378
|
-
}
|
|
379
|
-
];
|
|
380
|
-
const parseFeaturesFile = (features, cliVersion) => {
|
|
381
|
-
return {
|
|
382
|
-
platform: features.platform,
|
|
383
|
-
convention: features.convention,
|
|
384
|
-
features: [
|
|
385
|
-
...featureChoices(cliVersion)
|
|
386
|
-
.map((v) => v.value)
|
|
387
|
-
.filter((v) => features.features.filter((v) => typeof v === "string").includes(v.type)),
|
|
388
|
-
...features.features.filter((v) => typeof v === "object")
|
|
389
|
-
],
|
|
390
|
-
featuresDB: featuresDbChoices(cliVersion).find((v) => v.value.type === features.featuresDB)?.value,
|
|
391
|
-
featuresTypeORM: exports.FEATURES_TYPEORM_CONNECTION_TYPES.find((v) => v.value.type === features.featuresTypeORM)?.value,
|
|
392
|
-
featuresTesting: featuresTestingChoices(cliVersion).find((v) => v.value.type === features.featuresTesting)?.value,
|
|
393
|
-
featuresLinter: featuresLinterChoices(cliVersion).find((v) => v.value.type === features.featuresLinter)?.value,
|
|
394
|
-
featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value).filter((v) => features.featuresExtraLinter?.includes(v.type)),
|
|
395
|
-
featuresBundler: featuresBundlerChoices.find((v) => v.value.type === features.featuresBundlerChoices)?.value,
|
|
396
|
-
packageManager: features.packageManager
|
|
397
|
-
};
|
|
398
|
-
};
|
|
399
|
-
exports.parseFeaturesFile = parseFeaturesFile;
|
|
400
|
-
const getFeaturesChoicesValues = (cliVersion) => {
|
|
401
|
-
return {
|
|
402
|
-
platform: platformChoices.map((v) => v.value),
|
|
403
|
-
convention: conventionChoices.map((v) => v.value),
|
|
404
|
-
features: featureChoices(cliVersion).map((v) => v.value.type),
|
|
405
|
-
featuresDB: featuresDbChoices(cliVersion).map((v) => v.value.type),
|
|
406
|
-
featuresTypeORM: exports.FEATURES_TYPEORM_CONNECTION_TYPES.map((v) => v.value.type),
|
|
407
|
-
featuresTesting: featuresTestingChoices(cliVersion).map((v) => v.value.type),
|
|
408
|
-
featuresLinter: featuresLinterChoices(cliVersion).map((v) => v.value.type),
|
|
409
|
-
featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value.type),
|
|
410
|
-
featuresBundler: featuresBundlerChoices.map((v) => v.value.type),
|
|
411
|
-
packageManager: packageManagerChoices.map((v) => v.value)
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
exports.getFeaturesChoicesValues = getFeaturesChoicesValues;
|
|
415
|
-
(0, cli_core_1.registerProvider)({
|
|
416
|
-
provide: Features,
|
|
417
|
-
deps: [cli_core_1.CliPackageJson],
|
|
418
|
-
useFactory(cliPackageJson) {
|
|
419
|
-
const cliVersion = cliPackageJson.version;
|
|
420
|
-
return [
|
|
421
|
-
{
|
|
422
|
-
message: "Choose the target platform:",
|
|
423
|
-
type: "list",
|
|
424
|
-
name: "platform",
|
|
425
|
-
choices: platformChoices
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
message: "Choose the architecture for your project:",
|
|
429
|
-
type: "list",
|
|
430
|
-
name: "architecture",
|
|
431
|
-
choices: [
|
|
432
|
-
{
|
|
433
|
-
name: "Ts.ED",
|
|
434
|
-
checked: true,
|
|
435
|
-
value: interfaces_1.ArchitectureConvention.DEFAULT
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
name: "feature",
|
|
439
|
-
checked: false,
|
|
440
|
-
value: interfaces_1.ArchitectureConvention.FEATURE
|
|
441
|
-
}
|
|
442
|
-
]
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
message: "Choose the convention file styling:",
|
|
446
|
-
type: "list",
|
|
447
|
-
name: "convention",
|
|
448
|
-
choices: conventionChoices
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
type: "checkbox",
|
|
452
|
-
name: "features",
|
|
453
|
-
message: "Check the features needed for your project",
|
|
454
|
-
choices: featureChoices(cliVersion)
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
message: "Choose a ORM manager",
|
|
458
|
-
type: "list",
|
|
459
|
-
name: "featuresDB",
|
|
460
|
-
when: hasFeature("db"),
|
|
461
|
-
choices: featuresDbChoices(cliVersion)
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
type: "list",
|
|
465
|
-
name: "featuresTypeORM",
|
|
466
|
-
message: "Which TypeORM you want to install?",
|
|
467
|
-
choices: exports.FEATURES_TYPEORM_CONNECTION_TYPES,
|
|
468
|
-
when: hasValue("featuresDB.type", "typeorm")
|
|
469
|
-
},
|
|
470
|
-
// {
|
|
471
|
-
// type: "password",
|
|
472
|
-
// name: "GH_TOKEN",
|
|
473
|
-
// message:
|
|
474
|
-
// "Enter GH_TOKEN to use the premium @tsedio/prisma package or leave blank (see https://tsed.io/tutorials/prisma-client.html)",
|
|
475
|
-
// when: hasValue("featuresDB.type", "prisma")
|
|
476
|
-
// },
|
|
477
|
-
{
|
|
478
|
-
message: "Choose unit framework",
|
|
479
|
-
type: "list",
|
|
480
|
-
name: "featuresTesting",
|
|
481
|
-
when: hasFeature("testing"),
|
|
482
|
-
choices: featuresTestingChoices(cliVersion)
|
|
483
|
-
},
|
|
484
|
-
{
|
|
485
|
-
message: "Choose linter tools framework",
|
|
486
|
-
type: "list",
|
|
487
|
-
name: "featuresLinter",
|
|
488
|
-
when: hasFeature("linter"),
|
|
489
|
-
choices: featuresLinterChoices(cliVersion)
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
message: "Choose extra linter tools",
|
|
493
|
-
type: "checkbox",
|
|
494
|
-
name: "featuresExtraLinter",
|
|
495
|
-
when: hasFeature("linter"),
|
|
496
|
-
choices: featuresExtraLinterChoices
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
message: "Choose your bundler",
|
|
500
|
-
type: "list",
|
|
501
|
-
name: "featuresBundler",
|
|
502
|
-
when: hasFeature("bundler"),
|
|
503
|
-
choices: featuresBundlerChoices
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
message: "Choose the OIDC base path server",
|
|
507
|
-
name: "oidcBasePath",
|
|
508
|
-
default: "/oidc",
|
|
509
|
-
when: hasFeature("oidc"),
|
|
510
|
-
type: "input"
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
message: "Choose the OIDC base path server",
|
|
514
|
-
name: "oidcBasePath",
|
|
515
|
-
default: "/oidc",
|
|
516
|
-
when: hasFeature("oidc"),
|
|
517
|
-
type: "input"
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
message: "Choose the package manager:",
|
|
521
|
-
type: "list",
|
|
522
|
-
name: "packageManager",
|
|
523
|
-
choices: packageManagerChoices
|
|
524
|
-
}
|
|
525
|
-
];
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
//# sourceMappingURL=Features.js.map
|