@tsed/cli 3.20.16 → 3.21.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{Cli.js → cjs/Cli.js} +4 -2
- package/lib/cjs/Cli.js.map +1 -0
- package/lib/{bin → cjs/bin}/tsed.js +1 -1
- package/lib/cjs/bin/tsed.js.map +1 -0
- package/lib/{commands → cjs/commands}/add/AddCmd.js +0 -0
- package/lib/cjs/commands/add/AddCmd.js.map +1 -0
- package/lib/{commands → cjs/commands}/generate/GenerateCmd.js +3 -3
- package/lib/cjs/commands/generate/GenerateCmd.js.map +1 -0
- package/lib/{commands → cjs/commands}/generate/ProviderTypes.js +0 -0
- package/lib/cjs/commands/generate/ProviderTypes.js.map +1 -0
- package/lib/{commands → cjs/commands}/index.js +0 -0
- package/lib/cjs/commands/index.js.map +1 -0
- package/lib/{commands → cjs/commands}/init/InitCmd.js +0 -0
- package/lib/cjs/commands/init/InitCmd.js.map +1 -0
- package/lib/{commands → cjs/commands}/run/RunCmd.js +0 -0
- package/lib/cjs/commands/run/RunCmd.js.map +1 -0
- package/lib/{commands → cjs/commands}/update/UpdateCmd.js +0 -0
- package/lib/cjs/commands/update/UpdateCmd.js.map +1 -0
- package/lib/cjs/constants/index.js +18 -0
- package/lib/cjs/constants/index.js.map +1 -0
- package/lib/{index.js → cjs/index.js} +0 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/ArchitectureConvention.js +0 -0
- package/lib/cjs/interfaces/ArchitectureConvention.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/ProjectConvention.js +0 -0
- package/lib/cjs/interfaces/ProjectConvention.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/index.js +0 -0
- package/lib/cjs/interfaces/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/{pipes → cjs/pipes}/ClassNamePipe.js +0 -0
- package/lib/cjs/pipes/ClassNamePipe.js.map +1 -0
- package/lib/{pipes → cjs/pipes}/OutputFilePathPipe.js +0 -0
- package/lib/cjs/pipes/OutputFilePathPipe.js.map +1 -0
- package/lib/{pipes → cjs/pipes}/RoutePipe.js +0 -0
- package/lib/cjs/pipes/RoutePipe.js.map +1 -0
- package/lib/{pipes → cjs/pipes}/index.js +0 -0
- package/lib/cjs/pipes/index.js.map +1 -0
- package/lib/{services → cjs/services}/Features.js +0 -0
- package/lib/cjs/services/Features.js.map +1 -0
- package/lib/{services → cjs/services}/ProvidersInfoService.js +0 -0
- package/lib/cjs/services/ProvidersInfoService.js.map +1 -0
- package/lib/esm/Cli.js +44 -0
- package/lib/esm/Cli.js.map +1 -0
- package/lib/esm/bin/tsed.js +22 -0
- package/lib/esm/bin/tsed.js.map +1 -0
- package/lib/esm/commands/add/AddCmd.js +58 -0
- package/lib/esm/commands/add/AddCmd.js.map +1 -0
- package/lib/esm/commands/generate/GenerateCmd.js +239 -0
- package/lib/esm/commands/generate/GenerateCmd.js.map +1 -0
- package/lib/esm/commands/generate/ProviderTypes.js +104 -0
- package/lib/esm/commands/generate/ProviderTypes.js.map +1 -0
- package/lib/esm/commands/index.js +7 -0
- package/lib/esm/commands/index.js.map +1 -0
- package/lib/esm/commands/init/InitCmd.js +371 -0
- package/lib/esm/commands/init/InitCmd.js.map +1 -0
- package/lib/esm/commands/run/RunCmd.js +65 -0
- package/lib/esm/commands/run/RunCmd.js.map +1 -0
- package/lib/esm/commands/update/UpdateCmd.js +116 -0
- package/lib/esm/commands/update/UpdateCmd.js.map +1 -0
- package/lib/esm/constants/index.js +14 -0
- package/lib/esm/constants/index.js.map +1 -0
- package/lib/esm/index.js +10 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/interfaces/ArchitectureConvention.js +6 -0
- package/lib/esm/interfaces/ArchitectureConvention.js.map +1 -0
- package/lib/esm/interfaces/ProjectConvention.js +6 -0
- package/lib/esm/interfaces/ProjectConvention.js.map +1 -0
- package/lib/esm/interfaces/index.js +3 -0
- package/lib/esm/interfaces/index.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/pipes/ClassNamePipe.js +42 -0
- package/lib/esm/pipes/ClassNamePipe.js.map +1 -0
- package/lib/esm/pipes/OutputFilePathPipe.js +36 -0
- package/lib/esm/pipes/OutputFilePathPipe.js.map +1 -0
- package/lib/esm/pipes/RoutePipe.js +23 -0
- package/lib/esm/pipes/RoutePipe.js.map +1 -0
- package/lib/esm/pipes/index.js +4 -0
- package/lib/esm/pipes/index.js.map +1 -0
- package/lib/esm/services/Features.js +520 -0
- package/lib/esm/services/Features.js.map +1 -0
- package/lib/esm/services/ProvidersInfoService.js +48 -0
- package/lib/esm/services/ProvidersInfoService.js.map +1 -0
- package/lib/{Cli.d.ts → types/Cli.d.ts} +0 -0
- package/lib/{bin → types/bin}/tsed.d.ts +0 -0
- package/lib/{commands → types/commands}/add/AddCmd.d.ts +0 -0
- package/lib/{commands → types/commands}/generate/GenerateCmd.d.ts +0 -0
- package/lib/{commands → types/commands}/generate/ProviderTypes.d.ts +0 -0
- package/lib/{commands → types/commands}/index.d.ts +0 -0
- package/lib/{commands → types/commands}/init/InitCmd.d.ts +0 -0
- package/lib/{commands → types/commands}/run/RunCmd.d.ts +0 -0
- package/lib/{commands → types/commands}/update/UpdateCmd.d.ts +0 -0
- package/lib/{constants → types/constants}/index.d.ts +1 -0
- package/lib/{index.d.ts → types/index.d.ts} +0 -0
- package/lib/{interfaces → types/interfaces}/ArchitectureConvention.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/ProjectConvention.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/index.d.ts +0 -0
- package/lib/{pipes → types/pipes}/ClassNamePipe.d.ts +0 -0
- package/lib/{pipes → types/pipes}/OutputFilePathPipe.d.ts +0 -0
- package/lib/{pipes → types/pipes}/RoutePipe.d.ts +0 -0
- package/lib/{pipes → types/pipes}/index.d.ts +0 -0
- package/lib/{services → types/services}/Features.d.ts +0 -0
- package/lib/{services → types/services}/ProvidersInfoService.d.ts +0 -0
- package/package.json +38 -25
- package/templates/generate/server.hbs +7 -8
- package/templates/init/src/config/index.ts.hbs +4 -4
- package/templates/init/src/config/logger/index.ts.hbs +1 -1
- package/lib/Cli.js.map +0 -1
- package/lib/bin/tsed.js.map +0 -1
- package/lib/commands/add/AddCmd.js.map +0 -1
- package/lib/commands/generate/GenerateCmd.js.map +0 -1
- package/lib/commands/generate/ProviderTypes.js.map +0 -1
- package/lib/commands/index.js.map +0 -1
- package/lib/commands/init/InitCmd.js.map +0 -1
- package/lib/commands/run/RunCmd.js.map +0 -1
- package/lib/commands/update/UpdateCmd.js.map +0 -1
- package/lib/constants/index.js +0 -10
- package/lib/constants/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/interfaces/ArchitectureConvention.js.map +0 -1
- package/lib/interfaces/ProjectConvention.js.map +0 -1
- package/lib/interfaces/index.js.map +0 -1
- package/lib/pipes/ClassNamePipe.js.map +0 -1
- package/lib/pipes/OutputFilePathPipe.js.map +0 -1
- package/lib/pipes/RoutePipe.js.map +0 -1
- package/lib/pipes/index.js.map +0 -1
- package/lib/services/Features.js.map +0 -1
- package/lib/services/ProvidersInfoService.js.map +0 -1
|
@@ -4,6 +4,9 @@ exports.Cli = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const cli_core_1 = require("@tsed/cli-core");
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const module_alias_1 = tslib_1.__importDefault(require("module-alias"));
|
|
7
10
|
class Cli extends cli_core_1.CliCore {
|
|
8
11
|
static checkPackage(pkg) {
|
|
9
12
|
if (!pkg) {
|
|
@@ -34,8 +37,7 @@ class Cli extends cli_core_1.CliCore {
|
|
|
34
37
|
return super.bootstrap(settings, Cli);
|
|
35
38
|
}
|
|
36
39
|
static createAliases() {
|
|
37
|
-
|
|
38
|
-
alias.addAliases({
|
|
40
|
+
module_alias_1.default.addAliases({
|
|
39
41
|
"@tsed/core": require.resolve("@tsed/core"),
|
|
40
42
|
"@tsed/di": require.resolve("@tsed/di"),
|
|
41
43
|
"@tsed/cli-core": require.resolve("@tsed/cli-core"),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../src/Cli.ts"],"names":[],"mappings":";;;;AAAA,6CAAuC;AACvC,0DAA0B;AAC1B,6DAA6D;AAC7D,aAAa;AACb,wEAAiC;AAEjC,MAAa,GAAI,SAAQ,kBAAO;IAC9B,MAAM,CAAC,YAAY,CAAC,GAAQ;QAC1B,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,4FAA4F,CAAC,CAAC,CAAC;YACrH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,IAAY;QAC3B,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC,CAAC;YAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,QAAa;;QACpC,MAAM,EAAC,GAAG,EAAC,GAAG,QAAQ,CAAC;QAEvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,IAAI,EAAE;YACtB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;SACnD;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAa;QAClC,MAAM,EAAC,GAAG,EAAC,GAAG,QAAQ,CAAC;QAEvB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACjC,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAEzB,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,sBAAK,CAAC,UAAU,CAAC;YACf,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;YAC3C,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;YACvC,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;YACnD,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;SAC1C,CAAC,CAAC;IACL,CAAC;CACF;AA5CD,kBA4CC","sourcesContent":["import {CliCore} from \"@tsed/cli-core\";\nimport chalk from \"chalk\";\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport alias from \"module-alias\";\n\nexport class Cli extends CliCore {\n static checkPackage(pkg: any) {\n if (!pkg) {\n console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));\n process.exit(1);\n }\n }\n\n static checkName(name: string) {\n if (!name) {\n console.log(chalk.red(`settings.name is required. Add the name of your CLI.`));\n process.exit(1);\n }\n }\n\n static checkPrecondition(settings: any) {\n const {pkg} = settings;\n\n this.checkPackage(pkg);\n this.checkName(pkg.name);\n\n if (pkg?.engines?.node) {\n this.checkNodeVersion(pkg.engines.node, pkg.name);\n }\n }\n\n static async bootstrap(settings: any) {\n const {pkg} = settings;\n\n this.checkPrecondition(settings);\n this.createAliases();\n this.updateNotifier(pkg);\n\n return super.bootstrap(settings, Cli);\n }\n\n static createAliases() {\n alias.addAliases({\n \"@tsed/core\": require.resolve(\"@tsed/core\"),\n \"@tsed/di\": require.resolve(\"@tsed/di\"),\n \"@tsed/cli-core\": require.resolve(\"@tsed/cli-core\"),\n \"@tsed/cli\": require.resolve(\"@tsed/cli\")\n });\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ const interfaces_1 = require("../interfaces");
|
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
Cli_1.Cli.bootstrap({
|
|
10
10
|
name: "tsed",
|
|
11
|
-
pkg:
|
|
11
|
+
pkg: constants_1.PKG,
|
|
12
12
|
templateDir: constants_1.TEMPLATE_DIR,
|
|
13
13
|
plugins: true,
|
|
14
14
|
commands: commands_1.default,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsed.js","sourceRoot":"","sources":["../../../src/bin/tsed.ts"],"names":[],"mappings":";;;;AACA,gCAA2B;AAC3B,mEAAmC;AACnC,8CAAwE;AACxE,4CAA+C;AAE/C,SAAG,CAAC,SAAS,CAAC;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,eAAG;IACR,WAAW,EAAE,wBAAY;IACzB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAR,kBAAQ;IACR,yBAAyB;QACvB,OAAO;YACL,UAAU,EAAE,8BAAiB,CAAC,OAAO;YACrC,YAAY,EAAE,mCAAsB,CAAC,OAAO;SAC7C,CAAC;IACJ,CAAC;IACD,OAAO,EAAE;QACP,iBAAiB,EAAE,IAAI;KACxB;CACF,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport {Cli} from \"../Cli\";\nimport commands from \"../commands\";\nimport {ArchitectureConvention, ProjectConvention} from \"../interfaces\";\nimport {PKG, TEMPLATE_DIR} from \"../constants\";\n\nCli.bootstrap({\n name: \"tsed\",\n pkg: PKG,\n templateDir: TEMPLATE_DIR,\n plugins: true,\n commands,\n defaultProjectPreferences() {\n return {\n convention: ProjectConvention.DEFAULT,\n architecture: ArchitectureConvention.DEFAULT\n };\n },\n project: {\n reinstallAfterRun: true\n }\n}).catch(console.error);\n"]}
|
|
File without changes
|
|
@@ -0,0 +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,OAAO,CAAC,cAAmB;QACzB,OAAO;YACL;gBACE,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,oBAAoB;gBAC7B,OAAO,EAAE,cAAc,CAAC,IAAI;gBAC5B,IAAI,EAAE,CAAC,cAAc,CAAC,IAAI;gBAC1B,MAAM,EAAE,KAAK,EAAE,KAAU,EAAE,OAAe,EAAE,EAAE;oBAC5C,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBAChD,CAAC;aACF;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAkB;QAC5B,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEtD,OAAO;YACL;gBACE,KAAK,EAAE,iBAAiB;gBACxB,IAAI,EAAE,IAAA,yBAAc,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAU,CAAC,EAAE,EAAC,GAAG,GAAG,EAAE,UAAU,EAAE,KAAK,EAAC,CAAC;aAC9F;YACD;gBACE,KAAK,EAAE,cAAc;gBACrB,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE;aAC1C;YACD;gBACE,KAAK,EAAE,8BAA8B;gBACrC,IAAI,EAAE,IAAA,yBAAc,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,EAAC,GAAG,GAAG,EAAE,UAAU,EAAE,KAAK,EAAC,CAAC;aACrG;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAtCC;IADC,IAAA,WAAM,EAAC,qBAAU,CAAC;sCACP,qBAAU;0CAAC;AAGvB;IADC,IAAA,WAAM,EAAC,6BAAkB,CAAC;sCACd,6BAAkB;2CAAC;AALrB,MAAM;IAVlB,IAAA,kBAAO,EAAC;QACP,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,uCAAuC;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, \"latest\");\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"]}
|
|
@@ -7,13 +7,13 @@ const cli_core_1 = require("@tsed/cli-core");
|
|
|
7
7
|
const change_case_1 = require("change-case");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const globby_1 = tslib_1.__importDefault(require("globby"));
|
|
10
|
+
const normalize_path_1 = tslib_1.__importDefault(require("normalize-path"));
|
|
10
11
|
const ClassNamePipe_1 = require("../../pipes/ClassNamePipe");
|
|
11
12
|
const OutputFilePathPipe_1 = require("../../pipes/OutputFilePathPipe");
|
|
12
13
|
const RoutePipe_1 = require("../../pipes/RoutePipe");
|
|
13
14
|
const ProvidersInfoService_1 = require("../../services/ProvidersInfoService");
|
|
14
15
|
const ProviderTypes_1 = require("./ProviderTypes");
|
|
15
16
|
const ProjectConvention_1 = require("../../interfaces/ProjectConvention");
|
|
16
|
-
const normalizePath = require("normalize-path");
|
|
17
17
|
const DECORATOR_TYPES = [
|
|
18
18
|
{ name: "Class decorator", value: "class" },
|
|
19
19
|
{ name: "Ts.ED middleware and its decorator", value: "middleware" },
|
|
@@ -139,12 +139,12 @@ let GenerateCmd = GenerateCmd_1 = class GenerateCmd {
|
|
|
139
139
|
route: ctx.route ? this.routePipe.transform(ctx.route) : "",
|
|
140
140
|
symbolName,
|
|
141
141
|
symbolParamName,
|
|
142
|
-
symbolPath:
|
|
142
|
+
symbolPath: (0, normalize_path_1.default)(this.outputFilePathPipe.transform({
|
|
143
143
|
name,
|
|
144
144
|
type,
|
|
145
145
|
subDir: ctx.directory
|
|
146
146
|
})),
|
|
147
|
-
symbolPathBasename:
|
|
147
|
+
symbolPathBasename: (0, normalize_path_1.default)(this.classNamePipe.transform({ name, type })),
|
|
148
148
|
express: ctx.platform === "express",
|
|
149
149
|
koa: ctx.platform === "koa",
|
|
150
150
|
platformSymbol: ctx.platform && (0, change_case_1.pascalCase)(`Platform ${ctx.platform}`),
|
|
@@ -0,0 +1 @@
|
|
|
1
|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ADC,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 normalizePath from \"normalize-path\";\nimport {ClassNamePipe} from \"../../pipes/ClassNamePipe\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {RoutePipe} from \"../../pipes/RoutePipe\";\nimport {ProvidersInfoService} from \"../../services/ProvidersInfoService\";\nimport {PROVIDER_TYPES} from \"./ProviderTypes\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\n\nexport interface GenerateCmdContext extends CliDefaultOptions {\n type: string;\n name: string;\n route: string;\n directory: string;\n platform: string;\n templateType: string;\n symbolName: string;\n symbolPath: string;\n symbolPathBasename: string;\n convention: ProjectConvention;\n}\n\nconst DECORATOR_TYPES = [\n {name: \"Class decorator\", value: \"class\"},\n {name: \"Ts.ED middleware and its decorator\", value: \"middleware\"},\n {name: \"Ts.ED endpoint decorator\", value: \"endpoint\"},\n {name: \"Ts.ED property decorator\", value: \"prop\"},\n {name: \"Ts.ED parameter decorator\", value: \"param\"},\n {name: \"Vanilla Method decorator\", value: \"method\"},\n {name: \"Vanilla Property decorator\", value: \"property\"},\n {name: \"Vanilla Parameter decorator\", value: \"parameter\"},\n {name: \"Generic decorator\", value: \"generic\"}\n];\n\nconst searchFactory = (list: any) => {\n return async (state: any, keyword: string) => {\n if (keyword) {\n return list.filter((item: any) => item.name.toLowerCase().includes(keyword.toLowerCase()));\n }\n\n return list;\n };\n};\n\n@Command({\n name: \"generate\",\n alias: \"g\",\n description: \"Generate a new provider class\",\n args: {\n type: {\n description: \"Type of the provider (Injectable, Controller, Pipe, etc...)\",\n type: String\n },\n name: {\n description: \"Name of the class\",\n type: String\n }\n }\n})\nexport class GenerateCmd implements CommandProvider {\n @Inject()\n classNamePipe: ClassNamePipe;\n\n @Inject()\n outputFilePathPipe: OutputFilePathPipe;\n\n @Inject()\n routePipe: RoutePipe;\n\n @Inject()\n srcRenderService: SrcRendererService;\n\n @Inject()\n projectPackageJson: ProjectPackageJson;\n\n constructor(private providersList: ProvidersInfoService) {\n PROVIDER_TYPES.forEach((info) => {\n this.providersList.add(\n {\n ...info\n },\n GenerateCmd\n );\n });\n }\n\n $prompt(initialOptions: Partial<GenerateCmdContext>) {\n const getName = (state: any) =>\n initialOptions.name || pascalCase(state.name || initialOptions.name || state.type || initialOptions.type);\n\n const proposedProviders = this.providersList.findProviders(initialOptions.type);\n\n return [\n {\n type: \"autocomplete\",\n name: \"type\",\n message: \"Which type of provider?\",\n default: initialOptions.type,\n when: () => proposedProviders.length > 1,\n source: searchFactory(proposedProviders)\n },\n {\n type: \"input\",\n name: \"name\",\n message: \"Which name?\",\n default: getName,\n when: !initialOptions.name\n },\n {\n message: \"Which platform?\",\n type: \"list\",\n name: \"platform\",\n when(state: any) {\n return [\"server\"].includes(state.type || initialOptions.type);\n },\n choices: [\n {\n name: \"Express.js\",\n checked: true,\n value: \"express\"\n },\n {\n name: \"Koa.js\",\n checked: false,\n value: \"koa\"\n }\n ]\n },\n {\n type: \"input\",\n name: \"route\",\n message: \"Which route?\",\n when(state: any) {\n return [\"controller\", \"server\"].includes(state.type || initialOptions.type);\n },\n default: (state: GenerateCmdContext) => {\n return state.type === \"server\" ? \"/rest\" : this.routePipe.transform(getName(state));\n }\n },\n {\n type: \"list\",\n name: \"directory\",\n message: \"Which directory?\",\n when(state: any) {\n return [\"controller\"].includes(state.type || initialOptions.type);\n },\n choices: this.getDirectories(\"controllers\")\n },\n {\n type: \"autocomplete\",\n name: \"templateType\",\n message: (state: any) => `Which type of ${state.type || initialOptions.type}?`,\n when(state: any) {\n return [\"decorator\"].includes(state.type || initialOptions.type);\n },\n source: searchFactory(DECORATOR_TYPES)\n },\n {\n type: \"list\",\n name: \"middlewarePosition\",\n message: () => `The middleware should be called:`,\n choices: [\n {name: \"Before the endpoint\", value: \"before\"},\n {name: \"After the endpoint\", value: \"after\"}\n ],\n when(state: any) {\n return [\"decorator\"].includes(state.type || initialOptions.type) && [\"middleware\"].includes(state.templateType);\n }\n }\n ];\n }\n\n $mapContext(ctx: Partial<GenerateCmdContext>): GenerateCmdContext {\n const {name = \"\"} = ctx;\n let {type = \"\"} = ctx;\n type = type.toLowerCase();\n\n if (ctx.name === \"prisma\" && ctx.name) {\n type = \"prisma.service\";\n }\n\n const symbolName = this.classNamePipe.transform({name, type, format: ProjectConvention.DEFAULT});\n const symbolParamName = paramCase(symbolName);\n\n return {\n ...ctx,\n type,\n route: ctx.route ? this.routePipe.transform(ctx.route) : \"\",\n symbolName,\n symbolParamName,\n symbolPath: normalizePath(\n this.outputFilePathPipe.transform({\n name,\n type,\n subDir: ctx.directory\n })\n ),\n symbolPathBasename: normalizePath(this.classNamePipe.transform({name, type})),\n express: ctx.platform === \"express\",\n koa: ctx.platform === \"koa\",\n platformSymbol: ctx.platform && pascalCase(`Platform ${ctx.platform}`),\n indexControllerPath:\n this.projectPackageJson.preferences.convention === ProjectConvention.ANGULAR\n ? \"./controllers/pages/index.controller\"\n : \"./controllers/pages/IndexController\"\n } as GenerateCmdContext;\n }\n\n async $exec(ctx: GenerateCmdContext) {\n const {symbolPath} = ctx;\n\n if (this.providersList.isMyProvider(ctx.type, GenerateCmd)) {\n const type = [ctx.type, ctx.templateType].filter(Boolean).join(\".\");\n\n const template = `generate/${type}.hbs`;\n\n return [\n {\n title: `Generate ${ctx.type} file to '${symbolPath}.ts'`,\n task: () =>\n this.srcRenderService.render(template, ctx, {\n output: `${symbolPath}.ts`\n })\n },\n {\n title: `Update bin/index`,\n skip() {\n return ctx.type !== \"command\";\n },\n task: () => {\n return this.srcRenderService.update(\"bin/index.ts\", [\n {\n type: \"import\",\n content: `import {${ctx.symbolName}} from \"./${basename(symbolPath)}\";`\n },\n {\n type: \"insert-after\",\n pattern: /commands: \\[/,\n content: ` ${ctx.symbolName}`\n }\n ]);\n }\n }\n ];\n }\n\n return [];\n }\n\n getDirectories(dir: string) {\n const directories = globby.sync(\"**/*\", {\n cwd: join(this.srcRenderService.rootDir, dir),\n ignore: [\"__*\"]\n });\n\n const set = new Set(\n directories.map((dir) => {\n return dirname(dir);\n })\n );\n\n set.delete(\".\");\n\n return [...set];\n }\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProviderTypes.js","sourceRoot":"","sources":["../../../../src/commands/generate/ProviderTypes.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B;QACE,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,2BAA2B;KACnC;IACD;QACE,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,2BAA2B;KACnC;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,wBAAwB;KAChC;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,sBAAsB;KAC9B;IACD;QACE,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,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,EAAE,wBAAwB;KAChC;IACD;QACE,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,2BAA2B;KACnC;CACF,CAAC","sourcesContent":["export const PROVIDER_TYPES = [\n {\n name: \"Controller\",\n value: \"controller\",\n model: \"{{symbolName}}.controller\"\n },\n {\n name: \"Middleware\",\n value: \"middleware\",\n model: \"{{symbolName}}.middleware\"\n },\n {\n name: \"Service\",\n value: \"service\",\n baseDir: \"services\",\n model: \"{{symbolName}}.service\"\n },\n {\n name: \"Model\",\n value: \"model\",\n model: \"{{symbolName}}.model\"\n },\n {\n name: \"Interface\",\n value: \"interface\",\n model: \"{{symbolName}}.interface?\"\n },\n {\n name: \"Decorator\",\n value: \"decorator\",\n model: \"{{symbolName}}.decorator?\"\n },\n {\n name: \"Module\",\n value: \"module\",\n model: \"{{symbolName}}.module\"\n },\n {\n name: \"Pipe\",\n value: \"pipe\",\n baseDir: \"pipes\",\n model: \"{{symbolName}}.pipe\"\n },\n {\n name: \"Interceptor\",\n value: \"interceptor\",\n baseDir: \"interceptors\",\n model: \"{{symbolName}}.interceptor\"\n },\n {\n name: \"Async Factory\",\n value: \"async.factory\",\n baseDir: \"services\",\n model: \"{{symbolName}}.factory?\"\n },\n {\n name: \"Factory\",\n value: \"factory\",\n baseDir: \"services\",\n model: \"{{symbolName}}.factory?\"\n },\n {\n name: \"Value\",\n value: \"value\",\n baseDir: \"services\",\n model: \"{{symbolName}}.value?\"\n },\n {\n name: \"Server\",\n value: \"server\",\n model: \"{{symbolName}}.server\"\n },\n {\n name: \"Exception Filter\",\n value: \"exception-filter\",\n baseDir: \"filters\",\n model: \"{{symbolName}}.exception-filter\"\n },\n {\n name: \"Response Filter\",\n value: \"response-filter\",\n baseDir: \"filters\",\n model: \"{{symbolName}}.response-filter\"\n },\n {\n name: \"Command\",\n value: \"command\",\n baseDir: \"bin\",\n model: \"{{symbolName}}.command\"\n },\n {\n name: \"Prisma Service\",\n value: \"prisma.service\",\n baseDir: \"services\",\n model: \"{{symbolName}}.service\"\n },\n {\n name: \"Repository\",\n value: \"repository\",\n baseDir: \"services\",\n model: \"{{symbolName}}.repository\"\n }\n];\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":";;AAAA,4CAAuC;AACvC,wDAAmD;AACnD,kDAA6C;AAC7C,yCAAoC;AACpC,yCAAoC;AAEpC,kBAAe,CAAC,eAAM,EAAE,iBAAO,EAAE,yBAAW,EAAE,qBAAS,EAAE,eAAM,CAAC,CAAC","sourcesContent":["import {InitCmd} from \"./init/InitCmd\";\nimport {GenerateCmd} from \"./generate/GenerateCmd\";\nimport {UpdateCmd} from \"./update/UpdateCmd\";\nimport {AddCmd} from \"./add/AddCmd\";\nimport {RunCmd} from \"./run/RunCmd\";\n\nexport default [AddCmd, InitCmd, GenerateCmd, UpdateCmd, RunCmd];\n"]}
|
|
File without changes
|
|
@@ -0,0 +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,EAAE,CAAC;QAC/B,IAAI,QAAQ,IAAI,cAAc,CAAC,YAAY,EAAE;YAC3C,MAAM,gBAAgB,GAAG,IAAA,cAAO,EAAC,QAAQ,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;YACxE,MAAM,gBAAgB,GAAG,gEAAa,gBAAgB,GAAC,CAAC;YACxD,MAAM,cAAc,GAAG,IAAA,4BAAiB,EAAC,gBAAg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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"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RunCmd.js","sourceRoot":"","sources":["../../../../src/commands/run/RunCmd.ts"],"names":[],"mappings":";;;;AAAA,6CAAuH;AACvH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AC;YACzE,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;SACvC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAtCC;IADC,IAAA,WAAM,GAAE;sCACL,gBAAK;kCAAC;AAGV;IADC,IAAA,WAAM,GAAE;sCACW,6BAAkB;kDAAC;AAGvC;IADC,IAAA,WAAM,GAAE;sCACE,uBAAY;yCAAC;AARb,MAAM;IAnBlB,IAAA,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"]}
|
|
File without changes
|
|
@@ -0,0 +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,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AAC;SACN;QAED,OAAO,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;IACxG,CAAC;CACF,CAAA;AAzGC;IADC,IAAA,iBAAM,GAAE;sCACU,4BAAiB;oDAAC;AAGrC;IADC,IAAA,iBAAM,GAAE;sCACO,6BAAkB;iDAAC;AAGnC;IADC,IAAA,yBAAc,GAAE;;6CACU;AARhB,SAAS;IANrB,IAAA,kBAAO,EAAC;QACP,IAAI,EAAE,QAAQ;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.cliPackage.version;\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEMPLATE_DIR = exports.IGNORE_TAGS = exports.IGNORE_VERSIONS = exports.DEFAULT_TSED_TAGS = exports.MINIMAL_TSED_VERSION = exports.PKG = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const read_pkg_up_1 = tslib_1.__importDefault(require("read-pkg-up"));
|
|
7
|
+
const filedirname_1 = tslib_1.__importDefault(require("filedirname"));
|
|
8
|
+
const [, dir] = (0, filedirname_1.default)();
|
|
9
|
+
const { path, packageJson } = read_pkg_up_1.default.sync({
|
|
10
|
+
cwd: dir
|
|
11
|
+
});
|
|
12
|
+
exports.PKG = packageJson;
|
|
13
|
+
exports.MINIMAL_TSED_VERSION = "6";
|
|
14
|
+
exports.DEFAULT_TSED_TAGS = "latest";
|
|
15
|
+
exports.IGNORE_VERSIONS = ["6.0.0"];
|
|
16
|
+
exports.IGNORE_TAGS = false; // /alpha|beta/
|
|
17
|
+
exports.TEMPLATE_DIR = (0, path_1.join)((0, path_1.dirname)(path), "templates");
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;;AAAA,+BAAmC;AACnC,sEAAoC;AACpC,sEAAsC;AAEtC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,IAAA,qBAAW,GAAE,CAAC;AAE9B,MAAM,EAAC,IAAI,EAAE,WAAW,EAAC,GAAG,qBAAS,CAAC,IAAI,CAAC;IACzC,GAAG,EAAE,GAAG;CACT,CAAE,CAAC;AAES,QAAA,GAAG,GAAG,WAAW,CAAC;AAClB,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,WAAI,EAAC,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import {dirname, join} from \"path\";\nimport readPkgUp from \"read-pkg-up\";\nimport filedirname from \"filedirname\";\n\nconst [, dir] = filedirname();\n\nconst {path, packageJson} = readPkgUp.sync({\n cwd: dir\n})!;\n\nexport const PKG = packageJson;\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 = join(dirname(path), \"templates\");\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,kEAAwC;AACxC,0EAAgD;AAChD,sEAA4C;AAC5C,uDAA6B;AAC7B,0EAAgD;AAChD,8DAAoC;AACpC,kDAAwB;AACxB,sDAA4B","sourcesContent":["export * from \"./commands/add/AddCmd\";\nexport * from \"./commands/init/InitCmd\";\nexport * from \"./commands/generate/GenerateCmd\";\nexport * from \"./commands/update/UpdateCmd\";\nexport * from \"./interfaces\";\nexport * from \"./services/ProvidersInfoService\";\nexport * from \"./services/Features\";\nexport * from \"./pipes\";\nexport * from \"./constants\";\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArchitectureConvention.js","sourceRoot":"","sources":["../../../src/interfaces/ArchitectureConvention.ts"],"names":[],"mappings":";;;AAAA,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,6CAAmB,CAAA;IACnB,6CAAmB,CAAA;AACrB,CAAC,EAHW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAGjC","sourcesContent":["export enum ArchitectureConvention {\n DEFAULT = \"default\",\n FEATURE = \"feature\"\n}\n\ndeclare global {\n namespace TsED {\n interface ProjectPreferences {\n architecture: ArchitectureConvention;\n }\n }\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectConvention.js","sourceRoot":"","sources":["../../../src/interfaces/ProjectConvention.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,wCAAmB,CAAA;AACrB,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B","sourcesContent":["export enum ProjectConvention {\n DEFAULT = \"default\",\n ANGULAR = \"angular\"\n}\n\ndeclare global {\n namespace TsED {\n interface ProjectPreferences {\n convention: ProjectConvention;\n }\n }\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,mEAAyC","sourcesContent":["export * from \"./ProjectConvention\";\nexport * from \"./ArchitectureConvention\";\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|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AAC,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"]}
|
|
File without changes
|
|
@@ -0,0 +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,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"]}
|
|
File without changes
|
|
@@ -0,0 +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,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"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pipes/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,+DAAqC;AACrC,sDAA4B","sourcesContent":["export * from \"./ClassNamePipe\";\nexport * from \"./OutputFilePathPipe\";\nexport * from \"./RoutePipe\";\n"]}
|
|
File without changes
|
|
@@ -0,0 +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,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,EAAC,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,iBAAiB;YACvB,YAAY,EAAE;gBACZ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AAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;gBAC3B,OAAO,EAAE,sBAAsB,CAAC,UAAU,CAAC;aAC5C;YACD;gBACE,OAAO,EAAE,+BAA+B;gBACxC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC;gBAC1B,OAAO,EAAE,qBAAqB,CAAC,UAAU,CAAC;aAC3C;YACD;gBACE,OAAO,EAAE,2BAA2B;gBACpC,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC;gBAC1B,OAAO,EAAE,0BAA0B;aACpC;YACD;gBACE,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;gBAC3B,OAAO,EAAE,sBAAsB;aAChC;YACD;gBACE,OAAO,EAAE,kCAAkC;gBAC3C,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;gBACxB,IAAI,EAAE,OAAO;aACd;YACD;gBACE,OAAO,EAAE,kCAAkC;gBAC3C,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;gBACxB,IAAI,EAAE,OAAO;aACd;YACD;gBACE,OAAO,EAAE,6BAA6B;gBACtC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,qBAAqB;aAC/B;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {CliPackageJson, Inject, registerProvider} from \"@tsed/cli-core\";\nimport {getValue} from \"@tsed/core\";\nimport {ProjectConvention, ArchitectureConvention} from \"../interfaces\";\n\nexport interface FeatureValue {\n type: string;\n dependencies?: {[key: string]: string | undefined};\n devDependencies?: {[key: string]: string | undefined};\n}\n\nexport interface Feature {\n name: string;\n value: FeatureValue;\n}\n\nexport type Features = Feature[];\n\nexport function Features() {\n return Inject(Features);\n}\n\nexport function hasFeature(feature: string) {\n return (ctx: any): boolean => !!ctx.features.find((item: any) => item.type === feature);\n}\n\nexport function hasValue(expression: string, value: any) {\n return (ctx: any) => getValue(expression, ctx) === value;\n}\n\nexport function isPlatform(...types: string[]) {\n return (ctx: any) => [types].includes(ctx.platform);\n}\n\nexport const FEATURES_TYPEORM_CONNECTION_TYPES = [\n {\n name: \"MySQL\",\n value: {\n type: \"typeorm:mysql\",\n dependencies: {\n 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 dependencies: {\n \"@tsed/typegraphql\": \"{{tsedVersion}}\"\n },\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"]}
|
|
File without changes
|
|
@@ -0,0 +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,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/lib/esm/Cli.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CliCore } from "@tsed/cli-core";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import alias from "module-alias";
|
|
6
|
+
export class Cli extends CliCore {
|
|
7
|
+
static checkPackage(pkg) {
|
|
8
|
+
if (!pkg) {
|
|
9
|
+
console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
static checkName(name) {
|
|
14
|
+
if (!name) {
|
|
15
|
+
console.log(chalk.red(`settings.name is required. Add the name of your CLI.`));
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
static checkPrecondition(settings) {
|
|
20
|
+
var _a;
|
|
21
|
+
const { pkg } = settings;
|
|
22
|
+
this.checkPackage(pkg);
|
|
23
|
+
this.checkName(pkg.name);
|
|
24
|
+
if ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.engines) === null || _a === void 0 ? void 0 : _a.node) {
|
|
25
|
+
this.checkNodeVersion(pkg.engines.node, pkg.name);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
static async bootstrap(settings) {
|
|
29
|
+
const { pkg } = settings;
|
|
30
|
+
this.checkPrecondition(settings);
|
|
31
|
+
this.createAliases();
|
|
32
|
+
this.updateNotifier(pkg);
|
|
33
|
+
return super.bootstrap(settings, Cli);
|
|
34
|
+
}
|
|
35
|
+
static createAliases() {
|
|
36
|
+
alias.addAliases({
|
|
37
|
+
"@tsed/core": require.resolve("@tsed/core"),
|
|
38
|
+
"@tsed/di": require.resolve("@tsed/di"),
|
|
39
|
+
"@tsed/cli-core": require.resolve("@tsed/cli-core"),
|
|
40
|
+
"@tsed/cli": require.resolve("@tsed/cli")
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=Cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../src/Cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,6DAA6D;AAC7D,aAAa;AACb,OAAO,KAAK,MAAM,cAAc,CAAC;AAEjC,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC9B,MAAM,CAAC,YAAY,CAAC,GAAQ;QAC1B,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,4FAA4F,CAAC,CAAC,CAAC;YACrH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,IAAY;QAC3B,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC,CAAC;YAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,QAAa;;QACpC,MAAM,EAAC,GAAG,EAAC,GAAG,QAAQ,CAAC;QAEvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,IAAI,EAAE;YACtB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;SACnD;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAa;QAClC,MAAM,EAAC,GAAG,EAAC,GAAG,QAAQ,CAAC;QAEvB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACjC,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAEzB,OAAO,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,KAAK,CAAC,UAAU,CAAC;YACf,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;YAC3C,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;YACvC,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;YACnD,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;SAC1C,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import {CliCore} from \"@tsed/cli-core\";\nimport chalk from \"chalk\";\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport alias from \"module-alias\";\n\nexport class Cli extends CliCore {\n static checkPackage(pkg: any) {\n if (!pkg) {\n console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));\n process.exit(1);\n }\n }\n\n static checkName(name: string) {\n if (!name) {\n console.log(chalk.red(`settings.name is required. Add the name of your CLI.`));\n process.exit(1);\n }\n }\n\n static checkPrecondition(settings: any) {\n const {pkg} = settings;\n\n this.checkPackage(pkg);\n this.checkName(pkg.name);\n\n if (pkg?.engines?.node) {\n this.checkNodeVersion(pkg.engines.node, pkg.name);\n }\n }\n\n static async bootstrap(settings: any) {\n const {pkg} = settings;\n\n this.checkPrecondition(settings);\n this.createAliases();\n this.updateNotifier(pkg);\n\n return super.bootstrap(settings, Cli);\n }\n\n static createAliases() {\n alias.addAliases({\n \"@tsed/core\": require.resolve(\"@tsed/core\"),\n \"@tsed/di\": require.resolve(\"@tsed/di\"),\n \"@tsed/cli-core\": require.resolve(\"@tsed/cli-core\"),\n \"@tsed/cli\": require.resolve(\"@tsed/cli\")\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Cli } from "../Cli.js";
|
|
3
|
+
import commands from "../commands.js";
|
|
4
|
+
import { ArchitectureConvention, ProjectConvention } from "../interfaces.js";
|
|
5
|
+
import { PKG, TEMPLATE_DIR } from "../constants.js";
|
|
6
|
+
Cli.bootstrap({
|
|
7
|
+
name: "tsed",
|
|
8
|
+
pkg: PKG,
|
|
9
|
+
templateDir: TEMPLATE_DIR,
|
|
10
|
+
plugins: true,
|
|
11
|
+
commands,
|
|
12
|
+
defaultProjectPreferences() {
|
|
13
|
+
return {
|
|
14
|
+
convention: ProjectConvention.DEFAULT,
|
|
15
|
+
architecture: ArchitectureConvention.DEFAULT
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
project: {
|
|
19
|
+
reinstallAfterRun: true
|
|
20
|
+
}
|
|
21
|
+
}).catch(console.error);
|
|
22
|
+
//# sourceMappingURL=tsed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsed.js","sourceRoot":"","sources":["../../../src/bin/tsed.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAC3B,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,sBAAsB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACxE,OAAO,EAAC,GAAG,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAE/C,GAAG,CAAC,SAAS,CAAC;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,GAAG;IACR,WAAW,EAAE,YAAY;IACzB,OAAO,EAAE,IAAI;IACb,QAAQ;IACR,yBAAyB;QACvB,OAAO;YACL,UAAU,EAAE,iBAAiB,CAAC,OAAO;YACrC,YAAY,EAAE,sBAAsB,CAAC,OAAO;SAC7C,CAAC;IACJ,CAAC;IACD,OAAO,EAAE;QACP,iBAAiB,EAAE,IAAI;KACxB;CACF,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport {Cli} from \"../Cli\";\nimport commands from \"../commands\";\nimport {ArchitectureConvention, ProjectConvention} from \"../interfaces\";\nimport {PKG, TEMPLATE_DIR} from \"../constants\";\n\nCli.bootstrap({\n name: \"tsed\",\n pkg: PKG,\n templateDir: TEMPLATE_DIR,\n plugins: true,\n commands,\n defaultProjectPreferences() {\n return {\n convention: ProjectConvention.DEFAULT,\n architecture: ArchitectureConvention.DEFAULT\n };\n },\n project: {\n reinstallAfterRun: true\n }\n}).catch(console.error);\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Inject } from "@tsed/di";
|
|
3
|
+
import { CliPlugins, Command, createSubTasks, ProjectPackageJson } from "@tsed/cli-core";
|
|
4
|
+
let AddCmd = class AddCmd {
|
|
5
|
+
$prompt(initialOptions) {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
type: "autocomplete",
|
|
9
|
+
name: "name",
|
|
10
|
+
message: "Which cli plugin ?",
|
|
11
|
+
default: initialOptions.name,
|
|
12
|
+
when: !initialOptions.name,
|
|
13
|
+
source: async (state, keyword) => {
|
|
14
|
+
return this.cliPlugins.searchPlugins(keyword);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
async $exec(ctx) {
|
|
20
|
+
this.packageJson.addDevDependency(ctx.name, "latest");
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
title: "Install plugins",
|
|
24
|
+
task: createSubTasks(() => this.packageJson.install(ctx), { ...ctx, concurrent: false })
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
title: "Load plugins",
|
|
28
|
+
task: () => this.cliPlugins.loadPlugins()
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
title: "Install plugins dependencies",
|
|
32
|
+
task: createSubTasks(() => this.cliPlugins.addPluginsDependencies(ctx), { ...ctx, concurrent: false })
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
__decorate([
|
|
38
|
+
Inject(CliPlugins),
|
|
39
|
+
__metadata("design:type", CliPlugins)
|
|
40
|
+
], AddCmd.prototype, "cliPlugins", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
Inject(ProjectPackageJson),
|
|
43
|
+
__metadata("design:type", ProjectPackageJson)
|
|
44
|
+
], AddCmd.prototype, "packageJson", void 0);
|
|
45
|
+
AddCmd = __decorate([
|
|
46
|
+
Command({
|
|
47
|
+
name: "add",
|
|
48
|
+
description: "Add cli plugin to the current project",
|
|
49
|
+
args: {
|
|
50
|
+
name: {
|
|
51
|
+
description: "Npm package name of the cli plugin",
|
|
52
|
+
type: String
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
], AddCmd);
|
|
57
|
+
export { AddCmd };
|
|
58
|
+
//# sourceMappingURL=AddCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddCmd.js","sourceRoot":"","sources":["../../../../src/commands/add/AddCmd.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAoB,UAAU,EAAE,OAAO,EAAmB,cAAc,EAAE,kBA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CAAC;AALrB,MAAM;IAVlB,OAAO,CAAC;QACP,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,uCAAuC;QACpD,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,WAAW,EAAE,oCAAoC;gBACjD,IAAI,EAAE,MAAM;aACb;SACF;KACF,CAAC;GACW,MAAM,CAwClB;SAxCY,MAAM","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, \"latest\");\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"]}
|