@tsed/cli 3.16.1 → 3.17.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.
|
@@ -28,6 +28,7 @@ export declare class InitCmd implements CommandProvider {
|
|
|
28
28
|
protected rootRenderer: RootRendererService;
|
|
29
29
|
protected outputFilePathPipe: OutputFilePathPipe;
|
|
30
30
|
protected fs: CliFs;
|
|
31
|
+
$beforePrompt(initialOptions: Partial<InitCmdContext>): Promise<Partial<InitCmdContext>>;
|
|
31
32
|
$prompt(initialOptions: Partial<InitCmdContext>): QuestionOptions;
|
|
32
33
|
$mapContext(ctx: Partial<InitCmdContext>): InitCmdContext;
|
|
33
34
|
$beforeExec(ctx: InitCmdContext): Promise<any>;
|
|
@@ -9,7 +9,19 @@ const constants_1 = require("../../constants");
|
|
|
9
9
|
const OutputFilePathPipe_1 = require("../../pipes/OutputFilePathPipe");
|
|
10
10
|
const Features_1 = require("../../services/Features");
|
|
11
11
|
let InitCmd = class InitCmd {
|
|
12
|
+
async $beforePrompt(initialOptions) {
|
|
13
|
+
const callPath = process.cwd();
|
|
14
|
+
if (callPath && initialOptions.featuresFile) {
|
|
15
|
+
const featuresFilePath = path_1.resolve(callPath, initialOptions.featuresFile);
|
|
16
|
+
const featuresFromFile = await Promise.resolve().then(() => tslib_1.__importStar(require(featuresFilePath)));
|
|
17
|
+
const mappedFeatures = Features_1.parseFeaturesFile(featuresFromFile, "3.8.0"); // Inject CLI version
|
|
18
|
+
initialOptions = { ...initialOptions, ...mappedFeatures };
|
|
19
|
+
}
|
|
20
|
+
return initialOptions;
|
|
21
|
+
}
|
|
12
22
|
$prompt(initialOptions) {
|
|
23
|
+
var _a;
|
|
24
|
+
const featuresQuestions = ((_a = initialOptions.features) === null || _a === void 0 ? void 0 : _a.length) ? [] : [...this.features];
|
|
13
25
|
return [
|
|
14
26
|
{
|
|
15
27
|
type: "input",
|
|
@@ -21,7 +33,7 @@ let InitCmd = class InitCmd {
|
|
|
21
33
|
return change_case_1.paramCase(input);
|
|
22
34
|
}
|
|
23
35
|
},
|
|
24
|
-
...
|
|
36
|
+
...featuresQuestions
|
|
25
37
|
];
|
|
26
38
|
}
|
|
27
39
|
$mapContext(ctx) {
|
|
@@ -29,7 +41,7 @@ let InitCmd = class InitCmd {
|
|
|
29
41
|
this.resolveRootDir(ctx);
|
|
30
42
|
const features = [];
|
|
31
43
|
Object.entries(ctx)
|
|
32
|
-
.filter(([key]) => key.startsWith("features"))
|
|
44
|
+
.filter(([key]) => key.startsWith("features") && key !== "featuresFile")
|
|
33
45
|
.forEach(([key, value]) => {
|
|
34
46
|
delete ctx[key];
|
|
35
47
|
features.push(...[].concat(value));
|
|
@@ -188,6 +200,9 @@ let InitCmd = class InitCmd {
|
|
|
188
200
|
"@tsed/exceptions": ctx.tsedVersion,
|
|
189
201
|
"@tsed/schema": ctx.tsedVersion,
|
|
190
202
|
"@tsed/json-mapper": ctx.tsedVersion,
|
|
203
|
+
"@tsed/logger": "latest",
|
|
204
|
+
"@tsed/logger-file": "latest",
|
|
205
|
+
"@tsed/engines": "latest",
|
|
191
206
|
ajv: "latest",
|
|
192
207
|
"cross-env": "latest",
|
|
193
208
|
dotenv: "latest"
|
|
@@ -320,6 +335,10 @@ InitCmd = tslib_1.__decorate([
|
|
|
320
335
|
type: String,
|
|
321
336
|
defaultValue: constants_1.DEFAULT_TSED_TAGS,
|
|
322
337
|
description: "Use a specific version of Ts.ED (format: 5.x.x)"
|
|
338
|
+
},
|
|
339
|
+
"-f, --features-file <path>": {
|
|
340
|
+
type: String,
|
|
341
|
+
description: "Location of a file in which the features are defined."
|
|
323
342
|
}
|
|
324
343
|
}
|
|
325
344
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitCmd.js","sourceRoot":"","sources":["../../../src/commands/init/InitCmd.ts"],"names":[],"mappings":";;;;AAAA,6CAgBwB;AACxB,6CAA6D;AAC7D,+BAAoC;AACpC,+CAAkD;AAGlD,uEA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\n CliFs,\n CliPlugins,\n CliService,\n Command,\n CommandProvider,\n Configuration,\n createSubTasks,\n createTasksRunner,\n Inject,\n InstallOptions,\n PackageManager,\n ProjectPackageJson,\n QuestionOptions,\n RootRendererService\n} from \"@tsed/cli-core\";\nimport {camelCase, paramCase, pascalCase} from \"change-case\";\nimport {basename, join} from \"path\";\nimport {DEFAULT_TSED_TAGS} from \"../../constants\";\nimport {ArchitectureConvention} from \"../../interfaces/ArchitectureConvention\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {Features, FeatureValue} from \"../../services/Features\";\n\nexport interface InitCmdContext extends CliDefaultOptions, InstallOptions {\n platform: \"express\" | \"koa\";\n root: string;\n srcDir: string;\n projectName: string;\n tsedVersion: string;\n features: FeatureValue[];\n featuresTypeORM?: FeatureValue;\n babel?: boolean;\n webpack?: boolean;\n architecture?: ArchitectureConvention;\n convention?: ProjectConvention;\n commands?: boolean;\n GH_TOKEN?: string;\n\n [key: string]: any;\n}\n\n@Command({\n name: \"init\",\n description: \"Init a new Ts.ED project\",\n args: {\n root: {\n type: String,\n defaultValue: \".\",\n description: \"Root directory to initialize the Ts.ED project\"\n }\n },\n options: {\n \"-t, --tsed-version <version>\": {\n type: String,\n defaultValue: DEFAULT_TSED_TAGS,\n description: \"Use a specific version of Ts.ED (format: 5.x.x)\"\n }\n }\n})\nexport class InitCmd implements CommandProvider {\n @Configuration()\n protected configuration: Configuration;\n\n @Inject()\n protected cliPlugins: CliPlugins;\n\n @Inject()\n protected packageJson: ProjectPackageJson;\n\n @Features()\n protected features: Features;\n\n @Inject()\n protected cliService: CliService;\n\n @Inject()\n protected rootRenderer: RootRendererService;\n\n @Inject()\n protected outputFilePathPipe: OutputFilePathPipe;\n\n @Inject()\n protected fs: CliFs;\n\n $prompt(initialOptions: Partial<InitCmdContext>): QuestionOptions {\n return [\n {\n type: \"input\",\n name: \"projectName\",\n message: \"What is your project name\",\n default: paramCase(initialOptions.root!),\n when: initialOptions.root !== \".\",\n transformer(input) {\n return paramCase(input);\n }\n },\n ...this.features\n ];\n }\n\n $mapContext(ctx: Partial<InitCmdContext>): InitCmdContext {\n this.resolveRootDir(ctx);\n\n const features: FeatureValue[] = [];\n\n Object.entries(ctx)\n .filter(([key]) => key.startsWith(\"features\"))\n .forEach(([key, value]: any[]) => {\n delete ctx[key];\n features.push(...[].concat(value));\n });\n\n features.forEach((feature) => {\n feature.type.split(\":\").forEach((type) => {\n ctx[camelCase(type)] = true;\n });\n });\n\n return {\n ...ctx,\n features,\n srcDir: this.configuration.project?.srcDir,\n pnpm: ctx.packageManager === PackageManager.PNPM,\n npm: ctx.packageManager === PackageManager.NPM,\n yarn: ctx.packageManager === PackageManager.YARN,\n express: ctx.platform === \"express\",\n koa: ctx.platform === \"koa\",\n platformSymbol: pascalCase(`Platform ${ctx.platform}`)\n } as InitCmdContext;\n }\n\n async $beforeExec(ctx: InitCmdContext): Promise<any> {\n this.fs.ensureDirSync(this.packageJson.dir);\n this.packageJson.name = ctx.projectName;\n\n ctx.packageManager && this.packageJson.setPreference(\"packageManager\", ctx.packageManager);\n ctx.architecture && this.packageJson.setPreference(\"architecture\", ctx.architecture);\n ctx.convention && this.packageJson.setPreference(\"convention\", ctx.convention);\n ctx.GH_TOKEN && this.packageJson.setGhToken(ctx.GH_TOKEN);\n\n this.addDependencies(ctx);\n this.addDevDependencies(ctx);\n this.addScripts(ctx);\n this.addFeatures(ctx);\n\n await createTasksRunner(\n [\n {\n title: \"Write RC files\",\n skip: () => !ctx.GH_TOKEN,\n task: () =>\n this.rootRenderer.renderAll([\"/init/.npmrc.hbs\", \"/init/.yarnrc.hbs\"], ctx, {\n baseDir: \"/init\"\n })\n },\n {\n title: \"Install plugins\",\n task: createSubTasks(() => this.packageJson.install(ctx), {...ctx, concurrent: false})\n },\n {\n title: \"Load plugins\",\n task: () => this.cliPlugins.loadPlugins()\n },\n {\n title: \"Install plugins dependencies\",\n task: createSubTasks(this.cliPlugins.addPluginsDependencies(ctx), {...ctx, concurrent: false})\n }\n ],\n ctx\n );\n }\n\n async $exec(ctx: InitCmdContext) {\n const subTasks = [\n ...(await this.cliService.getTasks(\"generate\", {\n ...ctx,\n type: \"server\",\n name: \"Server\",\n route: \"/rest\"\n })),\n ...(await this.cliService.getTasks(\"generate\", {\n type: \"controller\",\n route: \"hello-world\",\n name: \"HelloWorld\"\n })),\n ...(ctx.commands\n ? await this.cliService.getTasks(\"generate\", {\n type: \"command\",\n route: \"hello\",\n name: \"hello\"\n })\n : [])\n ];\n\n const indexCtrlBaseName = basename(\n `${this.outputFilePathPipe.transform({\n name: \"Index\",\n type: \"controller\",\n format: ctx.convention\n })}.ts`\n );\n\n return [\n {\n title: \"Generate project files\",\n task: createSubTasks(\n [\n {\n title: \"Root files\",\n task: () =>\n this.rootRenderer.renderAll(\n [\n \"/init/.dockerignore.hbs\",\n \"/init/.gitignore.hbs\",\n ctx.babel && \"/init/.babelrc.hbs\",\n ctx.webpack && \"/init/webpack.config.js.hbs\",\n \"/init/docker-compose.yml.hbs\",\n \"/init/Dockerfile.hbs\",\n \"/init/README.md.hbs\",\n \"/init/tsconfig.compile.json.hbs\",\n \"/init/tsconfig.json.hbs\",\n \"/init/src/index.ts.hbs\",\n \"/init/src/config/env/index.ts.hbs\",\n \"/init/src/config/logger/index.ts.hbs\",\n \"/init/src/config/index.ts.hbs\",\n ctx.commands && \"/init/src/bin/index.ts.hbs\",\n ctx.swagger && \"/init/views/swagger.ejs.hbs\",\n ctx.swagger && {\n path: \"/init/src/controllers/pages/IndexCtrl.ts.hbs\",\n basename: indexCtrlBaseName\n }\n ].filter(Boolean),\n ctx,\n {\n baseDir: \"/init\"\n }\n )\n },\n ...subTasks\n ],\n {...ctx, concurrent: false}\n )\n }\n ];\n }\n\n resolveRootDir(ctx: Partial<InitCmdContext>) {\n const rootDirName = paramCase(ctx.projectName || basename(this.packageJson.dir));\n\n if (this.packageJson.dir.endsWith(rootDirName)) {\n ctx.projectName = ctx.projectName || rootDirName;\n ctx.root = \".\";\n return;\n }\n\n ctx.projectName = ctx.projectName || rootDirName;\n\n if (ctx.root && ctx.root !== \".\") {\n this.packageJson.dir = join(this.packageJson.dir, rootDirName);\n ctx.root = \".\";\n }\n }\n\n addScripts(ctx: InitCmdContext): void {\n const runner = this.packageJson.getRunCmd();\n\n this.packageJson.addScripts({\n build: `${runner} tsc --project tsconfig.compile.json`,\n \"build:w\": \"tsc --project tsconfig.compile.json -w\",\n start: \"tsnd --inspect --ignore-watch node_modules --respawn --transpile-only -r tsconfig-paths/register src/index.ts\",\n \"start:prod\": \"cross-env NODE_ENV=production node dist/index.js\"\n });\n\n if (ctx.babel) {\n this.packageJson.addScripts({\n build: `${runner} tsc && babel src --out-dir dist --extensions \".ts,.tsx\" --source-maps inline`,\n start: \"babel-watch --extensions .ts src/index.ts\"\n });\n }\n\n if (ctx.webpack) {\n this.packageJson.addScripts({\n bundle: `${runner} tsc && cross-env NODE_ENV=production webpack`,\n \"start:bundle\": \"cross-env NODE_ENV=production node dist/app.bundle.js\"\n });\n }\n }\n\n addDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies({\n \"@tsed/common\": ctx.tsedVersion,\n \"@tsed/core\": ctx.tsedVersion,\n \"@tsed/di\": ctx.tsedVersion,\n \"@tsed/ajv\": ctx.tsedVersion,\n \"@tsed/exceptions\": ctx.tsedVersion,\n \"@tsed/schema\": ctx.tsedVersion,\n \"@tsed/json-mapper\": ctx.tsedVersion,\n ajv: \"latest\",\n \"cross-env\": \"latest\",\n dotenv: \"latest\"\n });\n }\n\n addDevDependencies(ctx: InitCmdContext) {\n this.packageJson.addDevDependencies(\n {\n \"@types/node\": \"latest\",\n \"@types/multer\": \"latest\",\n tslib: \"latest\",\n \"ts-node\": \"latest\",\n \"tsconfig-paths\": \"latest\",\n typescript: \"latest\"\n },\n ctx\n );\n\n if (!ctx.babel) {\n this.packageJson.addDevDependencies(\n {\n \"ts-node-dev\": \"latest\"\n },\n ctx\n );\n }\n }\n\n addFeatures(ctx: InitCmdContext) {\n ctx.features.forEach((feature) => {\n if (feature.dependencies) {\n this.packageJson.addDependencies(feature.dependencies, ctx);\n }\n\n if (feature.devDependencies) {\n this.packageJson.addDevDependencies(feature.devDependencies, ctx);\n }\n });\n\n switch (ctx.platform) {\n case \"express\":\n this.addExpressDependencies(ctx);\n break;\n case \"koa\":\n this.addKoaDependencies(ctx);\n break;\n }\n\n if (ctx.features.find(({type}) => type === \"graphql\")) {\n this.packageJson.addDependencies(\n {\n [\"apollo-server-\" + ctx.platform]: \"2.25.2\"\n },\n ctx\n );\n }\n }\n\n private addExpressDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies(\n {\n \"@tsed/platform-express\": ctx.tsedVersion,\n \"body-parser\": \"latest\",\n cors: \"latest\",\n compression: \"latest\",\n \"cookie-parser\": \"latest\",\n express: \"latest\",\n \"method-override\": \"latest\"\n },\n ctx\n );\n\n this.packageJson.addDevDependencies(\n {\n \"@types/cors\": \"latest\",\n \"@types/express\": \"latest\",\n \"@types/compression\": \"latest\",\n \"@types/cookie-parser\": \"latest\",\n \"@types/method-override\": \"latest\"\n },\n ctx\n );\n }\n\n private addKoaDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies(\n {\n \"@tsed/platform-koa\": ctx.tsedVersion,\n koa: \"latest\",\n \"@koa/cors\": \"latest\",\n \"@koa/router\": \"latest\",\n \"koa-qs\": \"latest\",\n \"koa-bodyparser\": \"latest\",\n \"koa-override\": \"latest\",\n \"koa-compress\": \"latest\"\n },\n ctx\n );\n\n this.packageJson.addDevDependencies(\n {\n \"@types/koa\": \"latest\",\n \"@types/koa-qs\": \"latest\",\n \"@types/koa-json\": \"latest\",\n \"@types/koa-bodyparser\": \"latest\",\n \"@types/koa__router\": \"latest\",\n \"@types/koa-compress\": \"latest\",\n \"@types/koa-send\": \"latest\",\n \"@types/koa__cors\": \"latest\"\n },\n ctx\n );\n }\n}\n"]}
|
|
1
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AAQ;YAC/B,iBAAiB,EAAE,QAAQ;YAC3B,kBAAkB,EAAE,QAAQ;SAC7B,EACD,GAAG,CACJ,CAAC;IACJ,CAAC;CACF,CAAA;AA7WC;IADC,wBAAa,EAAE;;8CACuB;AAGvC;IADC,iBAAM,EAAE;sCACa,qBAAU;2CAAC;AAGjC;IADC,iBAAM,EAAE;sCACc,6BAAkB;4CAAC;AAG1C;IADC,mBAAQ,EAAE;;yCACkB;AAG7B;IADC,iBAAM,EAAE;sCACa,qBAAU;2CAAC;AAGjC;IADC,iBAAM,EAAE;sCACe,8BAAmB;6CAAC;AAG5C;IADC,iBAAM,EAAE;sCACqB,uCAAkB;mDAAC;AAGjD;IADC,iBAAM,EAAE;sCACK,gBAAK;mCAAC;AAvBT,OAAO;IAtBnB,kBAAO,CAAC;QACP,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,GAAG;gBACjB,WAAW,EAAE,gDAAgD;aAC9D;SACF;QACD,OAAO,EAAE;YACP,8BAA8B,EAAE;gBAC9B,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,6BAAiB;gBAC/B,WAAW,EAAE,iDAAiD;aAC/D;YACD,4BAA4B,EAAE;gBAC5B,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,uDAAuD;aACrE;SACF;KACF,CAAC;GACW,OAAO,CA+WnB;AA/WY,0BAAO","sourcesContent":["import {\n CliDefaultOptions,\n CliFs,\n CliPlugins,\n CliService,\n Command,\n CommandProvider,\n Configuration,\n createSubTasks,\n createTasksRunner,\n Inject,\n InstallOptions,\n PackageManager,\n ProjectPackageJson,\n QuestionOptions,\n RootRendererService\n} from \"@tsed/cli-core\";\nimport {camelCase, paramCase, pascalCase} from \"change-case\";\nimport {basename, join, resolve} from \"path\";\nimport {DEFAULT_TSED_TAGS} from \"../../constants\";\nimport {ArchitectureConvention} from \"../../interfaces/ArchitectureConvention\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {Features, FeatureValue, parseFeaturesFile} from \"../../services/Features\";\n\nexport interface InitCmdContext extends CliDefaultOptions, InstallOptions {\n platform: \"express\" | \"koa\";\n root: string;\n srcDir: string;\n projectName: string;\n tsedVersion: string;\n features: FeatureValue[];\n featuresTypeORM?: FeatureValue;\n babel?: boolean;\n webpack?: boolean;\n architecture?: ArchitectureConvention;\n convention?: ProjectConvention;\n commands?: boolean;\n GH_TOKEN?: string;\n\n [key: string]: any;\n}\n\n@Command({\n name: \"init\",\n description: \"Init a new Ts.ED project\",\n args: {\n root: {\n type: String,\n defaultValue: \".\",\n description: \"Root directory to initialize the Ts.ED project\"\n }\n },\n options: {\n \"-t, --tsed-version <version>\": {\n type: String,\n defaultValue: DEFAULT_TSED_TAGS,\n description: \"Use a specific version of Ts.ED (format: 5.x.x)\"\n },\n \"-f, --features-file <path>\": {\n type: String,\n description: \"Location of a file in which the features are defined.\"\n }\n }\n})\nexport class InitCmd implements CommandProvider {\n @Configuration()\n protected configuration: Configuration;\n\n @Inject()\n protected cliPlugins: CliPlugins;\n\n @Inject()\n protected packageJson: ProjectPackageJson;\n\n @Features()\n protected features: Features;\n\n @Inject()\n protected cliService: CliService;\n\n @Inject()\n protected rootRenderer: RootRendererService;\n\n @Inject()\n protected outputFilePathPipe: OutputFilePathPipe;\n\n @Inject()\n protected fs: CliFs;\n\n async $beforePrompt(initialOptions: Partial<InitCmdContext>) {\n const callPath = process.cwd();\n if (callPath && initialOptions.featuresFile) {\n const featuresFilePath = resolve(callPath, initialOptions.featuresFile);\n const featuresFromFile = await import(featuresFilePath);\n const mappedFeatures = parseFeaturesFile(featuresFromFile, \"3.8.0\"); // Inject CLI version\n initialOptions = {...initialOptions, ...mappedFeatures};\n }\n return initialOptions;\n }\n\n $prompt(initialOptions: Partial<InitCmdContext>): QuestionOptions {\n const featuresQuestions = initialOptions.features?.length ? [] : [...this.features];\n return [\n {\n type: \"input\",\n name: \"projectName\",\n message: \"What is your project name\",\n default: paramCase(initialOptions.root!),\n when: initialOptions.root !== \".\",\n transformer(input) {\n return paramCase(input);\n }\n },\n ...featuresQuestions\n ];\n }\n\n $mapContext(ctx: Partial<InitCmdContext>): InitCmdContext {\n this.resolveRootDir(ctx);\n\n const features: FeatureValue[] = [];\n\n Object.entries(ctx)\n .filter(([key]) => key.startsWith(\"features\") && key !== \"featuresFile\")\n .forEach(([key, value]: any[]) => {\n delete ctx[key];\n features.push(...[].concat(value));\n });\n\n features.forEach((feature) => {\n feature.type.split(\":\").forEach((type) => {\n ctx[camelCase(type)] = true;\n });\n });\n\n return {\n ...ctx,\n features,\n srcDir: this.configuration.project?.srcDir,\n pnpm: ctx.packageManager === PackageManager.PNPM,\n npm: ctx.packageManager === PackageManager.NPM,\n yarn: ctx.packageManager === PackageManager.YARN,\n express: ctx.platform === \"express\",\n koa: ctx.platform === \"koa\",\n platformSymbol: pascalCase(`Platform ${ctx.platform}`)\n } as InitCmdContext;\n }\n\n async $beforeExec(ctx: InitCmdContext): Promise<any> {\n this.fs.ensureDirSync(this.packageJson.dir);\n this.packageJson.name = ctx.projectName;\n\n ctx.packageManager && this.packageJson.setPreference(\"packageManager\", ctx.packageManager);\n ctx.architecture && this.packageJson.setPreference(\"architecture\", ctx.architecture);\n ctx.convention && this.packageJson.setPreference(\"convention\", ctx.convention);\n ctx.GH_TOKEN && this.packageJson.setGhToken(ctx.GH_TOKEN);\n\n this.addDependencies(ctx);\n this.addDevDependencies(ctx);\n this.addScripts(ctx);\n this.addFeatures(ctx);\n\n await createTasksRunner(\n [\n {\n title: \"Write RC files\",\n skip: () => !ctx.GH_TOKEN,\n task: () =>\n this.rootRenderer.renderAll([\"/init/.npmrc.hbs\", \"/init/.yarnrc.hbs\"], ctx, {\n baseDir: \"/init\"\n })\n },\n {\n title: \"Install plugins\",\n task: createSubTasks(() => this.packageJson.install(ctx), {...ctx, concurrent: false})\n },\n {\n title: \"Load plugins\",\n task: () => this.cliPlugins.loadPlugins()\n },\n {\n title: \"Install plugins dependencies\",\n task: createSubTasks(this.cliPlugins.addPluginsDependencies(ctx), {...ctx, concurrent: false})\n }\n ],\n ctx\n );\n }\n\n async $exec(ctx: InitCmdContext) {\n const subTasks = [\n ...(await this.cliService.getTasks(\"generate\", {\n ...ctx,\n type: \"server\",\n name: \"Server\",\n route: \"/rest\"\n })),\n ...(await this.cliService.getTasks(\"generate\", {\n type: \"controller\",\n route: \"hello-world\",\n name: \"HelloWorld\"\n })),\n ...(ctx.commands\n ? await this.cliService.getTasks(\"generate\", {\n type: \"command\",\n route: \"hello\",\n name: \"hello\"\n })\n : [])\n ];\n\n const indexCtrlBaseName = basename(\n `${this.outputFilePathPipe.transform({\n name: \"Index\",\n type: \"controller\",\n format: ctx.convention\n })}.ts`\n );\n\n return [\n {\n title: \"Generate project files\",\n task: createSubTasks(\n [\n {\n title: \"Root files\",\n task: () =>\n this.rootRenderer.renderAll(\n [\n \"/init/.dockerignore.hbs\",\n \"/init/.gitignore.hbs\",\n ctx.babel && \"/init/.babelrc.hbs\",\n ctx.webpack && \"/init/webpack.config.js.hbs\",\n \"/init/docker-compose.yml.hbs\",\n \"/init/Dockerfile.hbs\",\n \"/init/README.md.hbs\",\n \"/init/tsconfig.compile.json.hbs\",\n \"/init/tsconfig.json.hbs\",\n \"/init/src/index.ts.hbs\",\n \"/init/src/config/env/index.ts.hbs\",\n \"/init/src/config/logger/index.ts.hbs\",\n \"/init/src/config/index.ts.hbs\",\n ctx.commands && \"/init/src/bin/index.ts.hbs\",\n ctx.swagger && \"/init/views/swagger.ejs.hbs\",\n ctx.swagger && {\n path: \"/init/src/controllers/pages/IndexCtrl.ts.hbs\",\n basename: indexCtrlBaseName\n }\n ].filter(Boolean),\n ctx,\n {\n baseDir: \"/init\"\n }\n )\n },\n ...subTasks\n ],\n {...ctx, concurrent: false}\n )\n }\n ];\n }\n\n resolveRootDir(ctx: Partial<InitCmdContext>) {\n const rootDirName = paramCase(ctx.projectName || basename(this.packageJson.dir));\n\n if (this.packageJson.dir.endsWith(rootDirName)) {\n ctx.projectName = ctx.projectName || rootDirName;\n ctx.root = \".\";\n return;\n }\n\n ctx.projectName = ctx.projectName || rootDirName;\n\n if (ctx.root && ctx.root !== \".\") {\n this.packageJson.dir = join(this.packageJson.dir, rootDirName);\n ctx.root = \".\";\n }\n }\n\n addScripts(ctx: InitCmdContext): void {\n const runner = this.packageJson.getRunCmd();\n\n this.packageJson.addScripts({\n build: `${runner} tsc --project tsconfig.compile.json`,\n \"build:w\": \"tsc --project tsconfig.compile.json -w\",\n start: \"tsnd --inspect --ignore-watch node_modules --respawn --transpile-only -r tsconfig-paths/register src/index.ts\",\n \"start:prod\": \"cross-env NODE_ENV=production node dist/index.js\"\n });\n\n if (ctx.babel) {\n this.packageJson.addScripts({\n build: `${runner} tsc && babel src --out-dir dist --extensions \".ts,.tsx\" --source-maps inline`,\n start: \"babel-watch --extensions .ts src/index.ts\"\n });\n }\n\n if (ctx.webpack) {\n this.packageJson.addScripts({\n bundle: `${runner} tsc && cross-env NODE_ENV=production webpack`,\n \"start:bundle\": \"cross-env NODE_ENV=production node dist/app.bundle.js\"\n });\n }\n }\n\n addDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies({\n \"@tsed/common\": ctx.tsedVersion,\n \"@tsed/core\": ctx.tsedVersion,\n \"@tsed/di\": ctx.tsedVersion,\n \"@tsed/ajv\": ctx.tsedVersion,\n \"@tsed/exceptions\": ctx.tsedVersion,\n \"@tsed/schema\": ctx.tsedVersion,\n \"@tsed/json-mapper\": ctx.tsedVersion,\n \"@tsed/logger\": \"latest\",\n \"@tsed/logger-file\": \"latest\",\n \"@tsed/engines\": \"latest\",\n ajv: \"latest\",\n \"cross-env\": \"latest\",\n dotenv: \"latest\"\n });\n }\n\n addDevDependencies(ctx: InitCmdContext) {\n this.packageJson.addDevDependencies(\n {\n \"@types/node\": \"latest\",\n \"@types/multer\": \"latest\",\n tslib: \"latest\",\n \"ts-node\": \"latest\",\n \"tsconfig-paths\": \"latest\",\n typescript: \"latest\"\n },\n ctx\n );\n\n if (!ctx.babel) {\n this.packageJson.addDevDependencies(\n {\n \"ts-node-dev\": \"latest\"\n },\n ctx\n );\n }\n }\n\n addFeatures(ctx: InitCmdContext) {\n ctx.features.forEach((feature) => {\n if (feature.dependencies) {\n this.packageJson.addDependencies(feature.dependencies, ctx);\n }\n\n if (feature.devDependencies) {\n this.packageJson.addDevDependencies(feature.devDependencies, ctx);\n }\n });\n\n switch (ctx.platform) {\n case \"express\":\n this.addExpressDependencies(ctx);\n break;\n case \"koa\":\n this.addKoaDependencies(ctx);\n break;\n }\n\n if (ctx.features.find(({type}) => type === \"graphql\")) {\n this.packageJson.addDependencies(\n {\n [\"apollo-server-\" + ctx.platform]: \"2.25.2\"\n },\n ctx\n );\n }\n }\n\n private addExpressDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies(\n {\n \"@tsed/platform-express\": ctx.tsedVersion,\n \"body-parser\": \"latest\",\n cors: \"latest\",\n compression: \"latest\",\n \"cookie-parser\": \"latest\",\n express: \"latest\",\n \"method-override\": \"latest\"\n },\n ctx\n );\n\n this.packageJson.addDevDependencies(\n {\n \"@types/cors\": \"latest\",\n \"@types/express\": \"latest\",\n \"@types/compression\": \"latest\",\n \"@types/cookie-parser\": \"latest\",\n \"@types/method-override\": \"latest\"\n },\n ctx\n );\n }\n\n private addKoaDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies(\n {\n \"@tsed/platform-koa\": ctx.tsedVersion,\n koa: \"latest\",\n \"@koa/cors\": \"latest\",\n \"@koa/router\": \"latest\",\n \"koa-qs\": \"latest\",\n \"koa-bodyparser\": \"latest\",\n \"koa-override\": \"latest\",\n \"koa-compress\": \"latest\"\n },\n ctx\n );\n\n this.packageJson.addDevDependencies(\n {\n \"@types/koa\": \"latest\",\n \"@types/koa-qs\": \"latest\",\n \"@types/koa-json\": \"latest\",\n \"@types/koa-bodyparser\": \"latest\",\n \"@types/koa__router\": \"latest\",\n \"@types/koa-compress\": \"latest\",\n \"@types/koa-send\": \"latest\",\n \"@types/koa__cors\": \"latest\"\n },\n ctx\n );\n }\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { ProjectConvention } from "../interfaces";
|
|
1
2
|
export interface FeatureValue {
|
|
2
3
|
type: string;
|
|
3
4
|
dependencies?: {
|
|
4
|
-
[key: string]: string;
|
|
5
|
+
[key: string]: string | undefined;
|
|
5
6
|
};
|
|
6
7
|
devDependencies?: {
|
|
7
|
-
[key: string]: string;
|
|
8
|
+
[key: string]: string | undefined;
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
11
|
export interface Feature {
|
|
@@ -158,3 +159,214 @@ export declare const FEATURES_TYPEORM_CONNECTION_TYPES: ({
|
|
|
158
159
|
};
|
|
159
160
|
};
|
|
160
161
|
})[];
|
|
162
|
+
export declare const parseFeaturesFile: (features: Record<string, any>, cliVersion: string) => {
|
|
163
|
+
platform: any;
|
|
164
|
+
convention: any;
|
|
165
|
+
features: any[];
|
|
166
|
+
featuresDB: {
|
|
167
|
+
type: string;
|
|
168
|
+
devDependencies: {
|
|
169
|
+
"@tsed/cli-plugin-prisma": string;
|
|
170
|
+
"@tsed/cli-plugin-mongoose"?: undefined;
|
|
171
|
+
"@tsed/cli-plugin-typeorm"?: undefined;
|
|
172
|
+
};
|
|
173
|
+
} | {
|
|
174
|
+
type: string;
|
|
175
|
+
devDependencies: {
|
|
176
|
+
"@tsed/cli-plugin-mongoose": string;
|
|
177
|
+
"@tsed/cli-plugin-prisma"?: undefined;
|
|
178
|
+
"@tsed/cli-plugin-typeorm"?: undefined;
|
|
179
|
+
};
|
|
180
|
+
} | {
|
|
181
|
+
type: string;
|
|
182
|
+
devDependencies: {
|
|
183
|
+
"@tsed/cli-plugin-typeorm": string;
|
|
184
|
+
"@tsed/cli-plugin-prisma"?: undefined;
|
|
185
|
+
"@tsed/cli-plugin-mongoose"?: undefined;
|
|
186
|
+
};
|
|
187
|
+
} | undefined;
|
|
188
|
+
featuresTypeORM: {
|
|
189
|
+
type: string;
|
|
190
|
+
dependencies: {
|
|
191
|
+
mysql: string;
|
|
192
|
+
mariadb?: undefined;
|
|
193
|
+
pg?: undefined;
|
|
194
|
+
cockroachdb?: undefined;
|
|
195
|
+
sqlite3?: undefined;
|
|
196
|
+
oracledb?: undefined;
|
|
197
|
+
mssql?: undefined;
|
|
198
|
+
mongodb?: undefined;
|
|
199
|
+
};
|
|
200
|
+
} | {
|
|
201
|
+
type: string;
|
|
202
|
+
dependencies: {
|
|
203
|
+
mariadb: string;
|
|
204
|
+
mysql?: undefined;
|
|
205
|
+
pg?: undefined;
|
|
206
|
+
cockroachdb?: undefined;
|
|
207
|
+
sqlite3?: undefined;
|
|
208
|
+
oracledb?: undefined;
|
|
209
|
+
mssql?: undefined;
|
|
210
|
+
mongodb?: undefined;
|
|
211
|
+
};
|
|
212
|
+
} | {
|
|
213
|
+
type: string;
|
|
214
|
+
dependencies: {
|
|
215
|
+
pg: string;
|
|
216
|
+
mysql?: undefined;
|
|
217
|
+
mariadb?: undefined;
|
|
218
|
+
cockroachdb?: undefined;
|
|
219
|
+
sqlite3?: undefined;
|
|
220
|
+
oracledb?: undefined;
|
|
221
|
+
mssql?: undefined;
|
|
222
|
+
mongodb?: undefined;
|
|
223
|
+
};
|
|
224
|
+
} | {
|
|
225
|
+
type: string;
|
|
226
|
+
dependencies: {
|
|
227
|
+
cockroachdb: string;
|
|
228
|
+
mysql?: undefined;
|
|
229
|
+
mariadb?: undefined;
|
|
230
|
+
pg?: undefined;
|
|
231
|
+
sqlite3?: undefined;
|
|
232
|
+
oracledb?: undefined;
|
|
233
|
+
mssql?: undefined;
|
|
234
|
+
mongodb?: undefined;
|
|
235
|
+
};
|
|
236
|
+
} | {
|
|
237
|
+
type: string;
|
|
238
|
+
dependencies: {
|
|
239
|
+
sqlite3: string;
|
|
240
|
+
mysql?: undefined;
|
|
241
|
+
mariadb?: undefined;
|
|
242
|
+
pg?: undefined;
|
|
243
|
+
cockroachdb?: undefined;
|
|
244
|
+
oracledb?: undefined;
|
|
245
|
+
mssql?: undefined;
|
|
246
|
+
mongodb?: undefined;
|
|
247
|
+
};
|
|
248
|
+
} | {
|
|
249
|
+
type: string;
|
|
250
|
+
dependencies?: undefined;
|
|
251
|
+
} | {
|
|
252
|
+
type: string;
|
|
253
|
+
dependencies: {
|
|
254
|
+
oracledb: string;
|
|
255
|
+
mysql?: undefined;
|
|
256
|
+
mariadb?: undefined;
|
|
257
|
+
pg?: undefined;
|
|
258
|
+
cockroachdb?: undefined;
|
|
259
|
+
sqlite3?: undefined;
|
|
260
|
+
mssql?: undefined;
|
|
261
|
+
mongodb?: undefined;
|
|
262
|
+
};
|
|
263
|
+
} | {
|
|
264
|
+
type: string;
|
|
265
|
+
dependencies: {
|
|
266
|
+
mssql: string;
|
|
267
|
+
mysql?: undefined;
|
|
268
|
+
mariadb?: undefined;
|
|
269
|
+
pg?: undefined;
|
|
270
|
+
cockroachdb?: undefined;
|
|
271
|
+
sqlite3?: undefined;
|
|
272
|
+
oracledb?: undefined;
|
|
273
|
+
mongodb?: undefined;
|
|
274
|
+
};
|
|
275
|
+
} | {
|
|
276
|
+
type: string;
|
|
277
|
+
dependencies: {
|
|
278
|
+
mongodb: string;
|
|
279
|
+
mysql?: undefined;
|
|
280
|
+
mariadb?: undefined;
|
|
281
|
+
pg?: undefined;
|
|
282
|
+
cockroachdb?: undefined;
|
|
283
|
+
sqlite3?: undefined;
|
|
284
|
+
oracledb?: undefined;
|
|
285
|
+
mssql?: undefined;
|
|
286
|
+
};
|
|
287
|
+
} | {
|
|
288
|
+
type: string;
|
|
289
|
+
dependencies: {
|
|
290
|
+
mysql?: undefined;
|
|
291
|
+
mariadb?: undefined;
|
|
292
|
+
pg?: undefined;
|
|
293
|
+
cockroachdb?: undefined;
|
|
294
|
+
sqlite3?: undefined;
|
|
295
|
+
oracledb?: undefined;
|
|
296
|
+
mssql?: undefined;
|
|
297
|
+
mongodb?: undefined;
|
|
298
|
+
};
|
|
299
|
+
} | undefined;
|
|
300
|
+
featuresTesting: {
|
|
301
|
+
type: string;
|
|
302
|
+
devDependencies: {
|
|
303
|
+
"@tsed/cli-plugin-jest": string;
|
|
304
|
+
"@tsed/cli-plugin-mocha"?: undefined;
|
|
305
|
+
};
|
|
306
|
+
} | {
|
|
307
|
+
type: string;
|
|
308
|
+
devDependencies: {
|
|
309
|
+
"@tsed/cli-plugin-mocha": string;
|
|
310
|
+
"@tsed/cli-plugin-jest"?: undefined;
|
|
311
|
+
};
|
|
312
|
+
} | undefined;
|
|
313
|
+
featuresLinter: {
|
|
314
|
+
type: string;
|
|
315
|
+
devDependencies: {
|
|
316
|
+
"@tsed/cli-plugin-eslint": string;
|
|
317
|
+
"@tsed/cli-plugin-tslint"?: undefined;
|
|
318
|
+
};
|
|
319
|
+
} | {
|
|
320
|
+
type: string;
|
|
321
|
+
devDependencies: {
|
|
322
|
+
"@tsed/cli-plugin-tslint": string;
|
|
323
|
+
"@tsed/cli-plugin-eslint"?: undefined;
|
|
324
|
+
};
|
|
325
|
+
} | undefined;
|
|
326
|
+
featuresExtraLinter: {
|
|
327
|
+
type: string;
|
|
328
|
+
}[];
|
|
329
|
+
featuresBundler: {
|
|
330
|
+
type: string;
|
|
331
|
+
devDependencies: {
|
|
332
|
+
"@babel/cli": string;
|
|
333
|
+
"@babel/core": string;
|
|
334
|
+
"@babel/node": string;
|
|
335
|
+
"@babel/plugin-proposal-class-properties": string;
|
|
336
|
+
"@babel/plugin-proposal-decorators": string;
|
|
337
|
+
"@babel/preset-env": string;
|
|
338
|
+
"@babel/preset-typescript": string;
|
|
339
|
+
"babel-plugin-transform-typescript-metadata": string;
|
|
340
|
+
"babel-watch": string;
|
|
341
|
+
};
|
|
342
|
+
} | {
|
|
343
|
+
type: string;
|
|
344
|
+
devDependencies: {
|
|
345
|
+
"babel-loader": string;
|
|
346
|
+
webpack: string;
|
|
347
|
+
"webpack-cli": string;
|
|
348
|
+
"@babel/cli": string;
|
|
349
|
+
"@babel/core": string;
|
|
350
|
+
"@babel/node": string;
|
|
351
|
+
"@babel/plugin-proposal-class-properties": string;
|
|
352
|
+
"@babel/plugin-proposal-decorators": string;
|
|
353
|
+
"@babel/preset-env": string;
|
|
354
|
+
"@babel/preset-typescript": string;
|
|
355
|
+
"babel-plugin-transform-typescript-metadata": string;
|
|
356
|
+
"babel-watch": string;
|
|
357
|
+
};
|
|
358
|
+
} | undefined;
|
|
359
|
+
packageManager: any;
|
|
360
|
+
};
|
|
361
|
+
export declare const getFeaturesChoicesValues: (cliVersion: string) => {
|
|
362
|
+
platform: string[];
|
|
363
|
+
convention: ProjectConvention[];
|
|
364
|
+
features: string[];
|
|
365
|
+
featuresDB: string[];
|
|
366
|
+
featuresTypeORM: string[];
|
|
367
|
+
featuresTesting: string[];
|
|
368
|
+
featuresLinter: string[];
|
|
369
|
+
featuresExtraLinter: string[];
|
|
370
|
+
featuresBundler: string[];
|
|
371
|
+
packageManager: string[];
|
|
372
|
+
};
|
package/lib/services/Features.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FEATURES_TYPEORM_CONNECTION_TYPES = exports.isPlatform = exports.hasValue = exports.hasFeature = exports.Features = void 0;
|
|
3
|
+
exports.getFeaturesChoicesValues = exports.parseFeaturesFile = exports.FEATURES_TYPEORM_CONNECTION_TYPES = exports.isPlatform = exports.hasValue = exports.hasFeature = exports.Features = void 0;
|
|
4
4
|
const cli_core_1 = require("@tsed/cli-core");
|
|
5
5
|
const core_1 = require("@tsed/core");
|
|
6
6
|
const interfaces_1 = require("../interfaces");
|
|
@@ -138,6 +138,288 @@ const babelDevDependencies = {
|
|
|
138
138
|
"babel-plugin-transform-typescript-metadata": "latest",
|
|
139
139
|
"babel-watch": "latest"
|
|
140
140
|
};
|
|
141
|
+
const platformChoices = [
|
|
142
|
+
{
|
|
143
|
+
name: "Express.js",
|
|
144
|
+
checked: true,
|
|
145
|
+
value: "express"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "Koa.js",
|
|
149
|
+
checked: false,
|
|
150
|
+
value: "koa"
|
|
151
|
+
}
|
|
152
|
+
];
|
|
153
|
+
const conventionChoices = [
|
|
154
|
+
{
|
|
155
|
+
name: "Ts.ED",
|
|
156
|
+
checked: true,
|
|
157
|
+
value: interfaces_1.ProjectConvention.DEFAULT
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "Angular",
|
|
161
|
+
checked: false,
|
|
162
|
+
value: interfaces_1.ProjectConvention.ANGULAR
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
const featureChoices = (cliVersion) => [
|
|
166
|
+
{
|
|
167
|
+
name: "GraphQL",
|
|
168
|
+
value: {
|
|
169
|
+
type: "graphql",
|
|
170
|
+
dependencies: {
|
|
171
|
+
"@tsed/graphql": "{{tsedVersion}}",
|
|
172
|
+
"apollo-datasource": "^3.3.1",
|
|
173
|
+
"apollo-datasource-rest": "^3.5.1",
|
|
174
|
+
"apollo-server-core": "^3.6.2",
|
|
175
|
+
"type-graphql": "^1.1.1",
|
|
176
|
+
"class-validator": "^0.13.2",
|
|
177
|
+
graphql: "^15.7.2"
|
|
178
|
+
},
|
|
179
|
+
devDependencies: {
|
|
180
|
+
"@types/validator": "latest",
|
|
181
|
+
"apollo-server-testing": "latest"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "Database",
|
|
187
|
+
value: { type: "db" }
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "Passport.js",
|
|
191
|
+
when: isPlatform("express"),
|
|
192
|
+
value: {
|
|
193
|
+
type: "passportjs",
|
|
194
|
+
devDependencies: {
|
|
195
|
+
"@tsed/cli-plugin-passport": cliVersion
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "Socket.io",
|
|
201
|
+
value: {
|
|
202
|
+
type: "socketio",
|
|
203
|
+
dependencies: {
|
|
204
|
+
"@tsed/socketio": "{{tsedVersion}}",
|
|
205
|
+
"socket.io": "latest"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "Swagger",
|
|
211
|
+
value: {
|
|
212
|
+
type: "swagger",
|
|
213
|
+
dependencies: {
|
|
214
|
+
"@tsed/swagger": "{{tsedVersion}}"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "OpenID Connect provider",
|
|
220
|
+
value: {
|
|
221
|
+
type: "oidc",
|
|
222
|
+
devDependencies: {
|
|
223
|
+
"@tsed/cli-plugin-oidc-provider": cliVersion
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: "Testing",
|
|
229
|
+
value: {
|
|
230
|
+
type: "testing",
|
|
231
|
+
dependencies: {},
|
|
232
|
+
devDependencies: {
|
|
233
|
+
"@types/supertest": "latest",
|
|
234
|
+
supertest: "latest"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: "Linter",
|
|
240
|
+
value: {
|
|
241
|
+
type: "linter"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: "Bundler",
|
|
246
|
+
value: {
|
|
247
|
+
type: "bundler"
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: "Commands",
|
|
252
|
+
value: {
|
|
253
|
+
type: "commands",
|
|
254
|
+
dependencies: {
|
|
255
|
+
"@tsed/cli-core": cliVersion
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
];
|
|
260
|
+
const featuresDbChoices = (cliVersion) => [
|
|
261
|
+
{
|
|
262
|
+
name: "Prisma",
|
|
263
|
+
value: {
|
|
264
|
+
type: "prisma",
|
|
265
|
+
devDependencies: {
|
|
266
|
+
"@tsed/cli-plugin-prisma": cliVersion
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: "Mongoose",
|
|
272
|
+
value: {
|
|
273
|
+
type: "mongoose",
|
|
274
|
+
devDependencies: {
|
|
275
|
+
"@tsed/cli-plugin-mongoose": cliVersion
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "TypeORM",
|
|
281
|
+
value: {
|
|
282
|
+
type: "typeorm",
|
|
283
|
+
devDependencies: {
|
|
284
|
+
"@tsed/cli-plugin-typeorm": cliVersion
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
];
|
|
289
|
+
const featuresTestingChoices = (cliVersion) => [
|
|
290
|
+
{
|
|
291
|
+
name: "Jest",
|
|
292
|
+
value: {
|
|
293
|
+
type: "jest",
|
|
294
|
+
devDependencies: {
|
|
295
|
+
"@tsed/cli-plugin-jest": cliVersion
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: "Mocha + Chai + Sinon",
|
|
301
|
+
value: {
|
|
302
|
+
type: "mocha",
|
|
303
|
+
devDependencies: {
|
|
304
|
+
"@tsed/cli-plugin-mocha": cliVersion
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
];
|
|
309
|
+
const featuresLinterChoices = (cliVersion) => [
|
|
310
|
+
{
|
|
311
|
+
name: "EsLint",
|
|
312
|
+
checked: true,
|
|
313
|
+
value: {
|
|
314
|
+
type: "eslint",
|
|
315
|
+
devDependencies: {
|
|
316
|
+
"@tsed/cli-plugin-eslint": cliVersion
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: "TsLint (deprecated)",
|
|
322
|
+
checked: true,
|
|
323
|
+
value: {
|
|
324
|
+
type: "tslint",
|
|
325
|
+
devDependencies: {
|
|
326
|
+
"@tsed/cli-plugin-tslint": cliVersion
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
];
|
|
331
|
+
const featuresExtraLinterChoices = [
|
|
332
|
+
{
|
|
333
|
+
name: "Prettier",
|
|
334
|
+
value: {
|
|
335
|
+
type: "prettier"
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: "Lint on commit",
|
|
340
|
+
value: {
|
|
341
|
+
type: "lintstaged"
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
];
|
|
345
|
+
const featuresBundlerChoices = [
|
|
346
|
+
{
|
|
347
|
+
name: "Babel",
|
|
348
|
+
value: {
|
|
349
|
+
type: "babel",
|
|
350
|
+
devDependencies: {
|
|
351
|
+
...babelDevDependencies
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: "Webpack",
|
|
357
|
+
value: {
|
|
358
|
+
type: "babel:webpack",
|
|
359
|
+
devDependencies: {
|
|
360
|
+
...babelDevDependencies,
|
|
361
|
+
"babel-loader": "latest",
|
|
362
|
+
webpack: "latest",
|
|
363
|
+
"webpack-cli": "latest"
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
];
|
|
368
|
+
const packageManagerChoices = [
|
|
369
|
+
{
|
|
370
|
+
name: "Yarn",
|
|
371
|
+
checked: true,
|
|
372
|
+
value: "yarn"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: "NPM",
|
|
376
|
+
checked: false,
|
|
377
|
+
value: "npm"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: "PNPM",
|
|
381
|
+
checked: false,
|
|
382
|
+
value: "pnpm"
|
|
383
|
+
}
|
|
384
|
+
];
|
|
385
|
+
const parseFeaturesFile = (features, cliVersion) => {
|
|
386
|
+
var _a, _b, _c, _d, _e;
|
|
387
|
+
const mappedFeatures = {
|
|
388
|
+
platform: features.platform,
|
|
389
|
+
convention: features.convention,
|
|
390
|
+
features: [
|
|
391
|
+
...featureChoices(cliVersion)
|
|
392
|
+
.map((v) => v.value)
|
|
393
|
+
.filter((v) => features.features.filter((v) => typeof v === "string").includes(v.type)),
|
|
394
|
+
...features.features.filter((v) => typeof v === "object")
|
|
395
|
+
],
|
|
396
|
+
featuresDB: (_a = featuresDbChoices(cliVersion).find((v) => v.value.type === features.featuresDB)) === null || _a === void 0 ? void 0 : _a.value,
|
|
397
|
+
featuresTypeORM: (_b = exports.FEATURES_TYPEORM_CONNECTION_TYPES.find((v) => v.value.type === features.featuresTypeORM)) === null || _b === void 0 ? void 0 : _b.value,
|
|
398
|
+
featuresTesting: (_c = featuresTestingChoices(cliVersion).find((v) => v.value.type === features.featuresTesting)) === null || _c === void 0 ? void 0 : _c.value,
|
|
399
|
+
featuresLinter: (_d = featuresLinterChoices(cliVersion).find((v) => v.value.type === features.featuresLinter)) === null || _d === void 0 ? void 0 : _d.value,
|
|
400
|
+
featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value).filter((v) => { var _a; return (_a = features.featuresExtraLinter) === null || _a === void 0 ? void 0 : _a.includes(v.type); }),
|
|
401
|
+
featuresBundler: (_e = featuresBundlerChoices.find((v) => v.value.type === features.featuresBundlerChoices)) === null || _e === void 0 ? void 0 : _e.value,
|
|
402
|
+
packageManager: features.packageManager
|
|
403
|
+
};
|
|
404
|
+
return mappedFeatures;
|
|
405
|
+
};
|
|
406
|
+
exports.parseFeaturesFile = parseFeaturesFile;
|
|
407
|
+
const getFeaturesChoicesValues = (cliVersion) => {
|
|
408
|
+
const mappedFeatures = {
|
|
409
|
+
platform: platformChoices.map((v) => v.value),
|
|
410
|
+
convention: conventionChoices.map((v) => v.value),
|
|
411
|
+
features: featureChoices(cliVersion).map((v) => v.value.type),
|
|
412
|
+
featuresDB: featuresDbChoices(cliVersion).map((v) => v.value.type),
|
|
413
|
+
featuresTypeORM: exports.FEATURES_TYPEORM_CONNECTION_TYPES.map((v) => v.value.type),
|
|
414
|
+
featuresTesting: featuresTestingChoices(cliVersion).map((v) => v.value.type),
|
|
415
|
+
featuresLinter: featuresLinterChoices(cliVersion).map((v) => v.value.type),
|
|
416
|
+
featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value.type),
|
|
417
|
+
featuresBundler: featuresBundlerChoices.map((v) => v.value.type),
|
|
418
|
+
packageManager: packageManagerChoices.map((v) => v.value)
|
|
419
|
+
};
|
|
420
|
+
return mappedFeatures;
|
|
421
|
+
};
|
|
422
|
+
exports.getFeaturesChoicesValues = getFeaturesChoicesValues;
|
|
141
423
|
cli_core_1.registerProvider({
|
|
142
424
|
provide: Features,
|
|
143
425
|
deps: [cli_core_1.CliPackageJson],
|
|
@@ -148,18 +430,7 @@ cli_core_1.registerProvider({
|
|
|
148
430
|
message: "Choose the target platform:",
|
|
149
431
|
type: "list",
|
|
150
432
|
name: "platform",
|
|
151
|
-
choices:
|
|
152
|
-
{
|
|
153
|
-
name: "Express.js",
|
|
154
|
-
checked: true,
|
|
155
|
-
value: "express"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
name: "Koa.js",
|
|
159
|
-
checked: false,
|
|
160
|
-
value: "koa"
|
|
161
|
-
}
|
|
162
|
-
]
|
|
433
|
+
choices: platformChoices
|
|
163
434
|
},
|
|
164
435
|
{
|
|
165
436
|
message: "Choose the architecture for your project:",
|
|
@@ -182,151 +453,20 @@ cli_core_1.registerProvider({
|
|
|
182
453
|
message: "Choose the convention file styling:",
|
|
183
454
|
type: "list",
|
|
184
455
|
name: "convention",
|
|
185
|
-
choices:
|
|
186
|
-
{
|
|
187
|
-
name: "Ts.ED",
|
|
188
|
-
checked: true,
|
|
189
|
-
value: interfaces_1.ProjectConvention.DEFAULT
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: "Angular",
|
|
193
|
-
checked: false,
|
|
194
|
-
value: interfaces_1.ProjectConvention.ANGULAR
|
|
195
|
-
}
|
|
196
|
-
]
|
|
456
|
+
choices: conventionChoices
|
|
197
457
|
},
|
|
198
458
|
{
|
|
199
459
|
type: "checkbox",
|
|
200
460
|
name: "features",
|
|
201
461
|
message: "Check the features needed for your project",
|
|
202
|
-
choices:
|
|
203
|
-
{
|
|
204
|
-
name: "GraphQL",
|
|
205
|
-
value: {
|
|
206
|
-
type: "graphql",
|
|
207
|
-
dependencies: {
|
|
208
|
-
"@tsed/typegraphql": "{{tsedVersion}}",
|
|
209
|
-
"apollo-datasource": "latest",
|
|
210
|
-
"apollo-datasource-rest": "latest",
|
|
211
|
-
"type-graphql": "latest",
|
|
212
|
-
graphql: "latest",
|
|
213
|
-
"class-validator": "latest"
|
|
214
|
-
},
|
|
215
|
-
devDependencies: {
|
|
216
|
-
"apollo-server-testing": "latest"
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
name: "Database",
|
|
222
|
-
value: { type: "db" }
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: "Passport.js",
|
|
226
|
-
when: isPlatform("express"),
|
|
227
|
-
value: {
|
|
228
|
-
type: "passportjs",
|
|
229
|
-
devDependencies: {
|
|
230
|
-
"@tsed/cli-plugin-passport": cliVersion
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: "Socket.io",
|
|
236
|
-
value: {
|
|
237
|
-
type: "socketio",
|
|
238
|
-
dependencies: {
|
|
239
|
-
"@tsed/socketio": "{{tsedVersion}}",
|
|
240
|
-
"socket.io": "latest"
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
name: "Swagger",
|
|
246
|
-
value: {
|
|
247
|
-
type: "swagger",
|
|
248
|
-
dependencies: {
|
|
249
|
-
"@tsed/swagger": "{{tsedVersion}}"
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
name: "OpenID Connect provider",
|
|
255
|
-
value: {
|
|
256
|
-
type: "oidc",
|
|
257
|
-
devDependencies: {
|
|
258
|
-
"@tsed/cli-plugin-oidc-provider": cliVersion
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: "Testing",
|
|
264
|
-
value: {
|
|
265
|
-
type: "testing",
|
|
266
|
-
dependencies: {},
|
|
267
|
-
devDependencies: {
|
|
268
|
-
"@types/supertest": "latest",
|
|
269
|
-
supertest: "latest"
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
name: "Linter",
|
|
275
|
-
value: {
|
|
276
|
-
type: "linter"
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
name: "Bundler",
|
|
281
|
-
value: {
|
|
282
|
-
type: "bundler"
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
name: "Commands",
|
|
287
|
-
value: {
|
|
288
|
-
type: "commands",
|
|
289
|
-
dependencies: {
|
|
290
|
-
"@tsed/cli-core": cliVersion
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
]
|
|
462
|
+
choices: featureChoices(cliVersion)
|
|
295
463
|
},
|
|
296
464
|
{
|
|
297
465
|
message: "Choose a ORM manager",
|
|
298
466
|
type: "list",
|
|
299
467
|
name: "featuresDB",
|
|
300
468
|
when: hasFeature("db"),
|
|
301
|
-
choices:
|
|
302
|
-
{
|
|
303
|
-
name: "Prisma",
|
|
304
|
-
value: {
|
|
305
|
-
type: "prisma",
|
|
306
|
-
devDependencies: {
|
|
307
|
-
"@tsed/cli-plugin-prisma": cliVersion
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
name: "Mongoose",
|
|
313
|
-
value: {
|
|
314
|
-
type: "mongoose",
|
|
315
|
-
devDependencies: {
|
|
316
|
-
"@tsed/cli-plugin-mongoose": cliVersion
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
name: "TypeORM",
|
|
322
|
-
value: {
|
|
323
|
-
type: "typeorm",
|
|
324
|
-
devDependencies: {
|
|
325
|
-
"@tsed/cli-plugin-typeorm": cliVersion
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
]
|
|
469
|
+
choices: featuresDbChoices(cliVersion)
|
|
330
470
|
},
|
|
331
471
|
{
|
|
332
472
|
type: "list",
|
|
@@ -346,103 +486,35 @@ cli_core_1.registerProvider({
|
|
|
346
486
|
type: "list",
|
|
347
487
|
name: "featuresTesting",
|
|
348
488
|
when: hasFeature("testing"),
|
|
349
|
-
choices:
|
|
350
|
-
{
|
|
351
|
-
name: "Jest",
|
|
352
|
-
value: {
|
|
353
|
-
type: "jest",
|
|
354
|
-
devDependencies: {
|
|
355
|
-
"@tsed/cli-plugin-jest": cliVersion
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
name: "Mocha + Chai + Sinon",
|
|
361
|
-
value: {
|
|
362
|
-
type: "mocha",
|
|
363
|
-
devDependencies: {
|
|
364
|
-
"@tsed/cli-plugin-mocha": cliVersion
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
]
|
|
489
|
+
choices: featuresTestingChoices(cliVersion)
|
|
369
490
|
},
|
|
370
491
|
{
|
|
371
492
|
message: "Choose linter tools framework",
|
|
372
493
|
type: "list",
|
|
373
494
|
name: "featuresLinter",
|
|
374
495
|
when: hasFeature("linter"),
|
|
375
|
-
choices:
|
|
376
|
-
{
|
|
377
|
-
name: "EsLint",
|
|
378
|
-
checked: true,
|
|
379
|
-
value: {
|
|
380
|
-
type: "eslint",
|
|
381
|
-
devDependencies: {
|
|
382
|
-
"@tsed/cli-plugin-eslint": cliVersion
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
name: "TsLint (deprecated)",
|
|
388
|
-
checked: true,
|
|
389
|
-
value: {
|
|
390
|
-
type: "tslint",
|
|
391
|
-
devDependencies: {
|
|
392
|
-
"@tsed/cli-plugin-tslint": cliVersion
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
]
|
|
496
|
+
choices: featuresLinterChoices(cliVersion)
|
|
397
497
|
},
|
|
398
498
|
{
|
|
399
499
|
message: "Choose extra linter tools",
|
|
400
500
|
type: "checkbox",
|
|
401
501
|
name: "featuresExtraLinter",
|
|
402
502
|
when: hasFeature("linter"),
|
|
403
|
-
choices:
|
|
404
|
-
{
|
|
405
|
-
name: "Prettier",
|
|
406
|
-
value: {
|
|
407
|
-
type: "prettier"
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
name: "Lint on commit",
|
|
412
|
-
value: {
|
|
413
|
-
type: "lintstaged"
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
]
|
|
503
|
+
choices: featuresExtraLinterChoices
|
|
417
504
|
},
|
|
418
505
|
{
|
|
419
506
|
message: "Choose your bundler",
|
|
420
507
|
type: "list",
|
|
421
508
|
name: "featuresBundler",
|
|
422
509
|
when: hasFeature("bundler"),
|
|
423
|
-
choices:
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
name: "Webpack",
|
|
435
|
-
value: {
|
|
436
|
-
type: "babel:webpack",
|
|
437
|
-
devDependencies: {
|
|
438
|
-
...babelDevDependencies,
|
|
439
|
-
"babel-loader": "latest",
|
|
440
|
-
webpack: "latest",
|
|
441
|
-
"webpack-cli": "latest"
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
]
|
|
510
|
+
choices: featuresBundlerChoices
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
message: "Choose the OIDC base path server",
|
|
514
|
+
name: "oidcBasePath",
|
|
515
|
+
default: "/oidc",
|
|
516
|
+
when: hasFeature("oidc"),
|
|
517
|
+
type: "input"
|
|
446
518
|
},
|
|
447
519
|
{
|
|
448
520
|
message: "Choose the OIDC base path server",
|
|
@@ -455,23 +527,7 @@ cli_core_1.registerProvider({
|
|
|
455
527
|
message: "Choose the package manager:",
|
|
456
528
|
type: "list",
|
|
457
529
|
name: "packageManager",
|
|
458
|
-
choices:
|
|
459
|
-
{
|
|
460
|
-
name: "Yarn",
|
|
461
|
-
checked: true,
|
|
462
|
-
value: "yarn"
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
name: "NPM",
|
|
466
|
-
checked: false,
|
|
467
|
-
value: "npm"
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
name: "PNPM",
|
|
471
|
-
checked: false,
|
|
472
|
-
value: "pnpm"
|
|
473
|
-
}
|
|
474
|
-
]
|
|
530
|
+
choices: packageManagerChoices
|
|
475
531
|
}
|
|
476
532
|
];
|
|
477
533
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Features.js","sourceRoot":"","sources":["../../src/services/Features.ts"],"names":[],"mappings":";;;AAAA,6CAAwE;AACxE,qCAAoC;AACpC,8CAAwE;AAexE,SAAgB,QAAQ;IACtB,OAAO,iBAAM,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAFD,4BAEC;AAED,SAAgB,UAAU,CAAC,OAAe;IACxC,OAAO,CAAC,GAAQ,EAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE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eAAe,EAAE;gCACf,GAAG,oBAAoB;6BACxB;yBACF;qBACF;oBACD;wBACE,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE;4BACL,IAAI,EAAE,eAAe;4BACrB,eAAe,EAAE;gCACf,GAAG,oBAAoB;gCACvB,cAAc,EAAE,QAAQ;gCACxB,OAAO,EAAE,QAAQ;gCACjB,aAAa,EAAE,QAAQ;6BACxB;yBACF;qBACF;iBACF;aACF;YACD;gBACE,OAAO,EAAE,kCAAkC;gBAC3C,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;gBACxB,IAAI,EAAE,OAAO;aACd;YACD;gBACE,OAAO,EAAE,6BAA6B;gBACtC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,IAAI;wBACb,KAAK,EAAE,MAAM;qBACd;oBACD;wBACE,IAAI,EAAE,KAAK;wBACX,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,KAAK;qBACb;oBACD;wBACE,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,MAAM;qBACd;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {CliPackageJson, Inject, registerProvider} from \"@tsed/cli-core\";\nimport {getValue} from \"@tsed/core\";\nimport {ProjectConvention, ArchitectureConvention} from \"../interfaces\";\n\nexport interface FeatureValue {\n type: string;\n dependencies?: {[key: string]: string};\n devDependencies?: {[key: string]: string};\n}\n\nexport interface Feature {\n name: string;\n value: FeatureValue;\n}\n\nexport type Features = Feature[];\n\nexport function Features() {\n return Inject(Features);\n}\n\nexport function hasFeature(feature: string) {\n return (ctx: any): boolean => !!ctx.features.find((item: any) => item.type === feature);\n}\n\nexport function hasValue(expression: string, value: any) {\n return (ctx: any) => getValue(expression, ctx) === value;\n}\n\nexport function isPlatform(...types: string[]) {\n return (ctx: any) => [types].includes(ctx.platform);\n}\n\nexport const FEATURES_TYPEORM_CONNECTION_TYPES = [\n {\n name: \"MySQL\",\n value: {\n type: \"typeorm:mysql\",\n dependencies: {\n mysql: \"latest\"\n }\n }\n },\n {\n name: \"MariaDB\",\n value: {\n type: \"typeorm:mariadb\",\n dependencies: {\n mariadb: \"latest\"\n }\n }\n },\n {\n name: \"Postgres\",\n value: {\n type: \"typeorm:postgres\",\n dependencies: {\n pg: \"latest\"\n }\n }\n },\n {\n name: \"CockRoachDB\",\n value: {\n type: \"typeorm:postgres\",\n dependencies: {\n cockroachdb: \"latest\"\n }\n }\n },\n {\n name: \"SQLite\",\n value: {\n type: \"typeorm:sqlite\",\n dependencies: {\n sqlite3: \"latest\"\n }\n }\n },\n {\n name: \"Cordova\",\n value: {\n type: \"typeorm:cordova\"\n }\n },\n {\n name: \"NativeScript\",\n value: {\n type: \"typeorm:nativescript\"\n }\n },\n {\n name: \"Oracle\",\n value: {\n type: \"typeorm:oracle\",\n dependencies: {\n oracledb: \"latest\"\n }\n }\n },\n {\n name: \"MsSQL\",\n value: {\n type: \"typeorm:mssql\",\n dependencies: {\n mssql: \"latest\"\n }\n }\n },\n {\n name: \"MongoDB\",\n value: {\n type: \"typeorm:mongodb\",\n dependencies: {\n mongodb: \"latest\"\n }\n }\n },\n {\n name: \"SQL.js\",\n value: {\n type: \"typeorm:sqljs\",\n dependencies: {}\n }\n },\n {\n name: \"ReactNative\",\n value: {\n type: \"typeorm:reactnative\",\n dependencies: {}\n }\n },\n {\n name: \"Expo\",\n value: {\n type: \"typeorm:expo\",\n dependencies: {}\n }\n }\n];\n\nconst babelDevDependencies = {\n \"@babel/cli\": \"latest\",\n \"@babel/core\": \"latest\",\n \"@babel/node\": \"latest\",\n \"@babel/plugin-proposal-class-properties\": \"latest\",\n \"@babel/plugin-proposal-decorators\": \"latest\",\n \"@babel/preset-env\": \"latest\",\n \"@babel/preset-typescript\": \"latest\",\n \"babel-plugin-transform-typescript-metadata\": \"latest\",\n \"babel-watch\": \"latest\"\n};\n\nregisterProvider({\n provide: Features,\n deps: [CliPackageJson],\n useFactory(cliPackageJson: CliPackageJson) {\n const cliVersion = cliPackageJson.version;\n\n return [\n {\n message: \"Choose the target platform:\",\n type: \"list\",\n name: \"platform\",\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 message: \"Choose the architecture for your project:\",\n type: \"list\",\n name: \"architecture\",\n choices: [\n {\n name: \"Ts.ED\",\n checked: true,\n value: ArchitectureConvention.DEFAULT\n },\n {\n name: \"feature\",\n checked: false,\n value: ArchitectureConvention.FEATURE\n }\n ]\n },\n {\n message: \"Choose the convention file styling:\",\n type: \"list\",\n name: \"convention\",\n choices: [\n {\n name: \"Ts.ED\",\n checked: true,\n value: ProjectConvention.DEFAULT\n },\n {\n name: \"Angular\",\n checked: false,\n value: ProjectConvention.ANGULAR\n }\n ]\n },\n {\n type: \"checkbox\",\n name: \"features\",\n message: \"Check the features needed for your project\",\n choices: [\n {\n name: \"GraphQL\",\n value: {\n type: \"graphql\",\n dependencies: {\n \"@tsed/typegraphql\": \"{{tsedVersion}}\",\n \"apollo-datasource\": \"latest\",\n \"apollo-datasource-rest\": \"latest\",\n \"type-graphql\": \"latest\",\n graphql: \"latest\",\n \"class-validator\": \"latest\"\n },\n devDependencies: {\n \"apollo-server-testing\": \"latest\"\n }\n }\n },\n {\n name: \"Database\",\n value: {type: \"db\"}\n },\n {\n name: \"Passport.js\",\n when: isPlatform(\"express\"),\n value: {\n type: \"passportjs\",\n devDependencies: {\n \"@tsed/cli-plugin-passport\": cliVersion\n }\n }\n },\n {\n name: \"Socket.io\",\n value: {\n type: \"socketio\",\n dependencies: {\n \"@tsed/socketio\": \"{{tsedVersion}}\",\n \"socket.io\": \"latest\"\n }\n }\n },\n {\n name: \"Swagger\",\n value: {\n type: \"swagger\",\n dependencies: {\n \"@tsed/swagger\": \"{{tsedVersion}}\"\n }\n }\n },\n {\n name: \"OpenID Connect provider\",\n value: {\n type: \"oidc\",\n devDependencies: {\n \"@tsed/cli-plugin-oidc-provider\": cliVersion\n }\n }\n },\n {\n name: \"Testing\",\n value: {\n type: \"testing\",\n dependencies: {},\n devDependencies: {\n \"@types/supertest\": \"latest\",\n supertest: \"latest\"\n }\n }\n },\n {\n name: \"Linter\",\n value: {\n type: \"linter\"\n }\n },\n {\n name: \"Bundler\",\n value: {\n type: \"bundler\"\n }\n },\n {\n name: \"Commands\",\n value: {\n type: \"commands\",\n dependencies: {\n \"@tsed/cli-core\": cliVersion\n }\n }\n }\n ]\n },\n {\n message: \"Choose a ORM manager\",\n type: \"list\",\n name: \"featuresDB\",\n when: hasFeature(\"db\"),\n choices: [\n {\n name: \"Prisma\",\n value: {\n type: \"prisma\",\n devDependencies: {\n \"@tsed/cli-plugin-prisma\": cliVersion\n }\n }\n },\n {\n name: \"Mongoose\",\n value: {\n type: \"mongoose\",\n devDependencies: {\n \"@tsed/cli-plugin-mongoose\": cliVersion\n }\n }\n },\n {\n name: \"TypeORM\",\n value: {\n type: \"typeorm\",\n devDependencies: {\n \"@tsed/cli-plugin-typeorm\": cliVersion\n }\n }\n }\n ]\n },\n {\n type: \"list\",\n name: \"featuresTypeORM\",\n message: \"Which TypeORM you want to install?\",\n choices: FEATURES_TYPEORM_CONNECTION_TYPES,\n when: hasValue(\"featuresDB.type\", \"typeorm\")\n },\n {\n type: \"password\",\n name: \"GH_TOKEN\",\n message:\n \"Enter GH_TOKEN to use the premium @tsedio/prisma package or leave blank (see https://tsed.io/tutorials/prisma-client.html)\",\n when: hasValue(\"featuresDB.type\", \"prisma\")\n },\n {\n message: \"Choose unit framework\",\n type: \"list\",\n name: \"featuresTesting\",\n when: hasFeature(\"testing\"),\n choices: [\n {\n name: \"Jest\",\n value: {\n type: \"jest\",\n devDependencies: {\n \"@tsed/cli-plugin-jest\": cliVersion\n }\n }\n },\n {\n name: \"Mocha + Chai + Sinon\",\n value: {\n type: \"mocha\",\n devDependencies: {\n \"@tsed/cli-plugin-mocha\": cliVersion\n }\n }\n }\n ]\n },\n {\n message: \"Choose linter tools framework\",\n type: \"list\",\n name: \"featuresLinter\",\n when: hasFeature(\"linter\"),\n choices: [\n {\n name: \"EsLint\",\n checked: true,\n value: {\n type: \"eslint\",\n devDependencies: {\n \"@tsed/cli-plugin-eslint\": cliVersion\n }\n }\n },\n {\n name: \"TsLint (deprecated)\",\n checked: true,\n value: {\n type: \"tslint\",\n devDependencies: {\n \"@tsed/cli-plugin-tslint\": cliVersion\n }\n }\n }\n ]\n },\n {\n message: \"Choose extra linter tools\",\n type: \"checkbox\",\n name: \"featuresExtraLinter\",\n when: hasFeature(\"linter\"),\n choices: [\n {\n name: \"Prettier\",\n value: {\n type: \"prettier\"\n }\n },\n {\n name: \"Lint on commit\",\n value: {\n type: \"lintstaged\"\n }\n }\n ]\n },\n {\n message: \"Choose your bundler\",\n type: \"list\",\n name: \"featuresBundler\",\n when: hasFeature(\"bundler\"),\n choices: [\n {\n name: \"Babel\",\n value: {\n type: \"babel\",\n devDependencies: {\n ...babelDevDependencies\n }\n }\n },\n {\n name: \"Webpack\",\n value: {\n type: \"babel:webpack\",\n devDependencies: {\n ...babelDevDependencies,\n \"babel-loader\": \"latest\",\n webpack: \"latest\",\n \"webpack-cli\": \"latest\"\n }\n }\n }\n ]\n },\n {\n message: \"Choose the OIDC base path server\",\n name: \"oidcBasePath\",\n default: \"/oidc\",\n when: hasFeature(\"oidc\"),\n type: \"input\"\n },\n {\n message: \"Choose the package manager:\",\n type: \"list\",\n name: \"packageManager\",\n choices: [\n {\n name: \"Yarn\",\n checked: true,\n value: \"yarn\"\n },\n {\n name: \"NPM\",\n checked: false,\n value: \"npm\"\n },\n {\n name: \"PNPM\",\n checked: false,\n value: \"pnpm\"\n }\n ]\n }\n ];\n }\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Features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O,EAAE,uBAAuB;gBAChC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;gBAC3B,OAAO,EAAE,sBAAsB,CAAC,UAAU,CAAC;aAC5C;YACD;gBACE,OAAO,EAAE,+BAA+B;gBACxC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC;gBAC1B,OAAO,EAAE,qBAAqB,CAAC,UAAU,CAAC;aAC3C;YACD;gBACE,OAAO,EAAE,2BAA2B;gBACpC,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC;gBAC1B,OAAO,EAAE,0BAA0B;aACpC;YACD;gBACE,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;gBAC3B,OAAO,EAAE,sBAAsB;aAChC;YACD;gBACE,OAAO,EAAE,kCAAkC;gBAC3C,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;gBACxB,IAAI,EAAE,OAAO;aACd;YACD;gBACE,OAAO,EAAE,kCAAkC;gBAC3C,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;gBACxB,IAAI,EAAE,OAAO;aACd;YACD;gBACE,OAAO,EAAE,6BAA6B;gBACtC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,qBAAqB;aAC/B;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {CliPackageJson, Inject, registerProvider} from \"@tsed/cli-core\";\nimport {getValue} from \"@tsed/core\";\nimport {ProjectConvention, ArchitectureConvention} from \"../interfaces\";\n\nexport interface FeatureValue {\n type: string;\n dependencies?: {[key: string]: string | undefined};\n devDependencies?: {[key: string]: string | undefined};\n}\n\nexport interface Feature {\n name: string;\n value: FeatureValue;\n}\n\nexport type Features = Feature[];\n\nexport function Features() {\n return Inject(Features);\n}\n\nexport function hasFeature(feature: string) {\n return (ctx: any): boolean => !!ctx.features.find((item: any) => item.type === feature);\n}\n\nexport function hasValue(expression: string, value: any) {\n return (ctx: any) => getValue(expression, ctx) === value;\n}\n\nexport function isPlatform(...types: string[]) {\n return (ctx: any) => [types].includes(ctx.platform);\n}\n\nexport const FEATURES_TYPEORM_CONNECTION_TYPES = [\n {\n name: \"MySQL\",\n value: {\n type: \"typeorm:mysql\",\n dependencies: {\n mysql: \"latest\"\n }\n }\n },\n {\n name: \"MariaDB\",\n value: {\n type: \"typeorm:mariadb\",\n dependencies: {\n mariadb: \"latest\"\n }\n }\n },\n {\n name: \"Postgres\",\n value: {\n type: \"typeorm:postgres\",\n dependencies: {\n pg: \"latest\"\n }\n }\n },\n {\n name: \"CockRoachDB\",\n value: {\n type: \"typeorm:postgres\",\n dependencies: {\n cockroachdb: \"latest\"\n }\n }\n },\n {\n name: \"SQLite\",\n value: {\n type: \"typeorm:sqlite\",\n dependencies: {\n sqlite3: \"latest\"\n }\n }\n },\n {\n name: \"Cordova\",\n value: {\n type: \"typeorm:cordova\"\n }\n },\n {\n name: \"NativeScript\",\n value: {\n type: \"typeorm:nativescript\"\n }\n },\n {\n name: \"Oracle\",\n value: {\n type: \"typeorm:oracle\",\n dependencies: {\n oracledb: \"latest\"\n }\n }\n },\n {\n name: \"MsSQL\",\n value: {\n type: \"typeorm:mssql\",\n dependencies: {\n mssql: \"latest\"\n }\n }\n },\n {\n name: \"MongoDB\",\n value: {\n type: \"typeorm:mongodb\",\n dependencies: {\n mongodb: \"latest\"\n }\n }\n },\n {\n name: \"SQL.js\",\n value: {\n type: \"typeorm:sqljs\",\n dependencies: {}\n }\n },\n {\n name: \"ReactNative\",\n value: {\n type: \"typeorm:reactnative\",\n dependencies: {}\n }\n },\n {\n name: \"Expo\",\n value: {\n type: \"typeorm:expo\",\n dependencies: {}\n }\n }\n];\n\nconst babelDevDependencies = {\n \"@babel/cli\": \"latest\",\n \"@babel/core\": \"latest\",\n \"@babel/node\": \"latest\",\n \"@babel/plugin-proposal-class-properties\": \"latest\",\n \"@babel/plugin-proposal-decorators\": \"latest\",\n \"@babel/preset-env\": \"latest\",\n \"@babel/preset-typescript\": \"latest\",\n \"babel-plugin-transform-typescript-metadata\": \"latest\",\n \"babel-watch\": \"latest\"\n};\n\nconst platformChoices = [\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\nconst conventionChoices = [\n {\n name: \"Ts.ED\",\n checked: true,\n value: ProjectConvention.DEFAULT\n },\n {\n name: \"Angular\",\n checked: false,\n value: ProjectConvention.ANGULAR\n }\n];\n\nconst featureChoices = (cliVersion: string) => [\n {\n name: \"GraphQL\",\n value: {\n type: \"graphql\",\n dependencies: {\n \"@tsed/graphql\": \"{{tsedVersion}}\",\n \"apollo-datasource\": \"^3.3.1\",\n \"apollo-datasource-rest\": \"^3.5.1\",\n \"apollo-server-core\": \"^3.6.2\",\n \"type-graphql\": \"^1.1.1\",\n \"class-validator\": \"^0.13.2\",\n graphql: \"^15.7.2\"\n },\n devDependencies: {\n \"@types/validator\": \"latest\",\n \"apollo-server-testing\": \"latest\"\n }\n }\n },\n {\n name: \"Database\",\n value: {type: \"db\"}\n },\n {\n name: \"Passport.js\",\n when: isPlatform(\"express\"),\n value: {\n type: \"passportjs\",\n devDependencies: {\n \"@tsed/cli-plugin-passport\": cliVersion\n }\n }\n },\n {\n name: \"Socket.io\",\n value: {\n type: \"socketio\",\n dependencies: {\n \"@tsed/socketio\": \"{{tsedVersion}}\",\n \"socket.io\": \"latest\"\n }\n }\n },\n {\n name: \"Swagger\",\n value: {\n type: \"swagger\",\n dependencies: {\n \"@tsed/swagger\": \"{{tsedVersion}}\"\n }\n }\n },\n {\n name: \"OpenID Connect provider\",\n value: {\n type: \"oidc\",\n devDependencies: {\n \"@tsed/cli-plugin-oidc-provider\": cliVersion\n }\n }\n },\n {\n name: \"Testing\",\n value: {\n type: \"testing\",\n dependencies: {},\n devDependencies: {\n \"@types/supertest\": \"latest\",\n supertest: \"latest\"\n }\n }\n },\n {\n name: \"Linter\",\n value: {\n type: \"linter\"\n }\n },\n {\n name: \"Bundler\",\n value: {\n type: \"bundler\"\n }\n },\n {\n name: \"Commands\",\n value: {\n type: \"commands\",\n dependencies: {\n \"@tsed/cli-core\": cliVersion\n }\n }\n }\n];\n\nconst featuresDbChoices = (cliVersion: string) => [\n {\n name: \"Prisma\",\n value: {\n type: \"prisma\",\n devDependencies: {\n \"@tsed/cli-plugin-prisma\": cliVersion\n }\n }\n },\n {\n name: \"Mongoose\",\n value: {\n type: \"mongoose\",\n devDependencies: {\n \"@tsed/cli-plugin-mongoose\": cliVersion\n }\n }\n },\n {\n name: \"TypeORM\",\n value: {\n type: \"typeorm\",\n devDependencies: {\n \"@tsed/cli-plugin-typeorm\": cliVersion\n }\n }\n }\n];\n\nconst featuresTestingChoices = (cliVersion: string) => [\n {\n name: \"Jest\",\n value: {\n type: \"jest\",\n devDependencies: {\n \"@tsed/cli-plugin-jest\": cliVersion\n }\n }\n },\n {\n name: \"Mocha + Chai + Sinon\",\n value: {\n type: \"mocha\",\n devDependencies: {\n \"@tsed/cli-plugin-mocha\": cliVersion\n }\n }\n }\n];\n\nconst featuresLinterChoices = (cliVersion: string) => [\n {\n name: \"EsLint\",\n checked: true,\n value: {\n type: \"eslint\",\n devDependencies: {\n \"@tsed/cli-plugin-eslint\": cliVersion\n }\n }\n },\n {\n name: \"TsLint (deprecated)\",\n checked: true,\n value: {\n type: \"tslint\",\n devDependencies: {\n \"@tsed/cli-plugin-tslint\": cliVersion\n }\n }\n }\n];\n\nconst featuresExtraLinterChoices = [\n {\n name: \"Prettier\",\n value: {\n type: \"prettier\"\n }\n },\n {\n name: \"Lint on commit\",\n value: {\n type: \"lintstaged\"\n }\n }\n];\n\nconst featuresBundlerChoices = [\n {\n name: \"Babel\",\n value: {\n type: \"babel\",\n devDependencies: {\n ...babelDevDependencies\n }\n }\n },\n {\n name: \"Webpack\",\n value: {\n type: \"babel:webpack\",\n devDependencies: {\n ...babelDevDependencies,\n \"babel-loader\": \"latest\",\n webpack: \"latest\",\n \"webpack-cli\": \"latest\"\n }\n }\n }\n];\n\nconst packageManagerChoices = [\n {\n name: \"Yarn\",\n checked: true,\n value: \"yarn\"\n },\n {\n name: \"NPM\",\n checked: false,\n value: \"npm\"\n },\n {\n name: \"PNPM\",\n checked: false,\n value: \"pnpm\"\n }\n];\n\nexport const parseFeaturesFile = (features: Record<string, any>, cliVersion: string) => {\n const mappedFeatures = {\n platform: features.platform,\n convention: features.convention,\n features: [\n ...featureChoices(cliVersion)\n .map((v) => v.value)\n .filter((v) => features.features.filter((v: string | Record<string, any>) => typeof v === \"string\").includes(v.type)),\n ...features.features.filter((v: string | Record<string, any>) => typeof v === \"object\")\n ],\n featuresDB: featuresDbChoices(cliVersion).find((v) => v.value.type === features.featuresDB)?.value,\n featuresTypeORM: FEATURES_TYPEORM_CONNECTION_TYPES.find((v) => v.value.type === features.featuresTypeORM)?.value,\n featuresTesting: featuresTestingChoices(cliVersion).find((v) => v.value.type === features.featuresTesting)?.value,\n featuresLinter: featuresLinterChoices(cliVersion).find((v) => v.value.type === features.featuresLinter)?.value,\n featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value).filter((v) => features.featuresExtraLinter?.includes(v.type)),\n featuresBundler: featuresBundlerChoices.find((v) => v.value.type === features.featuresBundlerChoices)?.value,\n packageManager: features.packageManager\n };\n return mappedFeatures;\n};\n\nexport const getFeaturesChoicesValues = (cliVersion: string) => {\n const mappedFeatures = {\n platform: platformChoices.map((v) => v.value),\n convention: conventionChoices.map((v) => v.value),\n features: featureChoices(cliVersion).map((v) => v.value.type),\n featuresDB: featuresDbChoices(cliVersion).map((v) => v.value.type),\n featuresTypeORM: FEATURES_TYPEORM_CONNECTION_TYPES.map((v) => v.value.type),\n featuresTesting: featuresTestingChoices(cliVersion).map((v) => v.value.type),\n featuresLinter: featuresLinterChoices(cliVersion).map((v) => v.value.type),\n featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value.type),\n featuresBundler: featuresBundlerChoices.map((v) => v.value.type),\n packageManager: packageManagerChoices.map((v) => v.value)\n };\n return mappedFeatures;\n};\n\nregisterProvider({\n provide: Features,\n deps: [CliPackageJson],\n useFactory(cliPackageJson: CliPackageJson) {\n const cliVersion = cliPackageJson.version;\n\n return [\n {\n message: \"Choose the target platform:\",\n type: \"list\",\n name: \"platform\",\n choices: platformChoices\n },\n {\n message: \"Choose the architecture for your project:\",\n type: \"list\",\n name: \"architecture\",\n choices: [\n {\n name: \"Ts.ED\",\n checked: true,\n value: ArchitectureConvention.DEFAULT\n },\n {\n name: \"feature\",\n checked: false,\n value: ArchitectureConvention.FEATURE\n }\n ]\n },\n {\n message: \"Choose the convention file styling:\",\n type: \"list\",\n name: \"convention\",\n choices: conventionChoices\n },\n {\n type: \"checkbox\",\n name: \"features\",\n message: \"Check the features needed for your project\",\n choices: featureChoices(cliVersion)\n },\n {\n message: \"Choose a ORM manager\",\n type: \"list\",\n name: \"featuresDB\",\n when: hasFeature(\"db\"),\n choices: featuresDbChoices(cliVersion)\n },\n {\n type: \"list\",\n name: \"featuresTypeORM\",\n message: \"Which TypeORM you want to install?\",\n choices: FEATURES_TYPEORM_CONNECTION_TYPES,\n when: hasValue(\"featuresDB.type\", \"typeorm\")\n },\n {\n type: \"password\",\n name: \"GH_TOKEN\",\n message:\n \"Enter GH_TOKEN to use the premium @tsedio/prisma package or leave blank (see https://tsed.io/tutorials/prisma-client.html)\",\n when: hasValue(\"featuresDB.type\", \"prisma\")\n },\n {\n message: \"Choose unit framework\",\n type: \"list\",\n name: \"featuresTesting\",\n when: hasFeature(\"testing\"),\n choices: featuresTestingChoices(cliVersion)\n },\n {\n message: \"Choose linter tools framework\",\n type: \"list\",\n name: \"featuresLinter\",\n when: hasFeature(\"linter\"),\n choices: featuresLinterChoices(cliVersion)\n },\n {\n message: \"Choose extra linter tools\",\n type: \"checkbox\",\n name: \"featuresExtraLinter\",\n when: hasFeature(\"linter\"),\n choices: featuresExtraLinterChoices\n },\n {\n message: \"Choose your bundler\",\n type: \"list\",\n name: \"featuresBundler\",\n when: hasFeature(\"bundler\"),\n choices: featuresBundlerChoices\n },\n {\n message: \"Choose the OIDC base path server\",\n name: \"oidcBasePath\",\n default: \"/oidc\",\n when: hasFeature(\"oidc\"),\n type: \"input\"\n },\n {\n message: \"Choose the OIDC base path server\",\n name: \"oidcBasePath\",\n default: \"/oidc\",\n when: hasFeature(\"oidc\"),\n type: \"input\"\n },\n {\n message: \"Choose the package manager:\",\n type: \"list\",\n name: \"packageManager\",\n choices: packageManagerChoices\n }\n ];\n }\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.2",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"typings": "./lib/index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"decorators"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tsed/cli-core": "3.
|
|
27
|
+
"@tsed/cli-core": "3.17.2",
|
|
28
28
|
"@tsed/core": ">=6.95.1",
|
|
29
29
|
"@tsed/di": ">=6.95.1",
|
|
30
30
|
"@tsed/logger": ">=6.0.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"tslib": "2.3.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@tsed/cli-testing": "3.
|
|
36
|
+
"@tsed/cli-testing": "3.17.2",
|
|
37
37
|
"@types/change-case": "^2.3.1"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|