@tsed/cli 3.20.12 → 3.20.13

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.
@@ -24,7 +24,7 @@ let AddCmd = class AddCmd {
24
24
  return [
25
25
  {
26
26
  title: "Install plugins",
27
- task: cli_core_1.createSubTasks(() => this.packageJson.install(ctx), { ...ctx, concurrent: false })
27
+ task: (0, cli_core_1.createSubTasks)(() => this.packageJson.install(ctx), { ...ctx, concurrent: false })
28
28
  },
29
29
  {
30
30
  title: "Load plugins",
@@ -32,21 +32,21 @@ let AddCmd = class AddCmd {
32
32
  },
33
33
  {
34
34
  title: "Install plugins dependencies",
35
- task: cli_core_1.createSubTasks(() => this.cliPlugins.addPluginsDependencies(ctx), { ...ctx, concurrent: false })
35
+ task: (0, cli_core_1.createSubTasks)(() => this.cliPlugins.addPluginsDependencies(ctx), { ...ctx, concurrent: false })
36
36
  }
37
37
  ];
38
38
  }
39
39
  };
40
40
  tslib_1.__decorate([
41
- di_1.Inject(cli_core_1.CliPlugins),
41
+ (0, di_1.Inject)(cli_core_1.CliPlugins),
42
42
  tslib_1.__metadata("design:type", cli_core_1.CliPlugins)
43
43
  ], AddCmd.prototype, "cliPlugins", void 0);
44
44
  tslib_1.__decorate([
45
- di_1.Inject(cli_core_1.ProjectPackageJson),
45
+ (0, di_1.Inject)(cli_core_1.ProjectPackageJson),
46
46
  tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
47
47
  ], AddCmd.prototype, "packageJson", void 0);
48
48
  AddCmd = tslib_1.__decorate([
49
- cli_core_1.Command({
49
+ (0, cli_core_1.Command)({
50
50
  name: "add",
51
51
  description: "Add cli plugin to the current project",
52
52
  args: {
@@ -1 +1 @@
1
- {"version":3,"file":"AddCmd.js","sourceRoot":"","sources":["../../../src/commands/add/AddCmd.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAChC,6CAA4I;AAgB5I,IAAa,MAAM,GAAnB,MAAa,MAAM;IAOjB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QACpD,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,WAAW,EAAE,oCAAoC;gBACjD,IAAI,EAAE,MAAM;aACb;SACF;KACF,CAAC;GACW,MAAM,CAwClB;AAxCY,wBAAM","sourcesContent":["import {Inject} from \"@tsed/di\";\nimport {CliDefaultOptions, CliPlugins, Command, CommandProvider, createSubTasks, ProjectPackageJson, QuestionOptions} from \"@tsed/cli-core\";\n\nexport interface AddCmdOptions extends CliDefaultOptions {\n name: string;\n}\n\n@Command({\n name: \"add\",\n description: \"Add cli plugin to the current project\",\n args: {\n name: {\n description: \"Npm package name of the cli plugin\",\n type: String\n }\n }\n})\nexport class AddCmd implements CommandProvider {\n @Inject(CliPlugins)\n cliPlugins: CliPlugins;\n\n @Inject(ProjectPackageJson)\n packageJson: ProjectPackageJson;\n\n $prompt(initialOptions: any): QuestionOptions {\n return [\n {\n type: \"autocomplete\",\n name: \"name\",\n message: \"Which cli plugin ?\",\n default: initialOptions.name,\n when: !initialOptions.name,\n source: async (state: any, keyword: string) => {\n return this.cliPlugins.searchPlugins(keyword);\n }\n }\n ];\n }\n\n async $exec(ctx: AddCmdOptions) {\n this.packageJson.addDevDependency(ctx.name);\n\n return [\n {\n title: \"Install plugins\",\n task: createSubTasks(() => this.packageJson.install(ctx as any), {...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 }\n}\n"]}
1
+ {"version":3,"file":"AddCmd.js","sourceRoot":"","sources":["../../../src/commands/add/AddCmd.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAChC,6CAA4I;AAgB5I,IAAa,MAAM,GAAnB,MAAa,MAAM;IAOjB,OAAO,CAAC,cAAmB;QACzB,OAAO;YACL;gBACE,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE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I,EAAE,MAAM;aACb;SACF;KACF,CAAC;GACW,MAAM,CAwClB;AAxCY,wBAAM","sourcesContent":["import {Inject} from \"@tsed/di\";\nimport {CliDefaultOptions, CliPlugins, Command, CommandProvider, createSubTasks, ProjectPackageJson, QuestionOptions} from \"@tsed/cli-core\";\n\nexport interface AddCmdOptions extends CliDefaultOptions {\n name: string;\n}\n\n@Command({\n name: \"add\",\n description: \"Add cli plugin to the current project\",\n args: {\n name: {\n description: \"Npm package name of the cli plugin\",\n type: String\n }\n }\n})\nexport class AddCmd implements CommandProvider {\n @Inject(CliPlugins)\n cliPlugins: CliPlugins;\n\n @Inject(ProjectPackageJson)\n packageJson: ProjectPackageJson;\n\n $prompt(initialOptions: any): QuestionOptions {\n return [\n {\n type: \"autocomplete\",\n name: \"name\",\n message: \"Which cli plugin ?\",\n default: initialOptions.name,\n when: !initialOptions.name,\n source: async (state: any, keyword: string) => {\n return this.cliPlugins.searchPlugins(keyword);\n }\n }\n ];\n }\n\n async $exec(ctx: AddCmdOptions) {\n this.packageJson.addDevDependency(ctx.name);\n\n return [\n {\n title: \"Install plugins\",\n task: createSubTasks(() => this.packageJson.install(ctx as any), {...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 }\n}\n"]}
@@ -43,7 +43,7 @@ let GenerateCmd = GenerateCmd_1 = class GenerateCmd {
43
43
  });
44
44
  }
45
45
  $prompt(initialOptions) {
46
- const getName = (state) => initialOptions.name || change_case_1.pascalCase(state.name || initialOptions.name || state.type || initialOptions.type);
46
+ const getName = (state) => initialOptions.name || (0, change_case_1.pascalCase)(state.name || initialOptions.name || state.type || initialOptions.type);
47
47
  const proposedProviders = this.providersList.findProviders(initialOptions.type);
48
48
  return [
49
49
  {
@@ -132,7 +132,7 @@ let GenerateCmd = GenerateCmd_1 = class GenerateCmd {
132
132
  type = "prisma.service";
133
133
  }
134
134
  const symbolName = this.classNamePipe.transform({ name, type, format: ProjectConvention_1.ProjectConvention.DEFAULT });
135
- const symbolParamName = change_case_1.paramCase(symbolName);
135
+ const symbolParamName = (0, change_case_1.paramCase)(symbolName);
136
136
  return {
137
137
  ...ctx,
138
138
  type,
@@ -147,7 +147,7 @@ let GenerateCmd = GenerateCmd_1 = class GenerateCmd {
147
147
  symbolPathBasename: normalizePath(this.classNamePipe.transform({ name, type })),
148
148
  express: ctx.platform === "express",
149
149
  koa: ctx.platform === "koa",
150
- platformSymbol: ctx.platform && change_case_1.pascalCase(`Platform ${ctx.platform}`),
150
+ platformSymbol: ctx.platform && (0, change_case_1.pascalCase)(`Platform ${ctx.platform}`),
151
151
  indexControllerPath: this.projectPackageJson.preferences.convention === ProjectConvention_1.ProjectConvention.ANGULAR
152
152
  ? "./controllers/pages/index.controller"
153
153
  : "./controllers/pages/IndexController"
@@ -174,7 +174,7 @@ let GenerateCmd = GenerateCmd_1 = class GenerateCmd {
174
174
  return this.srcRenderService.update("bin/index.ts", [
175
175
  {
176
176
  type: "import",
177
- content: `import {${ctx.symbolName}} from "./${path_1.basename(symbolPath)}";`
177
+ content: `import {${ctx.symbolName}} from "./${(0, path_1.basename)(symbolPath)}";`
178
178
  },
179
179
  {
180
180
  type: "insert-after",
@@ -190,38 +190,38 @@ let GenerateCmd = GenerateCmd_1 = class GenerateCmd {
190
190
  }
191
191
  getDirectories(dir) {
192
192
  const directories = globby_1.default.sync("**/*", {
193
- cwd: path_1.join(this.srcRenderService.rootDir, dir),
193
+ cwd: (0, path_1.join)(this.srcRenderService.rootDir, dir),
194
194
  ignore: ["__*"]
195
195
  });
196
196
  const set = new Set(directories.map((dir) => {
197
- return path_1.dirname(dir);
197
+ return (0, path_1.dirname)(dir);
198
198
  }));
199
199
  set.delete(".");
200
200
  return [...set];
201
201
  }
202
202
  };
203
203
  tslib_1.__decorate([
204
- cli_core_1.Inject(),
204
+ (0, cli_core_1.Inject)(),
205
205
  tslib_1.__metadata("design:type", ClassNamePipe_1.ClassNamePipe)
206
206
  ], GenerateCmd.prototype, "classNamePipe", void 0);
207
207
  tslib_1.__decorate([
208
- cli_core_1.Inject(),
208
+ (0, cli_core_1.Inject)(),
209
209
  tslib_1.__metadata("design:type", OutputFilePathPipe_1.OutputFilePathPipe)
210
210
  ], GenerateCmd.prototype, "outputFilePathPipe", void 0);
211
211
  tslib_1.__decorate([
212
- cli_core_1.Inject(),
212
+ (0, cli_core_1.Inject)(),
213
213
  tslib_1.__metadata("design:type", RoutePipe_1.RoutePipe)
214
214
  ], GenerateCmd.prototype, "routePipe", void 0);
215
215
  tslib_1.__decorate([
216
- cli_core_1.Inject(),
216
+ (0, cli_core_1.Inject)(),
217
217
  tslib_1.__metadata("design:type", cli_core_1.SrcRendererService)
218
218
  ], GenerateCmd.prototype, "srcRenderService", void 0);
219
219
  tslib_1.__decorate([
220
- cli_core_1.Inject(),
220
+ (0, cli_core_1.Inject)(),
221
221
  tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
222
222
  ], GenerateCmd.prototype, "projectPackageJson", void 0);
223
223
  GenerateCmd = GenerateCmd_1 = tslib_1.__decorate([
224
- cli_core_1.Command({
224
+ (0, cli_core_1.Command)({
225
225
  name: "generate",
226
226
  alias: "g",
227
227
  description: "Generate a new provider class",
@@ -1 +1 @@
1
- {"version":3,"file":"GenerateCmd.js","sourceRoot":"","sources":["../../../src/commands/generate/GenerateCmd.ts"],"names":[],"mappings":";;;;;AAAA,6CAA2H;AAC3H,6CAAkD;AAClD,+BAA6C;AAC7C,4DAA4B;AAC5B,6DAAwD;AACxD,uEAAkE;AAClE,qDAAgD;AAChD,8EAAyE;AACzE,mDAA+C;AAC/C,0EAAqE;AAErE,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAehD,MAAM,eAAe,GAAG;IACtB,EAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAA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C,WAAW,CA8MvB;AA9MY,kCAAW","sourcesContent":["import {CliDefaultOptions, Command, CommandProvider, Inject, ProjectPackageJson, SrcRendererService} from \"@tsed/cli-core\";\nimport {paramCase, pascalCase} from \"change-case\";\nimport {basename, dirname, join} from \"path\";\nimport globby from \"globby\";\nimport {ClassNamePipe} from \"../../pipes/ClassNamePipe\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {RoutePipe} from \"../../pipes/RoutePipe\";\nimport {ProvidersInfoService} from \"../../services/ProvidersInfoService\";\nimport {PROVIDER_TYPES} from \"./ProviderTypes\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\n\nconst normalizePath = require(\"normalize-path\");\n\nexport interface GenerateCmdContext extends CliDefaultOptions {\n type: string;\n name: string;\n route: string;\n directory: string;\n platform: string;\n templateType: string;\n symbolName: string;\n symbolPath: string;\n symbolPathBasename: string;\n convention: ProjectConvention;\n}\n\nconst DECORATOR_TYPES = [\n {name: \"Class decorator\", value: \"class\"},\n {name: \"Ts.ED middleware and its decorator\", value: \"middleware\"},\n {name: \"Ts.ED endpoint decorator\", value: \"endpoint\"},\n {name: \"Ts.ED property decorator\", value: \"prop\"},\n {name: \"Ts.ED parameter decorator\", value: \"param\"},\n {name: \"Vanilla Method decorator\", value: \"method\"},\n {name: \"Vanilla Property decorator\", value: \"property\"},\n {name: \"Vanilla Parameter decorator\", value: \"parameter\"},\n {name: \"Generic decorator\", value: \"generic\"}\n];\n\nconst searchFactory = (list: any) => {\n return async (state: any, keyword: string) => {\n if (keyword) {\n return list.filter((item: any) => item.name.toLowerCase().includes(keyword.toLowerCase()));\n }\n\n return list;\n };\n};\n\n@Command({\n name: \"generate\",\n alias: \"g\",\n description: \"Generate a new provider class\",\n args: {\n type: {\n description: \"Type of the provider (Injectable, Controller, Pipe, etc...)\",\n type: String\n },\n name: {\n description: \"Name of the class\",\n type: String\n }\n }\n})\nexport class GenerateCmd implements CommandProvider {\n @Inject()\n classNamePipe: ClassNamePipe;\n\n @Inject()\n outputFilePathPipe: OutputFilePathPipe;\n\n @Inject()\n routePipe: RoutePipe;\n\n @Inject()\n srcRenderService: SrcRendererService;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n constructor(private providersList: ProvidersInfoService) {\n PROVIDER_TYPES.forEach((info) => {\n this.providersList.add(\n {\n ...info\n },\n GenerateCmd\n );\n });\n }\n\n $prompt(initialOptions: Partial<GenerateCmdContext>) {\n const getName = (state: any) =>\n initialOptions.name || pascalCase(state.name || initialOptions.name || state.type || initialOptions.type);\n\n const proposedProviders = this.providersList.findProviders(initialOptions.type);\n\n return [\n {\n type: \"autocomplete\",\n name: \"type\",\n message: \"Which type of provider?\",\n default: initialOptions.type,\n when: () => proposedProviders.length > 1,\n source: searchFactory(proposedProviders)\n },\n {\n type: \"input\",\n name: \"name\",\n message: \"Which name?\",\n default: getName,\n when: !initialOptions.name\n },\n {\n message: \"Which platform?\",\n type: \"list\",\n name: \"platform\",\n when(state: any) {\n return [\"server\"].includes(state.type || initialOptions.type);\n },\n choices: [\n {\n name: \"Express.js\",\n checked: true,\n value: \"express\"\n },\n {\n name: \"Koa.js\",\n checked: false,\n value: \"koa\"\n }\n ]\n },\n {\n type: \"input\",\n name: \"route\",\n message: \"Which route?\",\n when(state: any) {\n return [\"controller\", \"server\"].includes(state.type || initialOptions.type);\n },\n default: (state: GenerateCmdContext) => {\n return state.type === \"server\" ? \"/rest\" : this.routePipe.transform(getName(state));\n }\n },\n {\n type: \"list\",\n name: \"directory\",\n message: \"Which directory?\",\n when(state: any) {\n return [\"controller\"].includes(state.type || initialOptions.type);\n },\n choices: this.getDirectories(\"controllers\")\n },\n {\n type: \"autocomplete\",\n name: \"templateType\",\n message: (state: any) => `Which type of ${state.type || initialOptions.type}?`,\n when(state: any) {\n return [\"decorator\"].includes(state.type || initialOptions.type);\n },\n source: searchFactory(DECORATOR_TYPES)\n },\n {\n type: \"list\",\n name: \"middlewarePosition\",\n message: () => `The middleware should be called:`,\n choices: [\n {name: \"Before the endpoint\", value: \"before\"},\n {name: \"After the endpoint\", value: \"after\"}\n ],\n when(state: any) {\n return [\"decorator\"].includes(state.type || initialOptions.type) && [\"middleware\"].includes(state.templateType);\n }\n }\n ];\n }\n\n $mapContext(ctx: Partial<GenerateCmdContext>): GenerateCmdContext {\n const {name = \"\"} = ctx;\n let {type = \"\"} = ctx;\n type = type.toLowerCase();\n\n if (ctx.name === \"prisma\" && ctx.name) {\n type = \"prisma.service\";\n }\n\n const symbolName = this.classNamePipe.transform({name, type, format: ProjectConvention.DEFAULT});\n const symbolParamName = paramCase(symbolName);\n\n return {\n ...ctx,\n type,\n route: ctx.route ? this.routePipe.transform(ctx.route) : \"\",\n symbolName,\n symbolParamName,\n symbolPath: normalizePath(\n this.outputFilePathPipe.transform({\n name,\n type,\n subDir: ctx.directory\n })\n ),\n symbolPathBasename: normalizePath(this.classNamePipe.transform({name, type})),\n express: ctx.platform === \"express\",\n koa: ctx.platform === \"koa\",\n platformSymbol: ctx.platform && pascalCase(`Platform ${ctx.platform}`),\n indexControllerPath:\n this.projectPackageJson.preferences.convention === ProjectConvention.ANGULAR\n ? \"./controllers/pages/index.controller\"\n : \"./controllers/pages/IndexController\"\n } as GenerateCmdContext;\n }\n\n async $exec(ctx: GenerateCmdContext) {\n const {symbolPath} = ctx;\n\n if (this.providersList.isMyProvider(ctx.type, GenerateCmd)) {\n const type = [ctx.type, ctx.templateType].filter(Boolean).join(\".\");\n\n const template = `generate/${type}.hbs`;\n\n return [\n {\n title: `Generate ${ctx.type} file to '${symbolPath}.ts'`,\n task: () =>\n this.srcRenderService.render(template, ctx, {\n output: `${symbolPath}.ts`\n })\n },\n {\n title: `Update bin/index`,\n skip() {\n return ctx.type !== \"command\";\n },\n task: () => {\n return this.srcRenderService.update(\"bin/index.ts\", [\n {\n type: \"import\",\n content: `import {${ctx.symbolName}} from \"./${basename(symbolPath)}\";`\n },\n {\n type: \"insert-after\",\n pattern: /commands: \\[/,\n content: ` ${ctx.symbolName}`\n }\n ]);\n }\n }\n ];\n }\n\n return [];\n }\n\n getDirectories(dir: string) {\n const directories = globby.sync(\"**/*\", {\n cwd: join(this.srcRenderService.rootDir, dir),\n ignore: [\"__*\"]\n });\n\n const set = new Set(\n directories.map((dir) => {\n return dirname(dir);\n })\n );\n\n set.delete(\".\");\n\n return [...set];\n }\n}\n"]}
1
+ {"version":3,"file":"GenerateCmd.js","sourceRoot":"","sources":["../../../src/commands/generate/GenerateCmd.ts"],"names":[],"mappings":";;;;;AAAA,6CAA2H;AAC3H,6CAAkD;AAClD,+BAA6C;AAC7C,4DAA4B;AAC5B,6DAAwD;AACxD,uEAAkE;AAClE,qDAAgD;AAChD,8EAAyE;AACzE,mDAA+C;AAC/C,0EAAqE;AAErE,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAehD,MAAM,eAAe,GAAG;IACtB,EAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAC;IACzC,EAAC,IAAI,EAAE,oCAAoC,EAAE,KAAK,EAAE,YAAY,EAAC;IACjE,EAAC,IAAI,EAAE,0BAA0B,EAAE,KAAK,EAAE,UAAU,EAAC;IACrD,EAAC,IAAI,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,EAAC;IACjD,EAAC,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,OAAO,EAAC;IACnD,EAAC,IAAI,EAAE,0BAA0B,EAAE,KAAK,EAAE,QAAQ,EAAC;IACnD,EAAC,IAAI,EAAE,4BAA4B,EAAE,KAAK,EAAE,UAAU,EAAC;IACvD,EAAC,IAAI,EAAE,6BAA6B,EAAE,KAAK,EAAE,WAAW,EAAC;IACzD,EAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,SAAS,EAAC;CAC9C,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,IAAS,EAAE,EAAE;IAClC,OAAO,KAAK,EAAE,KAAU,EAAE,OAAe,EAAE,EAAE;Q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M,CAAC,GAAG,CAAC,CAAC;QAEhB,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;IAClB,CAAC;CACF,CAAA;AA5MC;IADC,IAAA,iBAAM,GAAE;sCACM,6BAAa;kDAAC;AAG7B;IADC,IAAA,iBAAM,GAAE;sCACW,uCAAkB;uDAAC;AAGvC;IADC,IAAA,iBAAM,GAAE;sCACE,qBAAS;8CAAC;AAGrB;IADC,IAAA,iBAAM,GAAE;sCACS,6BAAkB;qDAAC;AAGrC;IADC,IAAA,iBAAM,GAAE;sCACW,6BAAkB;uDAAC;AAd5B,WAAW;IAfvB,IAAA,kBAAO,EAAC;QACP,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,WAAW,EAAE,6DAA6D;gBAC1E,IAAI,EAAE,MAAM;aACb;YACD,IAAI,EAAE;gBACJ,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,MAAM;aACb;SACF;KACF,CAAC;6CAiBmC,2CAAoB;GAhB5C,WAAW,CA8MvB;AA9MY,kCAAW","sourcesContent":["import {CliDefaultOptions, Command, CommandProvider, Inject, ProjectPackageJson, SrcRendererService} from \"@tsed/cli-core\";\nimport {paramCase, pascalCase} from \"change-case\";\nimport {basename, dirname, join} from \"path\";\nimport globby from \"globby\";\nimport {ClassNamePipe} from \"../../pipes/ClassNamePipe\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {RoutePipe} from \"../../pipes/RoutePipe\";\nimport {ProvidersInfoService} from \"../../services/ProvidersInfoService\";\nimport {PROVIDER_TYPES} from \"./ProviderTypes\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\n\nconst normalizePath = require(\"normalize-path\");\n\nexport interface GenerateCmdContext extends CliDefaultOptions {\n type: string;\n name: string;\n route: string;\n directory: string;\n platform: string;\n templateType: string;\n symbolName: string;\n symbolPath: string;\n symbolPathBasename: string;\n convention: ProjectConvention;\n}\n\nconst DECORATOR_TYPES = [\n {name: \"Class decorator\", value: \"class\"},\n {name: \"Ts.ED middleware and its decorator\", value: \"middleware\"},\n {name: \"Ts.ED endpoint decorator\", value: \"endpoint\"},\n {name: \"Ts.ED property decorator\", value: \"prop\"},\n {name: \"Ts.ED parameter decorator\", value: \"param\"},\n {name: \"Vanilla Method decorator\", value: \"method\"},\n {name: \"Vanilla Property decorator\", value: \"property\"},\n {name: \"Vanilla Parameter decorator\", value: \"parameter\"},\n {name: \"Generic decorator\", value: \"generic\"}\n];\n\nconst searchFactory = (list: any) => {\n return async (state: any, keyword: string) => {\n if (keyword) {\n return list.filter((item: any) => item.name.toLowerCase().includes(keyword.toLowerCase()));\n }\n\n return list;\n };\n};\n\n@Command({\n name: \"generate\",\n alias: \"g\",\n description: \"Generate a new provider class\",\n args: {\n type: {\n description: \"Type of the provider (Injectable, Controller, Pipe, etc...)\",\n type: String\n },\n name: {\n description: \"Name of the class\",\n type: String\n }\n }\n})\nexport class GenerateCmd implements CommandProvider {\n @Inject()\n classNamePipe: ClassNamePipe;\n\n @Inject()\n outputFilePathPipe: OutputFilePathPipe;\n\n @Inject()\n routePipe: RoutePipe;\n\n @Inject()\n srcRenderService: SrcRendererService;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n constructor(private providersList: ProvidersInfoService) {\n PROVIDER_TYPES.forEach((info) => {\n this.providersList.add(\n {\n ...info\n },\n GenerateCmd\n );\n });\n }\n\n $prompt(initialOptions: Partial<GenerateCmdContext>) {\n const getName = (state: any) =>\n initialOptions.name || pascalCase(state.name || initialOptions.name || state.type || initialOptions.type);\n\n const proposedProviders = this.providersList.findProviders(initialOptions.type);\n\n return [\n {\n type: \"autocomplete\",\n name: \"type\",\n message: \"Which type of provider?\",\n default: initialOptions.type,\n when: () => proposedProviders.length > 1,\n source: searchFactory(proposedProviders)\n },\n {\n type: \"input\",\n name: \"name\",\n message: \"Which name?\",\n default: getName,\n when: !initialOptions.name\n },\n {\n message: \"Which platform?\",\n type: \"list\",\n name: \"platform\",\n when(state: any) {\n return [\"server\"].includes(state.type || initialOptions.type);\n },\n choices: [\n {\n name: \"Express.js\",\n checked: true,\n value: \"express\"\n },\n {\n name: \"Koa.js\",\n checked: false,\n value: \"koa\"\n }\n ]\n },\n {\n type: \"input\",\n name: \"route\",\n message: \"Which route?\",\n when(state: any) {\n return [\"controller\", \"server\"].includes(state.type || initialOptions.type);\n },\n default: (state: GenerateCmdContext) => {\n return state.type === \"server\" ? \"/rest\" : this.routePipe.transform(getName(state));\n }\n },\n {\n type: \"list\",\n name: \"directory\",\n message: \"Which directory?\",\n when(state: any) {\n return [\"controller\"].includes(state.type || initialOptions.type);\n },\n choices: this.getDirectories(\"controllers\")\n },\n {\n type: \"autocomplete\",\n name: \"templateType\",\n message: (state: any) => `Which type of ${state.type || initialOptions.type}?`,\n when(state: any) {\n return [\"decorator\"].includes(state.type || initialOptions.type);\n },\n source: searchFactory(DECORATOR_TYPES)\n },\n {\n type: \"list\",\n name: \"middlewarePosition\",\n message: () => `The middleware should be called:`,\n choices: [\n {name: \"Before the endpoint\", value: \"before\"},\n {name: \"After the endpoint\", value: \"after\"}\n ],\n when(state: any) {\n return [\"decorator\"].includes(state.type || initialOptions.type) && [\"middleware\"].includes(state.templateType);\n }\n }\n ];\n }\n\n $mapContext(ctx: Partial<GenerateCmdContext>): GenerateCmdContext {\n const {name = \"\"} = ctx;\n let {type = \"\"} = ctx;\n type = type.toLowerCase();\n\n if (ctx.name === \"prisma\" && ctx.name) {\n type = \"prisma.service\";\n }\n\n const symbolName = this.classNamePipe.transform({name, type, format: ProjectConvention.DEFAULT});\n const symbolParamName = paramCase(symbolName);\n\n return {\n ...ctx,\n type,\n route: ctx.route ? this.routePipe.transform(ctx.route) : \"\",\n symbolName,\n symbolParamName,\n symbolPath: normalizePath(\n this.outputFilePathPipe.transform({\n name,\n type,\n subDir: ctx.directory\n })\n ),\n symbolPathBasename: normalizePath(this.classNamePipe.transform({name, type})),\n express: ctx.platform === \"express\",\n koa: ctx.platform === \"koa\",\n platformSymbol: ctx.platform && pascalCase(`Platform ${ctx.platform}`),\n indexControllerPath:\n this.projectPackageJson.preferences.convention === ProjectConvention.ANGULAR\n ? \"./controllers/pages/index.controller\"\n : \"./controllers/pages/IndexController\"\n } as GenerateCmdContext;\n }\n\n async $exec(ctx: GenerateCmdContext) {\n const {symbolPath} = ctx;\n\n if (this.providersList.isMyProvider(ctx.type, GenerateCmd)) {\n const type = [ctx.type, ctx.templateType].filter(Boolean).join(\".\");\n\n const template = `generate/${type}.hbs`;\n\n return [\n {\n title: `Generate ${ctx.type} file to '${symbolPath}.ts'`,\n task: () =>\n this.srcRenderService.render(template, ctx, {\n output: `${symbolPath}.ts`\n })\n },\n {\n title: `Update bin/index`,\n skip() {\n return ctx.type !== \"command\";\n },\n task: () => {\n return this.srcRenderService.update(\"bin/index.ts\", [\n {\n type: \"import\",\n content: `import {${ctx.symbolName}} from \"./${basename(symbolPath)}\";`\n },\n {\n type: \"insert-after\",\n pattern: /commands: \\[/,\n content: ` ${ctx.symbolName}`\n }\n ]);\n }\n }\n ];\n }\n\n return [];\n }\n\n getDirectories(dir: string) {\n const directories = globby.sync(\"**/*\", {\n cwd: join(this.srcRenderService.rootDir, dir),\n ignore: [\"__*\"]\n });\n\n const set = new Set(\n directories.map((dir) => {\n return dirname(dir);\n })\n );\n\n set.delete(\".\");\n\n return [...set];\n }\n}\n"]}
@@ -12,9 +12,9 @@ let InitCmd = class InitCmd {
12
12
  async $beforePrompt(initialOptions) {
13
13
  const callPath = process.cwd();
14
14
  if (callPath && initialOptions.featuresFile) {
15
- const featuresFilePath = path_1.resolve(callPath, initialOptions.featuresFile);
15
+ const featuresFilePath = (0, path_1.resolve)(callPath, initialOptions.featuresFile);
16
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
17
+ const mappedFeatures = (0, Features_1.parseFeaturesFile)(featuresFromFile, "3.8.0"); // Inject CLI version
18
18
  initialOptions = { ...initialOptions, ...mappedFeatures };
19
19
  }
20
20
  return initialOptions;
@@ -27,10 +27,10 @@ let InitCmd = class InitCmd {
27
27
  type: "input",
28
28
  name: "projectName",
29
29
  message: "What is your project name",
30
- default: change_case_1.paramCase(initialOptions.root),
30
+ default: (0, change_case_1.paramCase)(initialOptions.root),
31
31
  when: initialOptions.root !== ".",
32
32
  transformer(input) {
33
- return change_case_1.paramCase(input);
33
+ return (0, change_case_1.paramCase)(input);
34
34
  }
35
35
  },
36
36
  ...featuresQuestions
@@ -48,7 +48,7 @@ let InitCmd = class InitCmd {
48
48
  });
49
49
  features.forEach((feature) => {
50
50
  feature.type.split(":").forEach((type) => {
51
- ctx[change_case_1.camelCase(type)] = true;
51
+ ctx[(0, change_case_1.camelCase)(type)] = true;
52
52
  });
53
53
  });
54
54
  return {
@@ -60,7 +60,7 @@ let InitCmd = class InitCmd {
60
60
  yarn: ctx.packageManager === cli_core_1.PackageManager.YARN,
61
61
  express: ctx.platform === "express",
62
62
  koa: ctx.platform === "koa",
63
- platformSymbol: ctx.platform && change_case_1.pascalCase(`Platform ${ctx.platform}`)
63
+ platformSymbol: ctx.platform && (0, change_case_1.pascalCase)(`Platform ${ctx.platform}`)
64
64
  };
65
65
  }
66
66
  async $beforeExec(ctx) {
@@ -74,7 +74,7 @@ let InitCmd = class InitCmd {
74
74
  this.addDevDependencies(ctx);
75
75
  this.addScripts(ctx);
76
76
  this.addFeatures(ctx);
77
- await cli_core_1.createTasksRunner([
77
+ await (0, cli_core_1.createTasksRunner)([
78
78
  {
79
79
  title: "Write RC files",
80
80
  skip: () => !ctx.GH_TOKEN,
@@ -84,7 +84,7 @@ let InitCmd = class InitCmd {
84
84
  },
85
85
  {
86
86
  title: "Install plugins",
87
- task: cli_core_1.createSubTasks(() => this.packageJson.install(ctx), { ...ctx, concurrent: false })
87
+ task: (0, cli_core_1.createSubTasks)(() => this.packageJson.install(ctx), { ...ctx, concurrent: false })
88
88
  },
89
89
  {
90
90
  title: "Load plugins",
@@ -92,7 +92,7 @@ let InitCmd = class InitCmd {
92
92
  },
93
93
  {
94
94
  title: "Install plugins dependencies",
95
- task: cli_core_1.createSubTasks(this.cliPlugins.addPluginsDependencies(ctx), { ...ctx, concurrent: false })
95
+ task: (0, cli_core_1.createSubTasks)(this.cliPlugins.addPluginsDependencies(ctx), { ...ctx, concurrent: false })
96
96
  }
97
97
  ], ctx);
98
98
  }
@@ -118,7 +118,7 @@ let InitCmd = class InitCmd {
118
118
  })
119
119
  : [])
120
120
  ];
121
- const indexCtrlBaseName = path_1.basename(`${this.outputFilePathPipe.transform({
121
+ const indexCtrlBaseName = (0, path_1.basename)(`${this.outputFilePathPipe.transform({
122
122
  name: "Index",
123
123
  type: "controller",
124
124
  format: ctx.convention
@@ -126,7 +126,7 @@ let InitCmd = class InitCmd {
126
126
  return [
127
127
  {
128
128
  title: "Generate project files",
129
- task: cli_core_1.createSubTasks([
129
+ task: (0, cli_core_1.createSubTasks)([
130
130
  {
131
131
  title: "Root files",
132
132
  task: () => this.rootRenderer.renderAll([
@@ -171,7 +171,7 @@ let InitCmd = class InitCmd {
171
171
  return [];
172
172
  }
173
173
  resolveRootDir(ctx) {
174
- const rootDirName = change_case_1.paramCase(ctx.projectName || path_1.basename(this.packageJson.dir));
174
+ const rootDirName = (0, change_case_1.paramCase)(ctx.projectName || (0, path_1.basename)(this.packageJson.dir));
175
175
  if (this.packageJson.dir.endsWith(rootDirName)) {
176
176
  ctx.projectName = ctx.projectName || rootDirName;
177
177
  ctx.root = ".";
@@ -179,27 +179,27 @@ let InitCmd = class InitCmd {
179
179
  }
180
180
  ctx.projectName = ctx.projectName || rootDirName;
181
181
  if (ctx.root && ctx.root !== ".") {
182
- this.packageJson.dir = path_1.join(this.packageJson.dir, rootDirName);
182
+ this.packageJson.dir = (0, path_1.join)(this.packageJson.dir, rootDirName);
183
183
  ctx.root = ".";
184
184
  }
185
185
  }
186
186
  addScripts(ctx) {
187
187
  const runner = this.packageJson.getRunCmd();
188
188
  this.packageJson.addScripts({
189
- build: `${runner} barrels && ${runner} tsc --project tsconfig.compile.json`,
189
+ build: `${runner} barrels && tsc --project tsconfig.compile.json`,
190
190
  barrels: "barrelsby --config .barrelsby.json",
191
191
  start: `${runner} barrels && tsnd --inspect --ignore-watch node_modules --respawn --transpile-only -r tsconfig-paths/register src/index.ts`,
192
192
  "start:prod": "cross-env NODE_ENV=production node dist/index.js"
193
193
  });
194
194
  if (ctx.babel) {
195
195
  this.packageJson.addScripts({
196
- build: `${runner} tsc && babel src --out-dir dist --extensions ".ts,.tsx" --source-maps inline`,
196
+ build: `tsc && babel src --out-dir dist --extensions ".ts,.tsx" --source-maps inline`,
197
197
  start: "babel-watch --extensions .ts src/index.ts"
198
198
  });
199
199
  }
200
200
  if (ctx.webpack) {
201
201
  this.packageJson.addScripts({
202
- bundle: `${runner} tsc && cross-env NODE_ENV=production webpack`,
202
+ bundle: `tsc && cross-env NODE_ENV=production webpack`,
203
203
  "start:bundle": "cross-env NODE_ENV=production node dist/app.bundle.js"
204
204
  });
205
205
  }
@@ -311,43 +311,43 @@ let InitCmd = class InitCmd {
311
311
  }
312
312
  };
313
313
  tslib_1.__decorate([
314
- cli_core_1.Configuration(),
314
+ (0, cli_core_1.Configuration)(),
315
315
  tslib_1.__metadata("design:type", Object)
316
316
  ], InitCmd.prototype, "configuration", void 0);
317
317
  tslib_1.__decorate([
318
- cli_core_1.Inject(),
318
+ (0, cli_core_1.Inject)(),
319
319
  tslib_1.__metadata("design:type", cli_core_1.CliPlugins)
320
320
  ], InitCmd.prototype, "cliPlugins", void 0);
321
321
  tslib_1.__decorate([
322
- cli_core_1.Inject(),
322
+ (0, cli_core_1.Inject)(),
323
323
  tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
324
324
  ], InitCmd.prototype, "packageJson", void 0);
325
325
  tslib_1.__decorate([
326
- Features_1.Features(),
326
+ (0, Features_1.Features)(),
327
327
  tslib_1.__metadata("design:type", Array)
328
328
  ], InitCmd.prototype, "features", void 0);
329
329
  tslib_1.__decorate([
330
- cli_core_1.Inject(),
330
+ (0, cli_core_1.Inject)(),
331
331
  tslib_1.__metadata("design:type", cli_core_1.CliService)
332
332
  ], InitCmd.prototype, "cliService", void 0);
333
333
  tslib_1.__decorate([
334
- cli_core_1.Inject(),
334
+ (0, cli_core_1.Inject)(),
335
335
  tslib_1.__metadata("design:type", cli_core_1.RootRendererService)
336
336
  ], InitCmd.prototype, "rootRenderer", void 0);
337
337
  tslib_1.__decorate([
338
- cli_core_1.Inject(),
338
+ (0, cli_core_1.Inject)(),
339
339
  tslib_1.__metadata("design:type", OutputFilePathPipe_1.OutputFilePathPipe)
340
340
  ], InitCmd.prototype, "outputFilePathPipe", void 0);
341
341
  tslib_1.__decorate([
342
- cli_core_1.Inject(),
342
+ (0, cli_core_1.Inject)(),
343
343
  tslib_1.__metadata("design:type", cli_core_1.CliExeca)
344
344
  ], InitCmd.prototype, "execa", void 0);
345
345
  tslib_1.__decorate([
346
- cli_core_1.Inject(),
346
+ (0, cli_core_1.Inject)(),
347
347
  tslib_1.__metadata("design:type", cli_core_1.CliFs)
348
348
  ], InitCmd.prototype, "fs", void 0);
349
349
  InitCmd = tslib_1.__decorate([
350
- cli_core_1.Command({
350
+ (0, cli_core_1.Command)({
351
351
  name: "init",
352
352
  description: "Init a new Ts.ED project",
353
353
  args: {
@@ -1 +1 @@
1
- {"version":3,"file":"InitCmd.js","sourceRoot":"","sources":["../../../src/commands/init/InitCmd.ts"],"names":[],"mappings":";;;;AAAA,6CAiBwB;AACxB,6CAA6D;AAC7D,+BAA6C;AAC7C,+CAAkD;AAGlD,uEAAkE;AAClE,sDAAkF;AA0ClF,IAAa,OAAO,GAApB,MAAa,OAAO;IA4BlB,KAAK,CAAC,aAAa,CAAC,cAAuC;QACzD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG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B,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,CAyYnB;AAzYY,0BAAO","sourcesContent":["import {\n CliDefaultOptions,\n CliExeca,\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 execa: CliExeca;\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: ctx.platform && 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 directory: \"rest\"\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 \"/init/.barrelsby.json.hbs\",\n \"/init/processes.config.js.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/envs/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/IndexController.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 async $postInstall() {\n try {\n await this.packageJson.runScript(\"barrels\");\n } catch (er) {\n const runner = this.packageJson.getRunCmd();\n console.warn(`Fail to run tasks: '${runner} barrels'. Please run '${runner} start'`);\n }\n return [];\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} barrels && ${runner} tsc --project tsconfig.compile.json`,\n barrels: \"barrelsby --config .barrelsby.json\",\n start: `${runner} barrels && 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/platform-cache\": ctx.tsedVersion,\n \"@tsed/platform-exceptions\": ctx.tsedVersion,\n \"@tsed/platform-log-middleware\": ctx.tsedVersion,\n \"@tsed/platform-middlewares\": ctx.tsedVersion,\n \"@tsed/platform-params\": ctx.tsedVersion,\n \"@tsed/platform-response-filter\": ctx.tsedVersion,\n \"@tsed/platform-views\": ctx.tsedVersion,\n \"@tsed/logger\": \"latest\",\n \"@tsed/logger-file\": \"latest\",\n \"@tsed/engines\": \"latest\",\n ajv: \"latest\",\n barrelsby: \"latest\",\n \"cross-env\": \"latest\",\n dotenv: \"latest\",\n \"dotenv-expand\": \"latest\",\n \"dotenv-flow\": \"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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e,8BAAmB;6CAAC;AAG5C;IADC,IAAA,iBAAM,GAAE;sCACqB,uCAAkB;mDAAC;AAGjD;IADC,IAAA,iBAAM,GAAE;sCACQ,mBAAQ;sCAAC;AAG1B;IADC,IAAA,iBAAM,GAAE;sCACK,gBAAK;mCAAC;AA1BT,OAAO;IAtBnB,IAAA,kBAAO,EAAC;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,CAyYnB;AAzYY,0BAAO","sourcesContent":["import {\n CliDefaultOptions,\n CliExeca,\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 execa: CliExeca;\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: ctx.platform && 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 directory: \"rest\"\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 \"/init/.barrelsby.json.hbs\",\n \"/init/processes.config.js.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/envs/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/IndexController.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 async $postInstall() {\n try {\n await this.packageJson.runScript(\"barrels\");\n } catch (er) {\n const runner = this.packageJson.getRunCmd();\n console.warn(`Fail to run tasks: '${runner} barrels'. Please run '${runner} start'`);\n }\n return [];\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} barrels && tsc --project tsconfig.compile.json`,\n barrels: \"barrelsby --config .barrelsby.json\",\n start: `${runner} barrels && 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: `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: `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/platform-cache\": ctx.tsedVersion,\n \"@tsed/platform-exceptions\": ctx.tsedVersion,\n \"@tsed/platform-log-middleware\": ctx.tsedVersion,\n \"@tsed/platform-middlewares\": ctx.tsedVersion,\n \"@tsed/platform-params\": ctx.tsedVersion,\n \"@tsed/platform-response-filter\": ctx.tsedVersion,\n \"@tsed/platform-views\": ctx.tsedVersion,\n \"@tsed/logger\": \"latest\",\n \"@tsed/logger-file\": \"latest\",\n \"@tsed/engines\": \"latest\",\n ajv: \"latest\",\n barrelsby: \"latest\",\n \"cross-env\": \"latest\",\n dotenv: \"latest\",\n \"dotenv-expand\": \"latest\",\n \"dotenv-flow\": \"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"]}
@@ -9,7 +9,7 @@ let RunCmd = class RunCmd {
9
9
  async $exec(ctx) {
10
10
  const cmd = ctx.production ? "node" : "ts-node";
11
11
  const args = ctx.production ? [] : ["-r", "tsconfig-paths/register"];
12
- const path = cli_core_1.normalizePath(ctx.production ? path_1.join(await this.getCompilePath(), "bin/index.js") : "src/bin/index.ts");
12
+ const path = (0, cli_core_1.normalizePath)(ctx.production ? (0, path_1.join)(await this.getCompilePath(), "bin/index.js") : "src/bin/index.ts");
13
13
  const env = {
14
14
  ...process.env
15
15
  };
@@ -23,7 +23,7 @@ let RunCmd = class RunCmd {
23
23
  }
24
24
  async getCompilePath() {
25
25
  const { dir } = this.projectPackageJson;
26
- const tsConfigPath = path_1.join(dir, "tsconfig.compile.json");
26
+ const tsConfigPath = (0, path_1.join)(dir, "tsconfig.compile.json");
27
27
  if (this.fs.exists(tsConfigPath)) {
28
28
  const content = JSON.parse(await this.fs.readFile(tsConfigPath, "utf8"));
29
29
  return content.compilerOptions.outDir;
@@ -32,19 +32,19 @@ let RunCmd = class RunCmd {
32
32
  }
33
33
  };
34
34
  tslib_1.__decorate([
35
- di_1.Inject(),
35
+ (0, di_1.Inject)(),
36
36
  tslib_1.__metadata("design:type", cli_core_1.CliFs)
37
37
  ], RunCmd.prototype, "fs", void 0);
38
38
  tslib_1.__decorate([
39
- di_1.Inject(),
39
+ (0, di_1.Inject)(),
40
40
  tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
41
41
  ], RunCmd.prototype, "projectPackageJson", void 0);
42
42
  tslib_1.__decorate([
43
- di_1.Inject(),
43
+ (0, di_1.Inject)(),
44
44
  tslib_1.__metadata("design:type", cli_core_1.CliRunScript)
45
45
  ], RunCmd.prototype, "runScript", void 0);
46
46
  RunCmd = tslib_1.__decorate([
47
- cli_core_1.Command({
47
+ (0, cli_core_1.Command)({
48
48
  name: "run",
49
49
  description: "Run a project level command",
50
50
  args: {
@@ -1 +1 @@
1
- {"version":3,"file":"RunCmd.js","sourceRoot":"","sources":["../../../src/commands/run/RunCmd.ts"],"names":[],"mappings":";;;;AAAA,6CAAuH;AACvH,iCAAgC;AAChC,+BAA0B;AA2B1B,IAAa,MAAM,GAAnB,MAAa,MAAM;IAUjB,KAAK,CAAC,KAAK,CAAC,GAAkB;QAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QAChD,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,wBAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAI,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;QACpH,MAAM,GAAG,GAAQ;YACf,GAAG,OAAO,CAAC,GAAG;SACf,CAAC;QAEF,IAAI,GAAG,CAAC,UAAU,EAAE;YAClB,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC;SAC7B;QAED,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE;YAC1E,GAAG;SACJ,CAAC,CAAC;QAEH,OAAO,EAAE,CAAC;IACZ,CAAC;IAES,KAAK,CAAC,cAAc;QAC5B,MAAM,EAAC,GAAG,EAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACtC,MAAM,YAAY,GAAG,WAAI,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC;QAExD,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;YAChC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;YACzE,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;SACvC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAtCC;IADC,WAAM,EAAE;sCACL,gBAAK;kCAAC;AAGV;IADC,WAAM,EAAE;sCACW,6BAAkB;kDAAC;AAGvC;IADC,WAAM,EAAE;sCACE,uBAAY;yCAAC;AARb,MAAM;IAnBlB,kBAAO,CAAC;QACP,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACf;SACF;QACD,OAAO,EAAE;YACP,kBAAkB,EAAE;gBAClB,IAAI,EAAE,OAAO;gBACb,YAAY,EAAE,KAAK;gBACnB,WAAW,EAAE,oCAAoC;aAClD;SACF;QACD,kBAAkB,EAAE,IAAI;KACzB,CAAC;GACW,MAAM,CAwClB;AAxCY,wBAAM","sourcesContent":["import {CliFs, CliRunScript, Command, CommandProvider, ProjectPackageJson, Tasks, normalizePath} from \"@tsed/cli-core\";\nimport {Inject} from \"@tsed/di\";\nimport {join} from \"path\";\n\nexport interface RunCmdContext {\n production: boolean;\n command: string;\n rawArgs: string[];\n}\n\n@Command({\n name: \"run\",\n description: \"Run a project level command\",\n args: {\n command: {\n description: \"The project command\",\n type: String,\n required: true\n }\n },\n options: {\n \"-p, --production\": {\n type: Boolean,\n defaultValue: false,\n description: \"Set production profile to NODE_ENV\"\n }\n },\n allowUnknownOption: true\n})\nexport class RunCmd implements CommandProvider {\n @Inject()\n fs: CliFs;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n @Inject()\n runScript: CliRunScript;\n\n async $exec(ctx: RunCmdContext): Promise<Tasks> {\n const cmd = ctx.production ? \"node\" : \"ts-node\";\n const args = ctx.production ? [] : [\"-r\", \"tsconfig-paths/register\"];\n const path = normalizePath(ctx.production ? join(await this.getCompilePath(), \"bin/index.js\") : \"src/bin/index.ts\");\n const env: any = {\n ...process.env\n };\n\n if (ctx.production) {\n env.NODE_ENV = \"production\";\n }\n\n await this.runScript.run(cmd, [...args, path, ctx.command, ...ctx.rawArgs], {\n env\n });\n\n return [];\n }\n\n protected async getCompilePath() {\n const {dir} = this.projectPackageJson;\n const tsConfigPath = join(dir, \"tsconfig.compile.json\");\n\n if (this.fs.exists(tsConfigPath)) {\n const content = JSON.parse(await this.fs.readFile(tsConfigPath, \"utf8\"));\n return content.compilerOptions.outDir;\n }\n\n return \"./dist\";\n }\n}\n"]}
1
+ {"version":3,"file":"RunCmd.js","sourceRoot":"","sources":["../../../src/commands/run/RunCmd.ts"],"names":[],"mappings":";;;;AAAA,6CAAuH;AACvH,iCAAgC;AAChC,+BAA0B;AA2B1B,IAAa,MAAM,GAAnB,MAAa,MAAM;IAUjB,KAAK,CAAC,KAAK,CAAC,GAAkB;QAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QAChD,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,C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A,kBAAO,EAAC;QACP,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACf;SACF;QACD,OAAO,EAAE;YACP,kBAAkB,EAAE;gBAClB,IAAI,EAAE,OAAO;gBACb,YAAY,EAAE,KAAK;gBACnB,WAAW,EAAE,oCAAoC;aAClD;SACF;QACD,kBAAkB,EAAE,IAAI;KACzB,CAAC;GACW,MAAM,CAwClB;AAxCY,wBAAM","sourcesContent":["import {CliFs, CliRunScript, Command, CommandProvider, ProjectPackageJson, Tasks, normalizePath} from \"@tsed/cli-core\";\nimport {Inject} from \"@tsed/di\";\nimport {join} from \"path\";\n\nexport interface RunCmdContext {\n production: boolean;\n command: string;\n rawArgs: string[];\n}\n\n@Command({\n name: \"run\",\n description: \"Run a project level command\",\n args: {\n command: {\n description: \"The project command\",\n type: String,\n required: true\n }\n },\n options: {\n \"-p, --production\": {\n type: Boolean,\n defaultValue: false,\n description: \"Set production profile to NODE_ENV\"\n }\n },\n allowUnknownOption: true\n})\nexport class RunCmd implements CommandProvider {\n @Inject()\n fs: CliFs;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n @Inject()\n runScript: CliRunScript;\n\n async $exec(ctx: RunCmdContext): Promise<Tasks> {\n const cmd = ctx.production ? \"node\" : \"ts-node\";\n const args = ctx.production ? [] : [\"-r\", \"tsconfig-paths/register\"];\n const path = normalizePath(ctx.production ? join(await this.getCompilePath(), \"bin/index.js\") : \"src/bin/index.ts\");\n const env: any = {\n ...process.env\n };\n\n if (ctx.production) {\n env.NODE_ENV = \"production\";\n }\n\n await this.runScript.run(cmd, [...args, path, ctx.command, ...ctx.rawArgs], {\n env\n });\n\n return [];\n }\n\n protected async getCompilePath() {\n const {dir} = this.projectPackageJson;\n const tsConfigPath = join(dir, \"tsconfig.compile.json\");\n\n if (this.fs.exists(tsConfigPath)) {\n const content = JSON.parse(await this.fs.readFile(tsConfigPath, \"utf8\"));\n return content.compilerOptions.outDir;\n }\n\n return \"./dist\";\n }\n}\n"]}
@@ -44,7 +44,7 @@ let UpdateCmd = class UpdateCmd {
44
44
  });
45
45
  const projectLoggerVersion = this.projectPackage.dependencies["@tsed/logger"];
46
46
  if (projectLoggerVersion) {
47
- const loggerVersion = core_1.getValue("dependencies.@tsed/logger", this.versions[ctx.version], "");
47
+ const loggerVersion = (0, core_1.getValue)("dependencies.@tsed/logger", this.versions[ctx.version], "");
48
48
  if (loggerVersion && isGreaterThan(loggerVersion, projectLoggerVersion)) {
49
49
  this.projectPackage.addDependency("@tsed/logger", loggerVersion);
50
50
  }
@@ -60,7 +60,7 @@ let UpdateCmd = class UpdateCmd {
60
60
  return [
61
61
  {
62
62
  title: "Update packages",
63
- task: cli_core_1.createSubTasks(() => this.projectPackage.install(), { ...ctx, concurrent: false })
63
+ task: (0, cli_core_1.createSubTasks)(() => this.projectPackage.install(), { ...ctx, concurrent: false })
64
64
  }
65
65
  ];
66
66
  }
@@ -96,19 +96,19 @@ let UpdateCmd = class UpdateCmd {
96
96
  }
97
97
  };
98
98
  tslib_1.__decorate([
99
- cli_core_1.Inject(),
99
+ (0, cli_core_1.Inject)(),
100
100
  tslib_1.__metadata("design:type", cli_core_1.NpmRegistryClient)
101
101
  ], UpdateCmd.prototype, "npmRegistryClient", void 0);
102
102
  tslib_1.__decorate([
103
- cli_core_1.Inject(),
103
+ (0, cli_core_1.Inject)(),
104
104
  tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
105
105
  ], UpdateCmd.prototype, "projectPackage", void 0);
106
106
  tslib_1.__decorate([
107
- cli_core_1.CliPackageJson(),
107
+ (0, cli_core_1.CliPackageJson)(),
108
108
  tslib_1.__metadata("design:type", Object)
109
109
  ], UpdateCmd.prototype, "cliPackage", void 0);
110
110
  UpdateCmd = tslib_1.__decorate([
111
- cli_core_1.Command({
111
+ (0, cli_core_1.Command)({
112
112
  name: "update",
113
113
  description: "Update all Ts.ED packages used by your project",
114
114
  args: {},
@@ -1 +1 @@
1
- {"version":3,"file":"UpdateCmd.js","sourceRoot":"","sources":["../../../src/commands/update/UpdateCmd.ts"],"names":[],"mappings":";;;;AAAA,6CAUwB;AACxB,qCAAoC;AACpC,4DAA4B;AAC5B,+CAAmF;AAQnF,SAAS,YAAY,CAAC,OAAO,GAAG,EAAE;IAChC,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,CAAM,EAAE,CAAS;IACtC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IACpB,OAAO,gBAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AAC9F,CAAC;AAQD,IAAa,SAAS,GAAtB,MAAa,SAAS;IAYpB,KAAK,CAAC,OAAO,CAAC,cAAyC;QACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAEnD,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,wBAAwB;gBACjC,OAAO,EAAE,cAAc,CAAC,OAAO;gBAC/B,IAAI,EAAE,CAAC,cAAc,CAAC,OAAO;gBAC7B,OAAO,EAAE,QAAQ;aAClB;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAqB;QAC/B,MAAM,CAAC,IAAI,CAAC,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AAQ;QACd,WAAW,EAAE,gDAAgD;QAC7D,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,SAAS,CA2GrB;AA3GY,8BAAS","sourcesContent":["import {\n CliDefaultOptions,\n CliPackageJson,\n Command,\n CommandProvider,\n createSubTasks,\n Inject,\n NpmRegistryClient,\n ProjectPackageJson,\n QuestionOptions\n} from \"@tsed/cli-core\";\nimport {getValue} from \"@tsed/core\";\nimport semver from \"semver\";\nimport {IGNORE_TAGS, IGNORE_VERSIONS, MINIMAL_TSED_VERSION} from \"../../constants\";\n\nexport interface UpdateCmdContext extends CliDefaultOptions {\n version: string;\n\n [key: string]: any;\n}\n\nfunction cleanVersion(version = \"\") {\n return version.replace(/[\\^~>=]/gi, \"\");\n}\n\nfunction isGreaterThan(a: any, b: string) {\n a = cleanVersion(a);\n b = cleanVersion(b);\n return semver.gt(a, b) || a === b;\n}\n\nfunction shouldUpdate(pkg: string) {\n return pkg.includes(\"@tsed\") && !pkg.includes(\"@tsed/cli\") && !pkg.includes(\"@tsed/logger\");\n}\n\n@Command({\n name: \"update\",\n description: \"Update all Ts.ED packages used by your project\",\n args: {},\n options: {}\n})\nexport class UpdateCmd implements CommandProvider {\n @Inject()\n npmRegistryClient: NpmRegistryClient;\n\n @Inject()\n projectPackage: ProjectPackageJson;\n\n @CliPackageJson()\n cliPackage: CliPackageJson;\n\n private versions: any;\n\n async $prompt(initialOptions: Partial<UpdateCmdContext>): Promise<QuestionOptions> {\n const versions = await this.getAvailableVersions();\n\n return [\n {\n type: \"list\",\n name: \"version\",\n message: \"Select a Ts.ED version\",\n default: initialOptions.version,\n when: !initialOptions.version,\n choices: versions\n }\n ];\n }\n\n async $exec(ctx: UpdateCmdContext) {\n Object.keys(this.projectPackage.dependencies).forEach((pkg: string) => {\n if (shouldUpdate(pkg)) {\n this.projectPackage.addDependency(pkg, ctx.version);\n }\n });\n\n Object.keys(this.projectPackage.devDependencies).forEach((pkg: string) => {\n if (shouldUpdate(pkg)) {\n this.projectPackage.addDevDependency(pkg, ctx.version);\n }\n });\n\n const projectLoggerVersion = this.projectPackage.dependencies[\"@tsed/logger\"];\n\n if (projectLoggerVersion) {\n const loggerVersion = getValue(\"dependencies.@tsed/logger\", this.versions[ctx.version], \"\");\n\n if (loggerVersion && isGreaterThan(loggerVersion, projectLoggerVersion)) {\n this.projectPackage.addDependency(\"@tsed/logger\", loggerVersion);\n }\n }\n\n const cliVersion = await this.getEligibleCliVersion(ctx.version);\n\n if (cliVersion) {\n Object.entries(this.projectPackage.devDependencies).forEach(([pkg, version]) => {\n if (pkg.includes(\"@tsed/cli-plugin\") && isGreaterThan(cliVersion, version)) {\n this.projectPackage.addDevDependency(pkg, cliVersion);\n }\n });\n }\n\n return [\n {\n title: \"Update packages\",\n task: createSubTasks(() => this.projectPackage.install(), {...ctx, concurrent: false})\n }\n ];\n }\n\n private async getAvailableVersions() {\n const {versions} = await this.npmRegistryClient.info(\"@tsed/common\", 10);\n this.versions = versions;\n\n return Object.keys(versions)\n .filter((version) => version.split(\".\")[0] >= MINIMAL_TSED_VERSION)\n .sort((a, b) => (isGreaterThan(a, b) ? -1 : 1))\n .filter((version) => !IGNORE_VERSIONS.includes(version))\n .filter((version) => (IGNORE_TAGS ? !version.match(IGNORE_TAGS) : true))\n .splice(0, 30);\n }\n\n private async getEligibleCliVersion(tsedVersion: string) {\n let result: any;\n\n result = await this.npmRegistryClient.info(\"@tsed/cli-core\", 10);\n\n if (!result) {\n result = await this.npmRegistryClient.info(\"@tsed/cli\", 10);\n }\n\n let version: string | undefined;\n\n if (result) {\n const {versions} = result;\n\n version = Object.keys(versions)\n .sort((a, b) => (isGreaterThan(a, b) ? -1 : 1))\n .find((pkg) => {\n const tsedCore = versions[pkg].devDependencies[\"@tsed/core\"] || versions[pkg].dependencies[\"@tsed/core\"];\n\n if (tsedCore) {\n return isGreaterThan(tsedVersion, tsedCore);\n }\n });\n }\n\n return version && isGreaterThan(version, this.cliPackage.version) ? version : this.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AAgD;QAC7D,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,SAAS,CA2GrB;AA3GY,8BAAS","sourcesContent":["import {\n CliDefaultOptions,\n CliPackageJson,\n Command,\n CommandProvider,\n createSubTasks,\n Inject,\n NpmRegistryClient,\n ProjectPackageJson,\n QuestionOptions\n} from \"@tsed/cli-core\";\nimport {getValue} from \"@tsed/core\";\nimport semver from \"semver\";\nimport {IGNORE_TAGS, IGNORE_VERSIONS, MINIMAL_TSED_VERSION} from \"../../constants\";\n\nexport interface UpdateCmdContext extends CliDefaultOptions {\n version: string;\n\n [key: string]: any;\n}\n\nfunction cleanVersion(version = \"\") {\n return version.replace(/[\\^~>=]/gi, \"\");\n}\n\nfunction isGreaterThan(a: any, b: string) {\n a = cleanVersion(a);\n b = cleanVersion(b);\n return semver.gt(a, b) || a === b;\n}\n\nfunction shouldUpdate(pkg: string) {\n return pkg.includes(\"@tsed\") && !pkg.includes(\"@tsed/cli\") && !pkg.includes(\"@tsed/logger\");\n}\n\n@Command({\n name: \"update\",\n description: \"Update all Ts.ED packages used by your project\",\n args: {},\n options: {}\n})\nexport class UpdateCmd implements CommandProvider {\n @Inject()\n npmRegistryClient: NpmRegistryClient;\n\n @Inject()\n projectPackage: ProjectPackageJson;\n\n @CliPackageJson()\n cliPackage: CliPackageJson;\n\n private versions: any;\n\n async $prompt(initialOptions: Partial<UpdateCmdContext>): Promise<QuestionOptions> {\n const versions = await this.getAvailableVersions();\n\n return [\n {\n type: \"list\",\n name: \"version\",\n message: \"Select a Ts.ED version\",\n default: initialOptions.version,\n when: !initialOptions.version,\n choices: versions\n }\n ];\n }\n\n async $exec(ctx: UpdateCmdContext) {\n Object.keys(this.projectPackage.dependencies).forEach((pkg: string) => {\n if (shouldUpdate(pkg)) {\n this.projectPackage.addDependency(pkg, ctx.version);\n }\n });\n\n Object.keys(this.projectPackage.devDependencies).forEach((pkg: string) => {\n if (shouldUpdate(pkg)) {\n this.projectPackage.addDevDependency(pkg, ctx.version);\n }\n });\n\n const projectLoggerVersion = this.projectPackage.dependencies[\"@tsed/logger\"];\n\n if (projectLoggerVersion) {\n const loggerVersion = getValue(\"dependencies.@tsed/logger\", this.versions[ctx.version], \"\");\n\n if (loggerVersion && isGreaterThan(loggerVersion, projectLoggerVersion)) {\n this.projectPackage.addDependency(\"@tsed/logger\", loggerVersion);\n }\n }\n\n const cliVersion = await this.getEligibleCliVersion(ctx.version);\n\n if (cliVersion) {\n Object.entries(this.projectPackage.devDependencies).forEach(([pkg, version]) => {\n if (pkg.includes(\"@tsed/cli-plugin\") && isGreaterThan(cliVersion, version)) {\n this.projectPackage.addDevDependency(pkg, cliVersion);\n }\n });\n }\n\n return [\n {\n title: \"Update packages\",\n task: createSubTasks(() => this.projectPackage.install(), {...ctx, concurrent: false})\n }\n ];\n }\n\n private async getAvailableVersions() {\n const {versions} = await this.npmRegistryClient.info(\"@tsed/common\", 10);\n this.versions = versions;\n\n return Object.keys(versions)\n .filter((version) => version.split(\".\")[0] >= MINIMAL_TSED_VERSION)\n .sort((a, b) => (isGreaterThan(a, b) ? -1 : 1))\n .filter((version) => !IGNORE_VERSIONS.includes(version))\n .filter((version) => (IGNORE_TAGS ? !version.match(IGNORE_TAGS) : true))\n .splice(0, 30);\n }\n\n private async getEligibleCliVersion(tsedVersion: string) {\n let result: any;\n\n result = await this.npmRegistryClient.info(\"@tsed/cli-core\", 10);\n\n if (!result) {\n result = await this.npmRegistryClient.info(\"@tsed/cli\", 10);\n }\n\n let version: string | undefined;\n\n if (result) {\n const {versions} = result;\n\n version = Object.keys(versions)\n .sort((a, b) => (isGreaterThan(a, b) ? -1 : 1))\n .find((pkg) => {\n const tsedCore = versions[pkg].devDependencies[\"@tsed/core\"] || versions[pkg].dependencies[\"@tsed/core\"];\n\n if (tsedCore) {\n return isGreaterThan(tsedVersion, tsedCore);\n }\n });\n }\n\n return version && isGreaterThan(version, this.cliPackage.version) ? version : this.cliPackage.version;\n }\n}\n"]}
@@ -6,5 +6,5 @@ exports.MINIMAL_TSED_VERSION = "6";
6
6
  exports.DEFAULT_TSED_TAGS = "latest";
7
7
  exports.IGNORE_VERSIONS = ["6.0.0"];
8
8
  exports.IGNORE_TAGS = false; // /alpha|beta/
9
- exports.TEMPLATE_DIR = path_1.resolve(__dirname, "..", "..", "templates");
9
+ exports.TEMPLATE_DIR = (0, path_1.resolve)(__dirname, "..", "..", "templates");
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;AAAA,+BAA6B;AAEhB,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAC3B,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAC7B,QAAA,eAAe,GAAG,CAAC,OAAO,CAAC,CAAC;AAC5B,QAAA,WAAW,GAAmB,KAAK,CAAC,CAAC,eAAe;AACpD,QAAA,YAAY,GAAG,cAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import {resolve} from \"path\";\n\nexport const MINIMAL_TSED_VERSION = \"6\";\nexport const DEFAULT_TSED_TAGS = \"latest\";\nexport const IGNORE_VERSIONS = [\"6.0.0\"];\nexport const IGNORE_TAGS: false | RegExp = false; // /alpha|beta/\nexport const TEMPLATE_DIR = resolve(__dirname, \"..\", \"..\", \"templates\");\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;AAAA,+BAA6B;AAEhB,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAC3B,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAC7B,QAAA,eAAe,GAAG,CAAC,OAAO,CAAC,CAAC;AAC5B,QAAA,WAAW,GAAmB,KAAK,CAAC,CAAC,eAAe;AACpD,QAAA,YAAY,GAAG,IAAA,cAAO,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import {resolve} from \"path\";\n\nexport const MINIMAL_TSED_VERSION = \"6\";\nexport const DEFAULT_TSED_TAGS = \"latest\";\nexport const IGNORE_VERSIONS = [\"6.0.0\"];\nexport const IGNORE_TAGS: false | RegExp = false; // /alpha|beta/\nexport const TEMPLATE_DIR = resolve(__dirname, \"..\", \"..\", \"templates\");\n"]}
@@ -14,7 +14,7 @@ let ClassNamePipe = class ClassNamePipe {
14
14
  const format = options.format || this.projectPackageJson.preferences.convention || ProjectConvention_1.ProjectConvention.DEFAULT;
15
15
  const meta = ((_a = this.providers.get(options.type)) === null || _a === void 0 ? void 0 : _a.model) || "{{symbolName}}.{{symbolType}}?";
16
16
  const type = options.type.split(":").at(-1);
17
- const symbolName = change_case_1.paramCase(path_1.basename(options.name)).replace(`-${type}`, "");
17
+ const symbolName = (0, change_case_1.paramCase)((0, path_1.basename)(options.name)).replace(`-${type}`, "");
18
18
  const names = meta.split(".").reduce((acc, key) => {
19
19
  return key
20
20
  .replace(/{{symbolName}}/gi, symbolName)
@@ -25,21 +25,21 @@ let ClassNamePipe = class ClassNamePipe {
25
25
  .reduce((acc, value) => acc.add(value), acc);
26
26
  }, new Set());
27
27
  if (format === ProjectConvention_1.ProjectConvention.DEFAULT) {
28
- return change_case_1.pascalCase([...names].join("."));
28
+ return (0, change_case_1.pascalCase)([...names].join("."));
29
29
  }
30
30
  return [...names].join(".").toLowerCase();
31
31
  }
32
32
  };
33
33
  tslib_1.__decorate([
34
- di_1.Inject(),
34
+ (0, di_1.Inject)(),
35
35
  tslib_1.__metadata("design:type", ProvidersInfoService_1.ProvidersInfoService)
36
36
  ], ClassNamePipe.prototype, "providers", void 0);
37
37
  tslib_1.__decorate([
38
- di_1.Inject(),
38
+ (0, di_1.Inject)(),
39
39
  tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
40
40
  ], ClassNamePipe.prototype, "projectPackageJson", void 0);
41
41
  ClassNamePipe = tslib_1.__decorate([
42
- cli_core_1.Injectable()
42
+ (0, cli_core_1.Injectable)()
43
43
  ], ClassNamePipe);
44
44
  exports.ClassNamePipe = ClassNamePipe;
45
45
  //# sourceMappingURL=ClassNamePipe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClassNamePipe.js","sourceRoot":"","sources":["../../src/pipes/ClassNamePipe.ts"],"names":[],"mappings":";;;;AAAA,6CAA8D;AAC9D,iCAAgC;AAChC,6CAAkD;AAClD,+BAA8B;AAC9B,2EAAsE;AACtE,uEAAkE;AAGlE,IAAa,aAAa,GAA1B,MAAa,aAAa;IAOxB,SAAS,CAAC,OAAiE;;QACzE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,UAAU,IAAI,qCAAiB,CAAC,OAAO,CAAC;QAE7G,MAAM,IAAI,GAAG,CAAA,MAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,0CAAE,KAAK,KAAI,gCAAgC,CAAC;QACzF,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,uBAAS,CAAC,eAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAE7E,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAgB,EAAE,GAAW,EAAE,EAAE;YACrE,OAAO,GAAG;iBACP,OAAO,CAAC,kBAAkB,EAAE,UAAU,CAAC;iBACvC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC;iBACjC,KAAK,CAAC,GAAG,CAAC;iBACV,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,KAAK,qCAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;iBACvF,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;iBACtD,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;QACjD,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAEd,IAAI,MAAM,KAAK,qCAAiB,CAAC,OAAO,EAAE;YACxC,OAAO,wBAAU,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SACzC;QAED,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,CAAC;CACF,CAAA;AA5BC;IADC,WAAM,EAAE;sCACE,2CAAoB;gDAAC;AAGhC;IADC,WAAM,EAAE;sCACW,6BAAkB;yDAAC;AAL5B,aAAa;IADzB,qBAAU,EAAE;GACA,aAAa,CA8BzB;AA9BY,sCAAa","sourcesContent":["import {Injectable, ProjectPackageJson} from \"@tsed/cli-core\";\nimport {Inject} from \"@tsed/di\";\nimport {paramCase, pascalCase} from \"change-case\";\nimport {basename} from \"path\";\nimport {ProvidersInfoService} from \"../services/ProvidersInfoService\";\nimport {ProjectConvention} from \"../interfaces/ProjectConvention\";\n\n@Injectable()\nexport class ClassNamePipe {\n @Inject()\n providers: ProvidersInfoService;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n transform(options: {name: string; type: string; format?: ProjectConvention}) {\n const format = options.format || this.projectPackageJson.preferences.convention || ProjectConvention.DEFAULT;\n\n const meta = this.providers.get(options.type)?.model || \"{{symbolName}}.{{symbolType}}?\";\n const type = options.type.split(\":\").at(-1)!;\n const symbolName = paramCase(basename(options.name)).replace(`-${type}`, \"\");\n\n const names = meta.split(\".\").reduce((acc: Set<string>, key: string) => {\n return key\n .replace(/{{symbolName}}/gi, symbolName)\n .replace(/{{symbolType}}/gi, type)\n .split(\".\")\n .filter((value) => (format === ProjectConvention.DEFAULT ? !value.endsWith(\"?\") : true))\n .map((value) => value.replace(/\\?$/, \"\").toLowerCase())\n .reduce((acc, value) => acc.add(value), acc);\n }, new Set());\n\n if (format === ProjectConvention.DEFAULT) {\n return pascalCase([...names].join(\".\"));\n }\n\n return [...names].join(\".\").toLowerCase();\n }\n}\n"]}
1
+ {"version":3,"file":"ClassNamePipe.js","sourceRoot":"","sources":["../../src/pipes/ClassNamePipe.ts"],"names":[],"mappings":";;;;AAAA,6CAA8D;AAC9D,iCAAgC;AAChC,6CAAkD;AAClD,+BAA8B;AAC9B,2EAAsE;AACtE,uEAAkE;AAGlE,IAAa,aAAa,GAA1B,MAAa,aAAa;IAOxB,SAAS,CAAC,OAAiE;;QACzE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,UAAU,IAAI,qCAAiB,CAAC,OAAO,CAAC;QAE7G,MAAM,IAAI,GAAG,CAAA,MAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,0CAAE,KAAK,KAAI,gCAAgC,CAAC;QACzF,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,IAAA,uBAAS,EAAC,IAAA,eAAQ,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAE7E,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAgB,EAAE,GAAW,EAAE,EAAE;YACrE,OAAO,GAAG;iBACP,OAAO,CAAC,kBAAkB,EAAE,UAAU,CAAC;iBACvC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC;iBACjC,KAAK,CAAC,GAAG,CAAC;iBACV,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,KAAK,qCAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;iBACvF,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;iBACtD,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;QACjD,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAEd,IAAI,MAAM,KAAK,qCAAiB,CAAC,OAAO,EAAE;YACxC,OAAO,IAAA,wBAAU,EAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SACzC;QAED,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,CAAC;CACF,CAAA;AA5BC;IADC,IAAA,WAAM,GAAE;sCACE,2CAAoB;gDAAC;AAGhC;IADC,IAAA,WAAM,GAAE;sCACW,6BAAkB;yDAAC;AAL5B,aAAa;IADzB,IAAA,qBAAU,GAAE;GACA,aAAa,CA8BzB;AA9BY,sCAAa","sourcesContent":["import {Injectable, ProjectPackageJson} from \"@tsed/cli-core\";\nimport {Inject} from \"@tsed/di\";\nimport {paramCase, pascalCase} from \"change-case\";\nimport {basename} from \"path\";\nimport {ProvidersInfoService} from \"../services/ProvidersInfoService\";\nimport {ProjectConvention} from \"../interfaces/ProjectConvention\";\n\n@Injectable()\nexport class ClassNamePipe {\n @Inject()\n providers: ProvidersInfoService;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n transform(options: {name: string; type: string; format?: ProjectConvention}) {\n const format = options.format || this.projectPackageJson.preferences.convention || ProjectConvention.DEFAULT;\n\n const meta = this.providers.get(options.type)?.model || \"{{symbolName}}.{{symbolType}}?\";\n const type = options.type.split(\":\").at(-1)!;\n const symbolName = paramCase(basename(options.name)).replace(`-${type}`, \"\");\n\n const names = meta.split(\".\").reduce((acc: Set<string>, key: string) => {\n return key\n .replace(/{{symbolName}}/gi, symbolName)\n .replace(/{{symbolType}}/gi, type)\n .split(\".\")\n .filter((value) => (format === ProjectConvention.DEFAULT ? !value.endsWith(\"?\") : true))\n .map((value) => value.replace(/\\?$/, \"\").toLowerCase())\n .reduce((acc, value) => acc.add(value), acc);\n }, new Set());\n\n if (format === ProjectConvention.DEFAULT) {\n return pascalCase([...names].join(\".\"));\n }\n\n return [...names].join(\".\").toLowerCase();\n }\n}\n"]}
@@ -15,24 +15,24 @@ let OutputFilePathPipe = class OutputFilePathPipe {
15
15
  transform(options) {
16
16
  var _a;
17
17
  options.format = options.format || this.projectPackageJson.preferences.convention || interfaces_1.ProjectConvention.DEFAULT;
18
- const featureDir = path_1.dirname(options.name);
18
+ const featureDir = (0, path_1.dirname)(options.name);
19
19
  if (options.type === "server" || this.projectPackageJson.preferences.architecture === interfaces_1.ArchitectureConvention.FEATURE) {
20
- return path_1.join(options.subDir || "", featureDir, this.classNamePipe.transform(options));
20
+ return (0, path_1.join)(options.subDir || "", featureDir, this.classNamePipe.transform(options));
21
21
  }
22
22
  const baseDir = (options.baseDir || ((_a = this.providers.get(options.type)) === null || _a === void 0 ? void 0 : _a.baseDir) || `${options.type}s`).split(":").at(-1);
23
- return path_1.join(baseDir, options.subDir || "", featureDir, this.classNamePipe.transform(options));
23
+ return (0, path_1.join)(baseDir, options.subDir || "", featureDir, this.classNamePipe.transform(options));
24
24
  }
25
25
  };
26
26
  tslib_1.__decorate([
27
- di_1.Inject(),
27
+ (0, di_1.Inject)(),
28
28
  tslib_1.__metadata("design:type", ProvidersInfoService_1.ProvidersInfoService)
29
29
  ], OutputFilePathPipe.prototype, "providers", void 0);
30
30
  tslib_1.__decorate([
31
- di_1.Inject(),
31
+ (0, di_1.Inject)(),
32
32
  tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
33
33
  ], OutputFilePathPipe.prototype, "projectPackageJson", void 0);
34
34
  OutputFilePathPipe = tslib_1.__decorate([
35
- cli_core_1.Injectable(),
35
+ (0, cli_core_1.Injectable)(),
36
36
  tslib_1.__metadata("design:paramtypes", [ClassNamePipe_1.ClassNamePipe])
37
37
  ], OutputFilePathPipe);
38
38
  exports.OutputFilePathPipe = OutputFilePathPipe;
@@ -1 +1 @@
1
- {"version":3,"file":"OutputFilePathPipe.js","sourceRoot":"","sources":["../../src/pipes/OutputFilePathPipe.ts"],"names":[],"mappings":";;;;AAAA,6CAA8D;AAC9D,iCAAgC;AAChC,+BAAmC;AACnC,2EAAsE;AACtE,mDAA8C;AAC9C,8CAAwE;AAGxE,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAO7B,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAEpD,SAAS,CAAC,OAAoG;;QAC5G,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,UAAU,IAAI,8BAAiB,CAAC,OAAO,CAAC;QAE/G,MAAM,UAAU,GAAG,cAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEzC,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,YAAY,KAAK,mCAAsB,CAAC,OAAO,EAAE;YACpH,OAAO,WAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;SACtF;QAED,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,KAAI,MAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,0CAAE,OAAO,CAAA,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvH,OAAO,WAAI,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAChG,CAAC;CACF,CAAA;AApBC;IADC,WAAM,EAAE;sCACE,2CAAoB;qDAAC;AAGhC;IADC,WAAM,EAAE;sCACW,6BAAkB;8DAAC;AAL5B,kBAAkB;IAD9B,qBAAU,EAAE;6CAQwB,6BAAa;GAPrC,kBAAkB,CAsB9B;AAtBY,gDAAkB","sourcesContent":["import {Injectable, ProjectPackageJson} from \"@tsed/cli-core\";\nimport {Inject} from \"@tsed/di\";\nimport {dirname, join} from \"path\";\nimport {ProvidersInfoService} from \"../services/ProvidersInfoService\";\nimport {ClassNamePipe} from \"./ClassNamePipe\";\nimport {ProjectConvention, ArchitectureConvention} from \"../interfaces\";\n\n@Injectable()\nexport class OutputFilePathPipe {\n @Inject()\n providers: ProvidersInfoService;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n constructor(private classNamePipe: ClassNamePipe) {}\n\n transform(options: {name: string; type: string; subDir?: string; baseDir?: string; format?: ProjectConvention}) {\n options.format = options.format || this.projectPackageJson.preferences.convention || ProjectConvention.DEFAULT;\n\n const featureDir = dirname(options.name);\n\n if (options.type === \"server\" || this.projectPackageJson.preferences.architecture === ArchitectureConvention.FEATURE) {\n return join(options.subDir || \"\", featureDir, this.classNamePipe.transform(options));\n }\n\n const baseDir = (options.baseDir || this.providers.get(options.type)?.baseDir || `${options.type}s`).split(\":\").at(-1);\n\n return join(baseDir, options.subDir || \"\", featureDir, this.classNamePipe.transform(options));\n }\n}\n"]}
1
+ {"version":3,"file":"OutputFilePathPipe.js","sourceRoot":"","sources":["../../src/pipes/OutputFilePathPipe.ts"],"names":[],"mappings":";;;;AAAA,6CAA8D;AAC9D,iCAAgC;AAChC,+BAAmC;AACnC,2EAAsE;AACtE,mDAA8C;AAC9C,8CAAwE;AAGxE,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAO7B,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAEpD,SAAS,CAAC,OAAoG;;QAC5G,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,UAAU,IAAI,8BAAiB,CAAC,OAAO,CAAC;QAE/G,MAAM,UAAU,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEzC,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,YAAY,KAAK,mCAAsB,CAAC,OAAO,EAAE;YACpH,OAAO,IAAA,WAAI,EAAC,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;SACtF;QAED,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,KAAI,MAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,0CAAE,OAAO,CAAA,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvH,OAAO,IAAA,WAAI,EAAC,OAAO,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAChG,CAAC;CACF,CAAA;AApBC;IADC,IAAA,WAAM,GAAE;sCACE,2CAAoB;qDAAC;AAGhC;IADC,IAAA,WAAM,GAAE;sCACW,6BAAkB;8DAAC;AAL5B,kBAAkB;IAD9B,IAAA,qBAAU,GAAE;6CAQwB,6BAAa;GAPrC,kBAAkB,CAsB9B;AAtBY,gDAAkB","sourcesContent":["import {Injectable, ProjectPackageJson} from \"@tsed/cli-core\";\nimport {Inject} from \"@tsed/di\";\nimport {dirname, join} from \"path\";\nimport {ProvidersInfoService} from \"../services/ProvidersInfoService\";\nimport {ClassNamePipe} from \"./ClassNamePipe\";\nimport {ProjectConvention, ArchitectureConvention} from \"../interfaces\";\n\n@Injectable()\nexport class OutputFilePathPipe {\n @Inject()\n providers: ProvidersInfoService;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n constructor(private classNamePipe: ClassNamePipe) {}\n\n transform(options: {name: string; type: string; subDir?: string; baseDir?: string; format?: ProjectConvention}) {\n options.format = options.format || this.projectPackageJson.preferences.convention || ProjectConvention.DEFAULT;\n\n const featureDir = dirname(options.name);\n\n if (options.type === \"server\" || this.projectPackageJson.preferences.architecture === ArchitectureConvention.FEATURE) {\n return join(options.subDir || \"\", featureDir, this.classNamePipe.transform(options));\n }\n\n const baseDir = (options.baseDir || this.providers.get(options.type)?.baseDir || `${options.type}s`).split(\":\").at(-1);\n\n return join(baseDir, options.subDir || \"\", featureDir, this.classNamePipe.transform(options));\n }\n}\n"]}
@@ -9,18 +9,18 @@ let RoutePipe = class RoutePipe {
9
9
  const r = route
10
10
  .split("/")
11
11
  .reduce((paths, path) => {
12
- const word = change_case_1.paramCase(path);
12
+ const word = (0, change_case_1.paramCase)(path);
13
13
  if (paths.includes(`${word}s`) || paths.includes(word)) {
14
14
  return paths;
15
15
  }
16
- return [...paths, change_case_1.paramCase(path)];
16
+ return [...paths, (0, change_case_1.paramCase)(path)];
17
17
  }, [])
18
18
  .join("/");
19
19
  return `/${r}`.replace(/\/\//gi, "/");
20
20
  }
21
21
  };
22
22
  RoutePipe = tslib_1.__decorate([
23
- cli_core_1.Injectable()
23
+ (0, cli_core_1.Injectable)()
24
24
  ], RoutePipe);
25
25
  exports.RoutePipe = RoutePipe;
26
26
  //# sourceMappingURL=RoutePipe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RoutePipe.js","sourceRoot":"","sources":["../../src/pipes/RoutePipe.ts"],"names":[],"mappings":";;;;AAAA,6CAA0C;AAC1C,6CAAsC;AAGtC,IAAa,SAAS,GAAtB,MAAa,SAAS;IACpB,SAAS,CAAC,KAAa;QACrB,MAAM,CAAC,GAAG,KAAK;aACZ,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,CAAC,KAAe,EAAE,IAAI,EAAE,EAAE;YAChC,MAAM,IAAI,GAAG,uBAAS,CAAC,IAAI,CAAC,CAAC;YAE7B,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACtD,OAAO,KAAK,CAAC;aACd;YAED,OAAO,CAAC,GAAG,KAAK,EAAE,uBAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACrC,CAAC,EAAE,EAAE,CAAC;aACL,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;CACF,CAAA;AAjBY,SAAS;IADrB,qBAAU,EAAE;GACA,SAAS,CAiBrB;AAjBY,8BAAS","sourcesContent":["import {Injectable} from \"@tsed/cli-core\";\nimport {paramCase} from \"change-case\";\n\n@Injectable()\nexport class RoutePipe {\n transform(route: string) {\n const r = route\n .split(\"/\")\n .reduce((paths: string[], path) => {\n const word = paramCase(path);\n\n if (paths.includes(`${word}s`) || paths.includes(word)) {\n return paths;\n }\n\n return [...paths, paramCase(path)];\n }, [])\n .join(\"/\");\n\n return `/${r}`.replace(/\\/\\//gi, \"/\");\n }\n}\n"]}
1
+ {"version":3,"file":"RoutePipe.js","sourceRoot":"","sources":["../../src/pipes/RoutePipe.ts"],"names":[],"mappings":";;;;AAAA,6CAA0C;AAC1C,6CAAsC;AAGtC,IAAa,SAAS,GAAtB,MAAa,SAAS;IACpB,SAAS,CAAC,KAAa;QACrB,MAAM,CAAC,GAAG,KAAK;aACZ,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,CAAC,KAAe,EAAE,IAAI,EAAE,EAAE;YAChC,MAAM,IAAI,GAAG,IAAA,uBAAS,EAAC,IAAI,CAAC,CAAC;YAE7B,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACtD,OAAO,KAAK,CAAC;aACd;YAED,OAAO,CAAC,GAAG,KAAK,EAAE,IAAA,uBAAS,EAAC,IAAI,CAAC,CAAC,CAAC;QACrC,CAAC,EAAE,EAAE,CAAC;aACL,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;CACF,CAAA;AAjBY,SAAS;IADrB,IAAA,qBAAU,GAAE;GACA,SAAS,CAiBrB;AAjBY,8BAAS","sourcesContent":["import {Injectable} from \"@tsed/cli-core\";\nimport {paramCase} from \"change-case\";\n\n@Injectable()\nexport class RoutePipe {\n transform(route: string) {\n const r = route\n .split(\"/\")\n .reduce((paths: string[], path) => {\n const word = paramCase(path);\n\n if (paths.includes(`${word}s`) || paths.includes(word)) {\n return paths;\n }\n\n return [...paths, paramCase(path)];\n }, [])\n .join(\"/\");\n\n return `/${r}`.replace(/\\/\\//gi, \"/\");\n }\n}\n"]}
@@ -5,7 +5,7 @@ const cli_core_1 = require("@tsed/cli-core");
5
5
  const core_1 = require("@tsed/core");
6
6
  const interfaces_1 = require("../interfaces");
7
7
  function Features() {
8
- return cli_core_1.Inject(Features);
8
+ return (0, cli_core_1.Inject)(Features);
9
9
  }
10
10
  exports.Features = Features;
11
11
  function hasFeature(feature) {
@@ -13,7 +13,7 @@ function hasFeature(feature) {
13
13
  }
14
14
  exports.hasFeature = hasFeature;
15
15
  function hasValue(expression, value) {
16
- return (ctx) => core_1.getValue(expression, ctx) === value;
16
+ return (ctx) => (0, core_1.getValue)(expression, ctx) === value;
17
17
  }
18
18
  exports.hasValue = hasValue;
19
19
  function isPlatform(...types) {
@@ -173,21 +173,11 @@ const conventionChoices = [
173
173
  ];
174
174
  const featureChoices = (cliVersion) => [
175
175
  {
176
- name: "GraphQL",
176
+ name: "TypeGraphQL",
177
177
  value: {
178
178
  type: "graphql",
179
- dependencies: {
180
- "@tsed/graphql": "{{tsedVersion}}",
181
- "apollo-datasource": "^3.3.1",
182
- "apollo-datasource-rest": "^3.5.1",
183
- "apollo-server-core": "^3.6.2",
184
- "type-graphql": "^1.1.1",
185
- "class-validator": "^0.13.2",
186
- graphql: "^15.7.2"
187
- },
188
179
  devDependencies: {
189
- "@types/validator": "latest",
190
- "apollo-server-testing": "latest"
180
+ "@tsed/cli-plugin-typegraphql": cliVersion
191
181
  }
192
182
  }
193
183
  },
@@ -262,6 +252,9 @@ const featureChoices = (cliVersion) => [
262
252
  type: "commands",
263
253
  dependencies: {
264
254
  "@tsed/cli-core": cliVersion
255
+ },
256
+ devDependencies: {
257
+ "@types/inquirer": "latest"
265
258
  }
266
259
  }
267
260
  }
@@ -376,7 +369,7 @@ const packageManagerChoices = [
376
369
  value: "npm"
377
370
  },
378
371
  {
379
- name: "PNPM",
372
+ name: "PNPM - experimental",
380
373
  checked: false,
381
374
  value: "pnpm"
382
375
  }
@@ -417,7 +410,7 @@ const getFeaturesChoicesValues = (cliVersion) => {
417
410
  };
418
411
  };
419
412
  exports.getFeaturesChoicesValues = getFeaturesChoicesValues;
420
- cli_core_1.registerProvider({
413
+ (0, cli_core_1.registerProvider)({
421
414
  provide: Features,
422
415
  deps: [cli_core_1.CliPackageJson],
423
416
  useFactory(cliPackageJson) {
@@ -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,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AAC1F,CAAC;AAFD,gCAEC;AAED,SAAgB,QAAQ,CAAC,UAAkB,EAAE,KAAU;IACrD,OAAO,CAAC,GAAQ,EAAE,EAAE,CAAC,eAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;AAC3D,CAAC;AAFD,4BAEC;AAED,SAAgB,UAAU,CAAC,GAAG,KAAe;IAC3C,OAAO,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC;AAFD,gCAEC;AAEY,QAAA,iCAAiC,GAAG;IAC/C;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,IAAI,EAAE,eAAe;YACrB,YAAY,EAAE;gBACZ,MAAM,EAAE,QAAQ;aACjB;SACF;KACF;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE;YACL,IAAI,EAAE,iBAAi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ACJ,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 mysql2: \"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: \"Better SQLite3\",\n value: {\n type: \"typeorm:better-sqlite3\",\n dependencies: {\n \"better-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\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 return {\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};\n\nexport const getFeaturesChoicesValues = (cliVersion: string) => {\n return {\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};\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"]}
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,IAAA,iBAAM,EAAC,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,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AAC1F,CAAC;AAFD,gCAEC;AAED,SAAgB,QAAQ,CAAC,UAAkB,EAAE,KAAU;IACrD,OAAO,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAA,eAAQ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ACD;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 mysql2: \"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: \"Better SQLite3\",\n value: {\n type: \"typeorm:better-sqlite3\",\n dependencies: {\n \"better-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: \"TypeGraphQL\",\n value: {\n type: \"graphql\",\n devDependencies: {\n \"@tsed/cli-plugin-typegraphql\": cliVersion\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 devDependencies: {\n \"@types/inquirer\": \"latest\"\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\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 - experimental\",\n checked: false,\n value: \"pnpm\"\n }\n];\n\nexport const parseFeaturesFile = (features: Record<string, any>, cliVersion: string) => {\n return {\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};\n\nexport const getFeaturesChoicesValues = (cliVersion: string) => {\n return {\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};\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"]}
@@ -15,7 +15,7 @@ let ProvidersInfoService = class ProvidersInfoService {
15
15
  add(providerInfo, owner) {
16
16
  this.map.set(providerInfo.value, {
17
17
  ...providerInfo,
18
- owner: cli_core_1.nameOf(owner)
18
+ owner: (0, cli_core_1.nameOf)(owner)
19
19
  });
20
20
  return this;
21
21
  }
@@ -24,7 +24,7 @@ let ProvidersInfoService = class ProvidersInfoService {
24
24
  }
25
25
  isMyProvider(value, owner) {
26
26
  var _a;
27
- return ((_a = this.map.get(value)) === null || _a === void 0 ? void 0 : _a.owner) === cli_core_1.nameOf(owner);
27
+ return ((_a = this.map.get(value)) === null || _a === void 0 ? void 0 : _a.owner) === (0, cli_core_1.nameOf)(owner);
28
28
  }
29
29
  toArray() {
30
30
  return Array.from(this.map.values());
@@ -45,7 +45,7 @@ let ProvidersInfoService = class ProvidersInfoService {
45
45
  }
46
46
  };
47
47
  ProvidersInfoService = tslib_1.__decorate([
48
- cli_core_1.Injectable()
48
+ (0, cli_core_1.Injectable)()
49
49
  ], ProvidersInfoService);
50
50
  exports.ProvidersInfoService = ProvidersInfoService;
51
51
  //# sourceMappingURL=ProvidersInfoService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProvidersInfoService.js","sourceRoot":"","sources":["../../src/services/ProvidersInfoService.ts"],"names":[],"mappings":";;;;AAAA,6CAAwD;AAWxD,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAAjC;QACW,QAAG,GAA8B,IAAI,GAAG,EAAE,CAAC;IA8CtD,CAAC;IA5CC;;;;OAIG;IACH,GAAG,CAAC,YAA0B,EAAE,KAAiB;QAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,EAAE;YAC/B,GAAG,YAAY;YACf,KAAK,EAAE,iBAAM,CAAC,KAAK,CAAC;SACrB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,KAAa;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,YAAY,CAAC,KAAa,EAAE,KAAgB;;QAC1C,OAAO,CAAA,MAAA,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,0CAAE,KAAK,MAAK,iBAAM,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,aAAa,CAAC,IAAwB;QACpC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAE1B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAClB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;SACzB;QAED,MAAM,iBAAiB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;YACtD,OAAO,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAK,CAAC,CAAC;QACvF,CAAC,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,CAAC;CACF,CAAA;AA/CY,oBAAoB;IADhC,qBAAU,EAAE;GACA,oBAAoB,CA+ChC;AA/CY,oDAAoB","sourcesContent":["import {Injectable, nameOf, Type} from \"@tsed/cli-core\";\n\nexport interface ProviderInfo {\n name: string;\n value: string;\n model?: string;\n baseDir?: string;\n owner?: string;\n}\n\n@Injectable()\nexport class ProvidersInfoService {\n readonly map: Map<string, ProviderInfo> = new Map();\n\n /**\n *\n * @param providerInfo\n * @param owner\n */\n add(providerInfo: ProviderInfo, owner?: Type<any>) {\n this.map.set(providerInfo.value, {\n ...providerInfo,\n owner: nameOf(owner)\n });\n\n return this;\n }\n\n get(value: string): any {\n return this.map.get(value);\n }\n\n isMyProvider(value: string, owner: Type<any>) {\n return this.map.get(value)?.owner === nameOf(owner);\n }\n\n toArray() {\n return Array.from(this.map.values());\n }\n\n findProviders(type: string | undefined): ProviderInfo[] {\n const providers = this.toArray();\n if (!type) {\n return providers;\n }\n\n type = type.toLowerCase();\n\n if (this.get(type)) {\n return [this.get(type)];\n }\n\n const proposedProviders = providers.filter((provider) => {\n return provider.name.toLowerCase().includes(type!) || provider.value.includes(type!);\n });\n\n return proposedProviders.length ? proposedProviders : providers;\n }\n}\n"]}
1
+ {"version":3,"file":"ProvidersInfoService.js","sourceRoot":"","sources":["../../src/services/ProvidersInfoService.ts"],"names":[],"mappings":";;;;AAAA,6CAAwD;AAWxD,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAAjC;QACW,QAAG,GAA8B,IAAI,GAAG,EAAE,CAAC;IA8CtD,CAAC;IA5CC;;;;OAIG;IACH,GAAG,CAAC,YAA0B,EAAE,KAAiB;QAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,EAAE;YAC/B,GAAG,YAAY;YACf,KAAK,EAAE,IAAA,iBAAM,EAAC,KAAK,CAAC;SACrB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,KAAa;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,YAAY,CAAC,KAAa,EAAE,KAAgB;;QAC1C,OAAO,CAAA,MAAA,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,0CAAE,KAAK,MAAK,IAAA,iBAAM,EAAC,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,aAAa,CAAC,IAAwB;QACpC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAE1B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAClB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;SACzB;QAED,MAAM,iBAAiB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;YACtD,OAAO,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAK,CAAC,CAAC;QACvF,CAAC,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,CAAC;CACF,CAAA;AA/CY,oBAAoB;IADhC,IAAA,qBAAU,GAAE;GACA,oBAAoB,CA+ChC;AA/CY,oDAAoB","sourcesContent":["import {Injectable, nameOf, Type} from \"@tsed/cli-core\";\n\nexport interface ProviderInfo {\n name: string;\n value: string;\n model?: string;\n baseDir?: string;\n owner?: string;\n}\n\n@Injectable()\nexport class ProvidersInfoService {\n readonly map: Map<string, ProviderInfo> = new Map();\n\n /**\n *\n * @param providerInfo\n * @param owner\n */\n add(providerInfo: ProviderInfo, owner?: Type<any>) {\n this.map.set(providerInfo.value, {\n ...providerInfo,\n owner: nameOf(owner)\n });\n\n return this;\n }\n\n get(value: string): any {\n return this.map.get(value);\n }\n\n isMyProvider(value: string, owner: Type<any>) {\n return this.map.get(value)?.owner === nameOf(owner);\n }\n\n toArray() {\n return Array.from(this.map.values());\n }\n\n findProviders(type: string | undefined): ProviderInfo[] {\n const providers = this.toArray();\n if (!type) {\n return providers;\n }\n\n type = type.toLowerCase();\n\n if (this.get(type)) {\n return [this.get(type)];\n }\n\n const proposedProviders = providers.filter((provider) => {\n return provider.name.toLowerCase().includes(type!) || provider.value.includes(type!);\n });\n\n return proposedProviders.length ? proposedProviders : providers;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/cli",
3
- "version": "3.20.12",
3
+ "version": "3.20.13",
4
4
  "main": "./lib/index.js",
5
5
  "typings": "./lib/index.d.ts",
6
6
  "bin": {
@@ -45,7 +45,7 @@
45
45
  "node": ">=8.9"
46
46
  },
47
47
  "dependencies": {
48
- "@tsed/cli-core": "3.20.12",
48
+ "@tsed/cli-core": "3.20.13",
49
49
  "@tsed/core": ">=6.114.6",
50
50
  "@tsed/di": ">=6.114.6",
51
51
  "@tsed/logger": ">=6.0.0",
@@ -55,7 +55,7 @@
55
55
  "tslib": "2.3.1"
56
56
  },
57
57
  "devDependencies": {
58
- "@tsed/cli-testing": "3.20.12",
58
+ "@tsed/cli-testing": "3.20.13",
59
59
  "@types/change-case": "^2.3.1"
60
60
  },
61
61
  "peerDependencies": {},
@@ -15,7 +15,10 @@ import cors from "@koa/cors";
15
15
  import "@tsed/ajv";{{#if swagger}}
16
16
  import "@tsed/swagger";{{/if}}{{#if mongoose}}
17
17
  import "@tsed/mongoose";{{/if}}{{#if oidc}}
18
- import "@tsed/oidc-provider";{{/if}}
18
+ import "@tsed/oidc-provider";{{/if}}{{#if graphql}}
19
+ import "@tsed/typegraphql";
20
+ import "./datasources";
21
+ import "./resolvers";{{/if}}
19
22
  import {config} from "./config";
20
23
  import * as rest from "./controllers/rest";{{#if swagger}}
21
24
  import * as pages from "./controllers/pages";{{/if}}{{#if oidc}}
@@ -56,8 +59,7 @@ const methodOverride = require("koa-override");{{/if}}
56
59
  cors(),
57
60
  compress({}),
58
61
  methodOverride(),
59
- bodyParser()
60
- {{/if}}
62
+ bodyParser(){{/if}}
61
63
  ],
62
64
  views: {
63
65
  root: join(process.cwd(), "../views"),
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "directory": [
3
3
  "./src/controllers/rest"{{#or swagger oidc}},
4
- "./src/controllers/pages"{{/or}}
4
+ "./src/controllers/pages"{{/or}}{{#if graphql}},
5
+ "./src/datasources",
6
+ "./src/resolvers"{{/if}}
5
7
  ],
6
8
  "exclude": [
7
9
  "__mock__",
@@ -20,10 +20,10 @@ export const config: Partial<TsED.Configuration> = {
20
20
  graphql: {
21
21
  default: {
22
22
  path: "/graphql",
23
- buildSchemaOptions: {
23
+ buildSchemaOptions: {
24
24
  }
25
25
  }
26
- }
26
+ },
27
27
  {{/if}}
28
28
  {{#if oidc}}
29
29
  oidc: oidcConfig,