@tsed/cli 3.26.0-beta.1 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/commands/init/InitCmd.js +22 -11
- package/lib/cjs/commands/init/InitCmd.js.map +1 -1
- package/lib/cjs/commands/init/config/InitFileSchema.js +18 -14
- package/lib/cjs/commands/init/config/InitFileSchema.js.map +1 -1
- package/lib/esm/commands/init/InitCmd.js +23 -12
- package/lib/esm/commands/init/InitCmd.js.map +1 -1
- package/lib/esm/commands/init/config/InitFileSchema.js +18 -14
- package/lib/esm/commands/init/config/InitFileSchema.js.map +1 -1
- package/lib/types/commands/init/config/InitFileSchema.d.ts +16 -12
- package/package.json +6 -7
- package/readme.md +92 -1
- package/lib/cjs/services/Features.js +0 -513
- package/lib/cjs/services/Features.js.map +0 -1
- package/lib/esm/services/Features.js +0 -508
- package/lib/esm/services/Features.js.map +0 -1
- package/lib/types/services/Features.d.ts +0 -394
|
@@ -13,6 +13,7 @@ const InitFileSchema_1 = require("./config/InitFileSchema");
|
|
|
13
13
|
const mapToContext_1 = require("./mappers/mapToContext");
|
|
14
14
|
const FeaturesPrompt_1 = require("./config/FeaturesPrompt");
|
|
15
15
|
const getFeaturesPrompt_1 = require("./prompts/getFeaturesPrompt");
|
|
16
|
+
const interfaces_1 = require("../../interfaces");
|
|
16
17
|
let InitCmd = class InitCmd {
|
|
17
18
|
configuration;
|
|
18
19
|
cliPlugins;
|
|
@@ -248,7 +249,6 @@ let InitCmd = class InitCmd {
|
|
|
248
249
|
}
|
|
249
250
|
}
|
|
250
251
|
addFeatures(ctx) {
|
|
251
|
-
console.log(ctx);
|
|
252
252
|
ctx.features.forEach((value) => {
|
|
253
253
|
const feature = FeaturesPrompt_1.FeaturesMap[value];
|
|
254
254
|
if (feature.dependencies) {
|
|
@@ -365,40 +365,51 @@ InitCmd = tslib_1.__decorate([
|
|
|
365
365
|
}
|
|
366
366
|
},
|
|
367
367
|
options: {
|
|
368
|
+
"-n, --project-name <projectName>": {
|
|
369
|
+
type: String,
|
|
370
|
+
defaultValue: "",
|
|
371
|
+
description: "Set the project name. By default, the project is the same as the name directory."
|
|
372
|
+
},
|
|
368
373
|
"-a, --arch <architecture>": {
|
|
369
374
|
type: String,
|
|
370
375
|
defaultValue: ArchitectureConvention_1.ArchitectureConvention.DEFAULT,
|
|
371
|
-
description: `Set the default architecture
|
|
376
|
+
description: `Set the default architecture convention (${ArchitectureConvention_1.ArchitectureConvention.DEFAULT} or ${ArchitectureConvention_1.ArchitectureConvention.FEATURE})`
|
|
372
377
|
},
|
|
373
378
|
"-c, --convention <convention>": {
|
|
374
379
|
type: String,
|
|
375
380
|
defaultValue: ProjectConvention_1.ProjectConvention.DEFAULT,
|
|
376
|
-
description: `Set the default
|
|
381
|
+
description: `Set the default project convention (${ArchitectureConvention_1.ArchitectureConvention.DEFAULT} or ${ArchitectureConvention_1.ArchitectureConvention.FEATURE})`
|
|
377
382
|
},
|
|
378
383
|
"-p, --platform <platform>": {
|
|
379
384
|
type: String,
|
|
380
|
-
defaultValue:
|
|
385
|
+
defaultValue: interfaces_1.PlatformType.EXPRESS,
|
|
381
386
|
description: "Set the default platform for Ts.ED (express or koa)"
|
|
382
387
|
},
|
|
383
|
-
"-n, --project-name <projectName>": {
|
|
384
|
-
type: String,
|
|
385
|
-
defaultValue: "",
|
|
386
|
-
description: "Set the project name. By default, the project is the same as the name directory."
|
|
387
|
-
},
|
|
388
388
|
"--features <features...>": {
|
|
389
389
|
type: Array,
|
|
390
390
|
itemType: String,
|
|
391
391
|
defaultValue: [],
|
|
392
|
-
description: "List of the Ts.ED
|
|
392
|
+
description: "List of the Ts.ED features."
|
|
393
|
+
},
|
|
394
|
+
"-m, --package-manager <packageManager>": {
|
|
395
|
+
type: Array,
|
|
396
|
+
itemType: String,
|
|
397
|
+
defaultValue: cli_core_1.PackageManager.YARN,
|
|
398
|
+
description: "The default package manager to install the project"
|
|
393
399
|
},
|
|
394
400
|
"-t, --tsed-version <version>": {
|
|
395
401
|
type: String,
|
|
396
402
|
defaultValue: constants_1.DEFAULT_TSED_TAGS,
|
|
397
|
-
description: "Use a specific version of Ts.ED (format: 5.x.x)"
|
|
403
|
+
description: "Use a specific version of Ts.ED (format: 5.x.x)."
|
|
398
404
|
},
|
|
399
405
|
"-f, --file <path>": {
|
|
400
406
|
type: String,
|
|
401
407
|
description: "Location of a file in which the features are defined."
|
|
408
|
+
},
|
|
409
|
+
"-s, --skip-prompt": {
|
|
410
|
+
type: Boolean,
|
|
411
|
+
defaultValue: false,
|
|
412
|
+
description: "Skip the prompt."
|
|
402
413
|
}
|
|
403
414
|
}
|
|
404
415
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitCmd.js","sourceRoot":"","sources":["../../../../src/commands/init/InitCmd.ts"],"names":[],"mappings":";;;;AAAA,6CAgBwB;AACxB,6CAAkD;AAClD,+BAAoC;AACpC,+CAAkD;AAClD,oFAA+E;AAC/E,0EAAqE;AACrE,uEAAkE;AAElE,4DAAuD;AACvD,yDAAoD;AACpD,4DAAiE;AAEjE,mEAA8D;AAkD9D,IAAa,OAAO,GAApB,MAAa,OAAO;IAER,aAAa,CAAgB;IAG7B,UAAU,CAAa;IAGvB,WAAW,CAAqB;IAGhC,cAAc,CAAiB;IAG/B,UAAU,CAAa;IAGvB,WAAW,CAAc;IAGzB,YAAY,CAAsB;IAGlC,kBAAkB,CAAqB;IAGvC,KAAK,CAAW;IAGhB,EAAE,CAAQ;IAEpB,KAAK,CAAC,aAAa,CAAC,cAAoC;QACtD,IAAI,cAAc,CAAC,IAAI,EAAE;YACvB,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;YAE7D,OAAO;gBACL,GAAG,cAAc;gBACjB,GAAG,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,+BA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;YACJ,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,GAAG;gBACjB,WAAW,EAAE,gDAAgD;aAC9D;SACF;QACD,OAAO,EAAE;YACP,2BAA2B,EAAE;gBAC3B,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,+CAAsB,CAAC,OAAO;gBAC5C,WAAW,EAAE,yCAAyC,+CAAsB,CAAC,OAAO,OAAO,+CAAsB,CAAC,OAAO,GAAG;aAC7H;YACD,+BAA+B,EAAE;gBAC/B,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,qCAAiB,CAAC,OAAO;gBACvC,WAAW,EAAE,yCAAyC,+CAAsB,CAAC,OAAO,OAAO,+CAAsB,CAAC,OAAO,GAAG;aAC7H;YACD,2BAA2B,EAAE;gBAC3B,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,SAAS;gBACvB,WAAW,EAAE,qDAAqD;aACnE;YACD,kCAAkC,EAAE;gBAClC,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,kFAAkF;aAChG;YACD,0BAA0B,EAAE;gBAC1B,IAAI,EAAE,KAAK;gBACX,QAAQ,EAAE,MAAM;gBAChB,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,iFAAiF;aAC/F;YACD,8BAA8B,EAAE;gBAC9B,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,6BAAiB;gBAC/B,WAAW,EAAE,iDAAiD;aAC/D;YACD,mBAAmB,EAAE;gBACnB,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,uDAAuD;aACrE;SACF;KACF,CAAC;GACW,OAAO,CAoYnB;AApYY,0BAAO","sourcesContent":["import {\n CliExeca,\n CliFs,\n CliLoadFile,\n CliPackageJson,\n CliPlugins,\n CliService,\n Command,\n CommandProvider,\n Configuration,\n createSubTasks,\n createTasksRunner,\n Inject,\n ProjectPackageJson,\n QuestionOptions,\n RootRendererService\n} from \"@tsed/cli-core\";\nimport {paramCase, pascalCase} from \"change-case\";\nimport {basename, join} from \"path\";\nimport {DEFAULT_TSED_TAGS} from \"../../constants\";\nimport {ArchitectureConvention} from \"../../interfaces/ArchitectureConvention\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {InitCmdContext} from \"./interfaces/InitCmdContext\";\nimport {InitFileSchema} from \"./config/InitFileSchema\";\nimport {mapToContext} from \"./mappers/mapToContext\";\nimport {FeaturesMap, FeatureType} from \"./config/FeaturesPrompt\";\nimport {InitOptions} from \"./interfaces/InitOptions\";\nimport {getFeaturesPrompt} from \"./prompts/getFeaturesPrompt\";\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 \"-a, --arch <architecture>\": {\n type: String,\n defaultValue: ArchitectureConvention.DEFAULT,\n description: `Set the default architecture project (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`\n },\n \"-c, --convention <convention>\": {\n type: String,\n defaultValue: ProjectConvention.DEFAULT,\n description: `Set the default architecture project (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`\n },\n \"-p, --platform <platform>\": {\n type: String,\n defaultValue: \"express\",\n description: \"Set the default platform for Ts.ED (express or koa)\"\n },\n \"-n, --project-name <projectName>\": {\n type: String,\n defaultValue: \"\",\n description: \"Set the project name. By default, the project is the same as the name directory.\"\n },\n \"--features <features...>\": {\n type: Array,\n itemType: String,\n defaultValue: [],\n description: \"List of the Ts.ED feature. The prompt will be skipped If this option is present\"\n },\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, --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 @CliPackageJson()\n protected cliPackageJson: CliPackageJson;\n\n @Inject()\n protected cliService: CliService;\n\n @Inject()\n protected cliLoadFile: CliLoadFile;\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<InitOptions>) {\n if (initialOptions.file) {\n const file = join(this.packageJson.dir, initialOptions.file);\n\n return {\n ...initialOptions,\n ...(await this.cliLoadFile.loadFile(file, InitFileSchema))\n };\n }\n\n return initialOptions;\n }\n\n $prompt(initialOptions: Partial<InitOptions>): QuestionOptions {\n if (initialOptions.skipPrompt) {\n return [];\n }\n\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 ...getFeaturesPrompt(initialOptions)\n ];\n }\n\n $mapContext(ctx: any): InitCmdContext {\n this.resolveRootDir(ctx);\n ctx = mapToContext(ctx);\n\n return {\n ...ctx,\n cliVersion: ctx.cliVersion || this.cliPackageJson.version,\n srcDir: this.configuration.project?.srcDir,\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 $afterPostInstall() {\n return [\n {\n title: \"Generate barrels files\",\n task: () => {\n return this.packageJson.runScript(\"barrels\", {\n ignoreError: true\n });\n }\n }\n ];\n }\n\n resolveRootDir(ctx: Partial<InitCmdContext>) {\n const rootDirName = paramCase(ctx.projectName || basename(this.packageJson.dir));\n\n if (this.packageJson.dir.endsWith(rootDirName)) {\n ctx.projectName = ctx.projectName || rootDirName;\n ctx.root = \".\";\n return;\n }\n\n ctx.projectName = ctx.projectName || rootDirName;\n\n if (ctx.root && ctx.root !== \".\") {\n this.packageJson.dir = join(this.packageJson.dir, rootDirName);\n ctx.root = \".\";\n }\n }\n\n addScripts(ctx: InitCmdContext): void {\n const runner = this.packageJson.getRunCmd();\n\n this.packageJson.addScripts({\n build: `${runner} 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 console.log(ctx);\n ctx.features.forEach((value) => {\n const feature = FeaturesMap[value];\n\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((value) => value === FeatureType.GRAPHQL)) {\n this.packageJson.addDependencies(\n {\n [\"apollo-server-\" + ctx.platform]: \"2.25.2\"\n },\n ctx\n );\n }\n }\n\n private addExpressDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies(\n {\n \"@tsed/platform-express\": ctx.tsedVersion,\n \"body-parser\": \"latest\",\n cors: \"latest\",\n compression: \"latest\",\n \"cookie-parser\": \"latest\",\n express: \"latest\",\n \"method-override\": \"latest\"\n },\n ctx\n );\n\n this.packageJson.addDevDependencies(\n {\n \"@types/cors\": \"latest\",\n \"@types/express\": \"latest\",\n \"@types/compression\": \"latest\",\n \"@types/cookie-parser\": \"latest\",\n \"@types/method-override\": \"latest\"\n },\n ctx\n );\n }\n\n private addKoaDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies(\n {\n \"@tsed/platform-koa\": ctx.tsedVersion,\n koa: \"latest\",\n \"@koa/cors\": \"latest\",\n \"@koa/router\": \"latest\",\n \"koa-qs\": \"latest\",\n \"koa-bodyparser\": \"latest\",\n \"koa-override\": \"latest\",\n \"koa-compress\": \"latest\"\n },\n ctx\n );\n\n this.packageJson.addDevDependencies(\n {\n \"@types/koa\": \"latest\",\n \"@types/koa-qs\": \"latest\",\n \"@types/koa-json\": \"latest\",\n \"@types/koa-bodyparser\": \"latest\",\n \"@types/koa__router\": \"latest\",\n \"@types/koa-compress\": \"latest\",\n \"@types/koa-send\": \"latest\",\n \"@types/koa__cors\": \"latest\"\n },\n ctx\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InitCmd.js","sourceRoot":"","sources":["../../../../src/commands/init/InitCmd.ts"],"names":[],"mappings":";;;;AAAA,6CAiBwB;AACxB,6CAAkD;AAClD,+BAAoC;AACpC,+CAAkD;AAClD,oFAA+E;AAC/E,0EAAqE;AACrE,uEAAkE;AAElE,4DAAuD;AACvD,yDAAoD;AACpD,4DAAiE;AAEjE,mEAA8D;AAC9D,iDAA8C;AA6D9C,IAAa,OAAO,GAApB,MAAa,OAAO;IAER,aAAa,CAAg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EAAE,6BAA6B;aAC3C;YACD,wCAAwC,EAAE;gBACxC,IAAI,EAAE,KAAK;gBACX,QAAQ,EAAE,MAAM;gBAChB,YAAY,EAAE,yBAAc,CAAC,IAAI;gBACjC,WAAW,EAAE,oDAAoD;aAClE;YACD,8BAA8B,EAAE;gBAC9B,IAAI,EAAE,MAAM;gBACZ,YAAY,EAAE,6BAAiB;gBAC/B,WAAW,EAAE,kDAAkD;aAChE;YACD,mBAAmB,EAAE;gBACnB,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,uDAAuD;aACrE;YACD,mBAAmB,EAAE;gBACnB,IAAI,EAAE,OAAO;gBACb,YAAY,EAAE,KAAK;gBACnB,WAAW,EAAE,kBAAkB;aAChC;SACF;KACF,CAAC;GACW,OAAO,CAmYnB;AAnYY,0BAAO","sourcesContent":["import {\n CliExeca,\n CliFs,\n CliLoadFile,\n CliPackageJson,\n CliPlugins,\n CliService,\n Command,\n CommandProvider,\n Configuration,\n createSubTasks,\n createTasksRunner,\n Inject,\n PackageManager,\n ProjectPackageJson,\n QuestionOptions,\n RootRendererService\n} from \"@tsed/cli-core\";\nimport {paramCase, pascalCase} from \"change-case\";\nimport {basename, join} from \"path\";\nimport {DEFAULT_TSED_TAGS} from \"../../constants\";\nimport {ArchitectureConvention} from \"../../interfaces/ArchitectureConvention\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {InitCmdContext} from \"./interfaces/InitCmdContext\";\nimport {InitFileSchema} from \"./config/InitFileSchema\";\nimport {mapToContext} from \"./mappers/mapToContext\";\nimport {FeaturesMap, FeatureType} from \"./config/FeaturesPrompt\";\nimport {InitOptions} from \"./interfaces/InitOptions\";\nimport {getFeaturesPrompt} from \"./prompts/getFeaturesPrompt\";\nimport {PlatformType} from \"../../interfaces\";\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 \"-n, --project-name <projectName>\": {\n type: String,\n defaultValue: \"\",\n description: \"Set the project name. By default, the project is the same as the name directory.\"\n },\n \"-a, --arch <architecture>\": {\n type: String,\n defaultValue: ArchitectureConvention.DEFAULT,\n description: `Set the default architecture convention (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`\n },\n \"-c, --convention <convention>\": {\n type: String,\n defaultValue: ProjectConvention.DEFAULT,\n description: `Set the default project convention (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`\n },\n \"-p, --platform <platform>\": {\n type: String,\n defaultValue: PlatformType.EXPRESS,\n description: \"Set the default platform for Ts.ED (express or koa)\"\n },\n \"--features <features...>\": {\n type: Array,\n itemType: String,\n defaultValue: [],\n description: \"List of the Ts.ED features.\"\n },\n \"-m, --package-manager <packageManager>\": {\n type: Array,\n itemType: String,\n defaultValue: PackageManager.YARN,\n description: \"The default package manager to install the project\"\n },\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, --file <path>\": {\n type: String,\n description: \"Location of a file in which the features are defined.\"\n },\n \"-s, --skip-prompt\": {\n type: Boolean,\n defaultValue: false,\n description: \"Skip the prompt.\"\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 @CliPackageJson()\n protected cliPackageJson: CliPackageJson;\n\n @Inject()\n protected cliService: CliService;\n\n @Inject()\n protected cliLoadFile: CliLoadFile;\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<InitOptions>) {\n if (initialOptions.file) {\n const file = join(this.packageJson.dir, initialOptions.file);\n\n return {\n ...initialOptions,\n ...(await this.cliLoadFile.loadFile(file, InitFileSchema))\n };\n }\n\n return initialOptions;\n }\n\n $prompt(initialOptions: Partial<InitOptions>): QuestionOptions {\n if (initialOptions.skipPrompt) {\n return [];\n }\n\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 ...getFeaturesPrompt(initialOptions)\n ];\n }\n\n $mapContext(ctx: any): InitCmdContext {\n this.resolveRootDir(ctx);\n ctx = mapToContext(ctx);\n\n return {\n ...ctx,\n cliVersion: ctx.cliVersion || this.cliPackageJson.version,\n srcDir: this.configuration.project?.srcDir,\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 $afterPostInstall() {\n return [\n {\n title: \"Generate barrels files\",\n task: () => {\n return this.packageJson.runScript(\"barrels\", {\n ignoreError: true\n });\n }\n }\n ];\n }\n\n resolveRootDir(ctx: Partial<InitCmdContext>) {\n const rootDirName = paramCase(ctx.projectName || basename(this.packageJson.dir));\n\n if (this.packageJson.dir.endsWith(rootDirName)) {\n ctx.projectName = ctx.projectName || rootDirName;\n ctx.root = \".\";\n return;\n }\n\n ctx.projectName = ctx.projectName || rootDirName;\n\n if (ctx.root && ctx.root !== \".\") {\n this.packageJson.dir = join(this.packageJson.dir, rootDirName);\n ctx.root = \".\";\n }\n }\n\n addScripts(ctx: InitCmdContext): void {\n const runner = this.packageJson.getRunCmd();\n\n this.packageJson.addScripts({\n build: `${runner} 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((value) => {\n const feature = FeaturesMap[value];\n\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((value) => value === FeatureType.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"]}
|
|
@@ -7,25 +7,18 @@ const FeaturesPrompt_1 = require("./FeaturesPrompt");
|
|
|
7
7
|
exports.InitFileSchema = {
|
|
8
8
|
type: "object",
|
|
9
9
|
properties: {
|
|
10
|
-
|
|
11
|
-
type: "string"
|
|
12
|
-
description: "The project name. By default, the project is the same as the name directory.",
|
|
13
|
-
enum: Object.values(interfaces_1.PlatformType),
|
|
14
|
-
default: interfaces_1.PlatformType.EXPRESS
|
|
10
|
+
tsedVersion: {
|
|
11
|
+
type: "string"
|
|
15
12
|
},
|
|
16
13
|
projectName: {
|
|
17
14
|
type: "string",
|
|
18
15
|
maxLength: 100
|
|
19
16
|
},
|
|
20
|
-
|
|
21
|
-
type: "string"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
items: {
|
|
26
|
-
type: "string",
|
|
27
|
-
enum: Object.values(FeaturesPrompt_1.FeatureType)
|
|
28
|
-
}
|
|
17
|
+
platform: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "The project name. By default, the project is the same as the name directory.",
|
|
20
|
+
enum: Object.values(interfaces_1.PlatformType),
|
|
21
|
+
default: interfaces_1.PlatformType.EXPRESS
|
|
29
22
|
},
|
|
30
23
|
architecture: {
|
|
31
24
|
type: "string",
|
|
@@ -37,10 +30,21 @@ exports.InitFileSchema = {
|
|
|
37
30
|
enum: Object.values(interfaces_1.ProjectConvention),
|
|
38
31
|
default: interfaces_1.ProjectConvention.DEFAULT
|
|
39
32
|
},
|
|
33
|
+
features: {
|
|
34
|
+
type: "array",
|
|
35
|
+
items: {
|
|
36
|
+
type: "string",
|
|
37
|
+
enum: Object.values(FeaturesPrompt_1.FeatureType)
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
40
|
packageManager: {
|
|
41
41
|
type: "string",
|
|
42
42
|
enum: Object.values(cli_core_1.PackageManager),
|
|
43
43
|
default: cli_core_1.PackageManager.YARN
|
|
44
|
+
},
|
|
45
|
+
skipPrompt: {
|
|
46
|
+
type: "boolean",
|
|
47
|
+
default: false
|
|
44
48
|
}
|
|
45
49
|
},
|
|
46
50
|
required: ["features"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitFileSchema.js","sourceRoot":"","sources":["../../../../../src/commands/init/config/InitFileSchema.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAC9C,oDAA4F;AAC5F,qDAA6C;AAEhC,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,
|
|
1
|
+
{"version":3,"file":"InitFileSchema.js","sourceRoot":"","sources":["../../../../../src/commands/init/config/InitFileSchema.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAC9C,oDAA4F;AAC5F,qDAA6C;AAEhC,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;SACf;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,GAAG;SACf;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,8EAA8E;YAC3F,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,yBAAY,CAAC;YACjC,OAAO,EAAE,yBAAY,CAAC,OAAO;SAC9B;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,mCAAsB,CAAC;YAC3C,OAAO,EAAE,mCAAsB,CAAC,OAAO;SACxC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,8BAAiB,CAAC;YACtC,OAAO,EAAE,8BAAiB,CAAC,OAAO;SACnC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,4BAAW,CAAC;aACjC;SACF;QACD,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,yBAAc,CAAC;YACnC,OAAO,EAAE,yBAAc,CAAC,IAAI;SAC7B;QACD,UAAU,EAAE;YACV,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf;KACF;IACD,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,oBAAoB,EAAE,IAAI;CAC3B,CAAC","sourcesContent":["import {PackageManager} from \"@tsed/cli-core\";\nimport {ArchitectureConvention, PlatformType, ProjectConvention} from \"../../../interfaces\";\nimport {FeatureType} from \"./FeaturesPrompt\";\n\nexport const InitFileSchema = {\n type: \"object\",\n properties: {\n tsedVersion: {\n type: \"string\"\n },\n projectName: {\n type: \"string\",\n maxLength: 100\n },\n platform: {\n type: \"string\",\n description: \"The project name. By default, the project is the same as the name directory.\",\n enum: Object.values(PlatformType),\n default: PlatformType.EXPRESS\n },\n architecture: {\n type: \"string\",\n enum: Object.values(ArchitectureConvention),\n default: ArchitectureConvention.DEFAULT\n },\n convention: {\n type: \"string\",\n enum: Object.values(ProjectConvention),\n default: ProjectConvention.DEFAULT\n },\n features: {\n type: \"array\",\n items: {\n type: \"string\",\n enum: Object.values(FeatureType)\n }\n },\n packageManager: {\n type: \"string\",\n enum: Object.values(PackageManager),\n default: PackageManager.YARN\n },\n skipPrompt: {\n type: \"boolean\",\n default: false\n }\n },\n required: [\"features\"],\n additionalProperties: true\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { CliExeca, CliFs, CliLoadFile, CliPackageJson, CliPlugins, CliService, Command, Configuration, createSubTasks, createTasksRunner, Inject, ProjectPackageJson, RootRendererService } from "@tsed/cli-core";
|
|
2
|
+
import { CliExeca, CliFs, CliLoadFile, CliPackageJson, CliPlugins, CliService, Command, Configuration, createSubTasks, createTasksRunner, Inject, PackageManager, ProjectPackageJson, RootRendererService } from "@tsed/cli-core";
|
|
3
3
|
import { paramCase, pascalCase } from "change-case";
|
|
4
4
|
import { basename, join } from "path";
|
|
5
5
|
import { DEFAULT_TSED_TAGS } from "../../constants.js";
|
|
@@ -10,6 +10,7 @@ import { InitFileSchema } from "./config/InitFileSchema.js";
|
|
|
10
10
|
import { mapToContext } from "./mappers/mapToContext.js";
|
|
11
11
|
import { FeaturesMap, FeatureType } from "./config/FeaturesPrompt.js";
|
|
12
12
|
import { getFeaturesPrompt } from "./prompts/getFeaturesPrompt.js";
|
|
13
|
+
import { PlatformType } from "../../interfaces.js";
|
|
13
14
|
let InitCmd = class InitCmd {
|
|
14
15
|
configuration;
|
|
15
16
|
cliPlugins;
|
|
@@ -245,7 +246,6 @@ let InitCmd = class InitCmd {
|
|
|
245
246
|
}
|
|
246
247
|
}
|
|
247
248
|
addFeatures(ctx) {
|
|
248
|
-
console.log(ctx);
|
|
249
249
|
ctx.features.forEach((value) => {
|
|
250
250
|
const feature = FeaturesMap[value];
|
|
251
251
|
if (feature.dependencies) {
|
|
@@ -362,40 +362,51 @@ InitCmd = __decorate([
|
|
|
362
362
|
}
|
|
363
363
|
},
|
|
364
364
|
options: {
|
|
365
|
+
"-n, --project-name <projectName>": {
|
|
366
|
+
type: String,
|
|
367
|
+
defaultValue: "",
|
|
368
|
+
description: "Set the project name. By default, the project is the same as the name directory."
|
|
369
|
+
},
|
|
365
370
|
"-a, --arch <architecture>": {
|
|
366
371
|
type: String,
|
|
367
372
|
defaultValue: ArchitectureConvention.DEFAULT,
|
|
368
|
-
description: `Set the default architecture
|
|
373
|
+
description: `Set the default architecture convention (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`
|
|
369
374
|
},
|
|
370
375
|
"-c, --convention <convention>": {
|
|
371
376
|
type: String,
|
|
372
377
|
defaultValue: ProjectConvention.DEFAULT,
|
|
373
|
-
description: `Set the default
|
|
378
|
+
description: `Set the default project convention (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`
|
|
374
379
|
},
|
|
375
380
|
"-p, --platform <platform>": {
|
|
376
381
|
type: String,
|
|
377
|
-
defaultValue:
|
|
382
|
+
defaultValue: PlatformType.EXPRESS,
|
|
378
383
|
description: "Set the default platform for Ts.ED (express or koa)"
|
|
379
384
|
},
|
|
380
|
-
"-n, --project-name <projectName>": {
|
|
381
|
-
type: String,
|
|
382
|
-
defaultValue: "",
|
|
383
|
-
description: "Set the project name. By default, the project is the same as the name directory."
|
|
384
|
-
},
|
|
385
385
|
"--features <features...>": {
|
|
386
386
|
type: Array,
|
|
387
387
|
itemType: String,
|
|
388
388
|
defaultValue: [],
|
|
389
|
-
description: "List of the Ts.ED
|
|
389
|
+
description: "List of the Ts.ED features."
|
|
390
|
+
},
|
|
391
|
+
"-m, --package-manager <packageManager>": {
|
|
392
|
+
type: Array,
|
|
393
|
+
itemType: String,
|
|
394
|
+
defaultValue: PackageManager.YARN,
|
|
395
|
+
description: "The default package manager to install the project"
|
|
390
396
|
},
|
|
391
397
|
"-t, --tsed-version <version>": {
|
|
392
398
|
type: String,
|
|
393
399
|
defaultValue: DEFAULT_TSED_TAGS,
|
|
394
|
-
description: "Use a specific version of Ts.ED (format: 5.x.x)"
|
|
400
|
+
description: "Use a specific version of Ts.ED (format: 5.x.x)."
|
|
395
401
|
},
|
|
396
402
|
"-f, --file <path>": {
|
|
397
403
|
type: String,
|
|
398
404
|
description: "Location of a file in which the features are defined."
|
|
405
|
+
},
|
|
406
|
+
"-s, --skip-prompt": {
|
|
407
|
+
type: Boolean,
|
|
408
|
+
defaultValue: false,
|
|
409
|
+
description: "Skip the prompt."
|
|
399
410
|
}
|
|
400
411
|
}
|
|
401
412
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitCmd.js","sourceRoot":"","sources":["../../../../src/commands/init/InitCmd.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,WAAW,EACX,cAAc,EACd,UAAU,EACV,UAAU,EACV,OAAO,EAEP,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,kBAAkB,EAElB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACpC,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,sBAAsB,EAAC,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAC,iBAAiB,EAAC,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAkD9D,IAAa,OAAO,GAApB,MA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D;aAC/D;YACD,mBAAmB,EAAE;gBACnB,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,uDAAuD;aACrE;SACF;KACF,CAAC;GACW,OAAO,CAoYnB;SApYY,OAAO","sourcesContent":["import {\n CliExeca,\n CliFs,\n CliLoadFile,\n CliPackageJson,\n CliPlugins,\n CliService,\n Command,\n CommandProvider,\n Configuration,\n createSubTasks,\n createTasksRunner,\n Inject,\n ProjectPackageJson,\n QuestionOptions,\n RootRendererService\n} from \"@tsed/cli-core\";\nimport {paramCase, pascalCase} from \"change-case\";\nimport {basename, join} from \"path\";\nimport {DEFAULT_TSED_TAGS} from \"../../constants\";\nimport {ArchitectureConvention} from \"../../interfaces/ArchitectureConvention\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {InitCmdContext} from \"./interfaces/InitCmdContext\";\nimport {InitFileSchema} from \"./config/InitFileSchema\";\nimport {mapToContext} from \"./mappers/mapToContext\";\nimport {FeaturesMap, FeatureType} from \"./config/FeaturesPrompt\";\nimport {InitOptions} from \"./interfaces/InitOptions\";\nimport {getFeaturesPrompt} from \"./prompts/getFeaturesPrompt\";\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 \"-a, --arch <architecture>\": {\n type: String,\n defaultValue: ArchitectureConvention.DEFAULT,\n description: `Set the default architecture project (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`\n },\n \"-c, --convention <convention>\": {\n type: String,\n defaultValue: ProjectConvention.DEFAULT,\n description: `Set the default architecture project (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`\n },\n \"-p, --platform <platform>\": {\n type: String,\n defaultValue: \"express\",\n description: \"Set the default platform for Ts.ED (express or koa)\"\n },\n \"-n, --project-name <projectName>\": {\n type: String,\n defaultValue: \"\",\n description: \"Set the project name. By default, the project is the same as the name directory.\"\n },\n \"--features <features...>\": {\n type: Array,\n itemType: String,\n defaultValue: [],\n description: \"List of the Ts.ED feature. The prompt will be skipped If this option is present\"\n },\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, --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 @CliPackageJson()\n protected cliPackageJson: CliPackageJson;\n\n @Inject()\n protected cliService: CliService;\n\n @Inject()\n protected cliLoadFile: CliLoadFile;\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<InitOptions>) {\n if (initialOptions.file) {\n const file = join(this.packageJson.dir, initialOptions.file);\n\n return {\n ...initialOptions,\n ...(await this.cliLoadFile.loadFile(file, InitFileSchema))\n };\n }\n\n return initialOptions;\n }\n\n $prompt(initialOptions: Partial<InitOptions>): QuestionOptions {\n if (initialOptions.skipPrompt) {\n return [];\n }\n\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 ...getFeaturesPrompt(initialOptions)\n ];\n }\n\n $mapContext(ctx: any): InitCmdContext {\n this.resolveRootDir(ctx);\n ctx = mapToContext(ctx);\n\n return {\n ...ctx,\n cliVersion: ctx.cliVersion || this.cliPackageJson.version,\n srcDir: this.configuration.project?.srcDir,\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 $afterPostInstall() {\n return [\n {\n title: \"Generate barrels files\",\n task: () => {\n return this.packageJson.runScript(\"barrels\", {\n ignoreError: true\n });\n }\n }\n ];\n }\n\n resolveRootDir(ctx: Partial<InitCmdContext>) {\n const rootDirName = paramCase(ctx.projectName || basename(this.packageJson.dir));\n\n if (this.packageJson.dir.endsWith(rootDirName)) {\n ctx.projectName = ctx.projectName || rootDirName;\n ctx.root = \".\";\n return;\n }\n\n ctx.projectName = ctx.projectName || rootDirName;\n\n if (ctx.root && ctx.root !== \".\") {\n this.packageJson.dir = join(this.packageJson.dir, rootDirName);\n ctx.root = \".\";\n }\n }\n\n addScripts(ctx: InitCmdContext): void {\n const runner = this.packageJson.getRunCmd();\n\n this.packageJson.addScripts({\n build: `${runner} 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 console.log(ctx);\n ctx.features.forEach((value) => {\n const feature = FeaturesMap[value];\n\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((value) => value === FeatureType.GRAPHQL)) {\n this.packageJson.addDependencies(\n {\n [\"apollo-server-\" + ctx.platform]: \"2.25.2\"\n },\n ctx\n );\n }\n }\n\n private addExpressDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies(\n {\n \"@tsed/platform-express\": ctx.tsedVersion,\n \"body-parser\": \"latest\",\n cors: \"latest\",\n compression: \"latest\",\n \"cookie-parser\": \"latest\",\n express: \"latest\",\n \"method-override\": \"latest\"\n },\n ctx\n );\n\n this.packageJson.addDevDependencies(\n {\n \"@types/cors\": \"latest\",\n \"@types/express\": \"latest\",\n \"@types/compression\": \"latest\",\n \"@types/cookie-parser\": \"latest\",\n \"@types/method-override\": \"latest\"\n },\n ctx\n );\n }\n\n private addKoaDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies(\n {\n \"@tsed/platform-koa\": ctx.tsedVersion,\n koa: \"latest\",\n \"@koa/cors\": \"latest\",\n \"@koa/router\": \"latest\",\n \"koa-qs\": \"latest\",\n \"koa-bodyparser\": \"latest\",\n \"koa-override\": \"latest\",\n \"koa-compress\": \"latest\"\n },\n ctx\n );\n\n this.packageJson.addDevDependencies(\n {\n \"@types/koa\": \"latest\",\n \"@types/koa-qs\": \"latest\",\n \"@types/koa-json\": \"latest\",\n \"@types/koa-bodyparser\": \"latest\",\n \"@types/koa__router\": \"latest\",\n \"@types/koa-compress\": \"latest\",\n \"@types/koa-send\": \"latest\",\n \"@types/koa__cors\": \"latest\"\n },\n ctx\n );\n }\n}\n"]}
|
|
1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AO,CAmYnB;SAnYY,OAAO","sourcesContent":["import {\n CliExeca,\n CliFs,\n CliLoadFile,\n CliPackageJson,\n CliPlugins,\n CliService,\n Command,\n CommandProvider,\n Configuration,\n createSubTasks,\n createTasksRunner,\n Inject,\n PackageManager,\n ProjectPackageJson,\n QuestionOptions,\n RootRendererService\n} from \"@tsed/cli-core\";\nimport {paramCase, pascalCase} from \"change-case\";\nimport {basename, join} from \"path\";\nimport {DEFAULT_TSED_TAGS} from \"../../constants\";\nimport {ArchitectureConvention} from \"../../interfaces/ArchitectureConvention\";\nimport {ProjectConvention} from \"../../interfaces/ProjectConvention\";\nimport {OutputFilePathPipe} from \"../../pipes/OutputFilePathPipe\";\nimport {InitCmdContext} from \"./interfaces/InitCmdContext\";\nimport {InitFileSchema} from \"./config/InitFileSchema\";\nimport {mapToContext} from \"./mappers/mapToContext\";\nimport {FeaturesMap, FeatureType} from \"./config/FeaturesPrompt\";\nimport {InitOptions} from \"./interfaces/InitOptions\";\nimport {getFeaturesPrompt} from \"./prompts/getFeaturesPrompt\";\nimport {PlatformType} from \"../../interfaces\";\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 \"-n, --project-name <projectName>\": {\n type: String,\n defaultValue: \"\",\n description: \"Set the project name. By default, the project is the same as the name directory.\"\n },\n \"-a, --arch <architecture>\": {\n type: String,\n defaultValue: ArchitectureConvention.DEFAULT,\n description: `Set the default architecture convention (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`\n },\n \"-c, --convention <convention>\": {\n type: String,\n defaultValue: ProjectConvention.DEFAULT,\n description: `Set the default project convention (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`\n },\n \"-p, --platform <platform>\": {\n type: String,\n defaultValue: PlatformType.EXPRESS,\n description: \"Set the default platform for Ts.ED (express or koa)\"\n },\n \"--features <features...>\": {\n type: Array,\n itemType: String,\n defaultValue: [],\n description: \"List of the Ts.ED features.\"\n },\n \"-m, --package-manager <packageManager>\": {\n type: Array,\n itemType: String,\n defaultValue: PackageManager.YARN,\n description: \"The default package manager to install the project\"\n },\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, --file <path>\": {\n type: String,\n description: \"Location of a file in which the features are defined.\"\n },\n \"-s, --skip-prompt\": {\n type: Boolean,\n defaultValue: false,\n description: \"Skip the prompt.\"\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 @CliPackageJson()\n protected cliPackageJson: CliPackageJson;\n\n @Inject()\n protected cliService: CliService;\n\n @Inject()\n protected cliLoadFile: CliLoadFile;\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<InitOptions>) {\n if (initialOptions.file) {\n const file = join(this.packageJson.dir, initialOptions.file);\n\n return {\n ...initialOptions,\n ...(await this.cliLoadFile.loadFile(file, InitFileSchema))\n };\n }\n\n return initialOptions;\n }\n\n $prompt(initialOptions: Partial<InitOptions>): QuestionOptions {\n if (initialOptions.skipPrompt) {\n return [];\n }\n\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 ...getFeaturesPrompt(initialOptions)\n ];\n }\n\n $mapContext(ctx: any): InitCmdContext {\n this.resolveRootDir(ctx);\n ctx = mapToContext(ctx);\n\n return {\n ...ctx,\n cliVersion: ctx.cliVersion || this.cliPackageJson.version,\n srcDir: this.configuration.project?.srcDir,\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 $afterPostInstall() {\n return [\n {\n title: \"Generate barrels files\",\n task: () => {\n return this.packageJson.runScript(\"barrels\", {\n ignoreError: true\n });\n }\n }\n ];\n }\n\n resolveRootDir(ctx: Partial<InitCmdContext>) {\n const rootDirName = paramCase(ctx.projectName || basename(this.packageJson.dir));\n\n if (this.packageJson.dir.endsWith(rootDirName)) {\n ctx.projectName = ctx.projectName || rootDirName;\n ctx.root = \".\";\n return;\n }\n\n ctx.projectName = ctx.projectName || rootDirName;\n\n if (ctx.root && ctx.root !== \".\") {\n this.packageJson.dir = join(this.packageJson.dir, rootDirName);\n ctx.root = \".\";\n }\n }\n\n addScripts(ctx: InitCmdContext): void {\n const runner = this.packageJson.getRunCmd();\n\n this.packageJson.addScripts({\n build: `${runner} 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((value) => {\n const feature = FeaturesMap[value];\n\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((value) => value === FeatureType.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"]}
|
|
@@ -4,25 +4,18 @@ import { FeatureType } from "./FeaturesPrompt.js";
|
|
|
4
4
|
export const InitFileSchema = {
|
|
5
5
|
type: "object",
|
|
6
6
|
properties: {
|
|
7
|
-
|
|
8
|
-
type: "string"
|
|
9
|
-
description: "The project name. By default, the project is the same as the name directory.",
|
|
10
|
-
enum: Object.values(PlatformType),
|
|
11
|
-
default: PlatformType.EXPRESS
|
|
7
|
+
tsedVersion: {
|
|
8
|
+
type: "string"
|
|
12
9
|
},
|
|
13
10
|
projectName: {
|
|
14
11
|
type: "string",
|
|
15
12
|
maxLength: 100
|
|
16
13
|
},
|
|
17
|
-
|
|
18
|
-
type: "string"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
items: {
|
|
23
|
-
type: "string",
|
|
24
|
-
enum: Object.values(FeatureType)
|
|
25
|
-
}
|
|
14
|
+
platform: {
|
|
15
|
+
type: "string",
|
|
16
|
+
description: "The project name. By default, the project is the same as the name directory.",
|
|
17
|
+
enum: Object.values(PlatformType),
|
|
18
|
+
default: PlatformType.EXPRESS
|
|
26
19
|
},
|
|
27
20
|
architecture: {
|
|
28
21
|
type: "string",
|
|
@@ -34,10 +27,21 @@ export const InitFileSchema = {
|
|
|
34
27
|
enum: Object.values(ProjectConvention),
|
|
35
28
|
default: ProjectConvention.DEFAULT
|
|
36
29
|
},
|
|
30
|
+
features: {
|
|
31
|
+
type: "array",
|
|
32
|
+
items: {
|
|
33
|
+
type: "string",
|
|
34
|
+
enum: Object.values(FeatureType)
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
37
|
packageManager: {
|
|
38
38
|
type: "string",
|
|
39
39
|
enum: Object.values(PackageManager),
|
|
40
40
|
default: PackageManager.YARN
|
|
41
|
+
},
|
|
42
|
+
skipPrompt: {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
default: false
|
|
41
45
|
}
|
|
42
46
|
},
|
|
43
47
|
required: ["features"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitFileSchema.js","sourceRoot":"","sources":["../../../../../src/commands/init/config/InitFileSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAC,sBAAsB,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,
|
|
1
|
+
{"version":3,"file":"InitFileSchema.js","sourceRoot":"","sources":["../../../../../src/commands/init/config/InitFileSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAC,sBAAsB,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;SACf;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,GAAG;SACf;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,8EAA8E;YAC3F,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;YACjC,OAAO,EAAE,YAAY,CAAC,OAAO;SAC9B;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC;YAC3C,OAAO,EAAE,sBAAsB,CAAC,OAAO;SACxC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;YACtC,OAAO,EAAE,iBAAiB,CAAC,OAAO;SACnC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;aACjC;SACF;QACD,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;YACnC,OAAO,EAAE,cAAc,CAAC,IAAI;SAC7B;QACD,UAAU,EAAE;YACV,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf;KACF;IACD,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,oBAAoB,EAAE,IAAI;CAC3B,CAAC","sourcesContent":["import {PackageManager} from \"@tsed/cli-core\";\nimport {ArchitectureConvention, PlatformType, ProjectConvention} from \"../../../interfaces\";\nimport {FeatureType} from \"./FeaturesPrompt\";\n\nexport const InitFileSchema = {\n type: \"object\",\n properties: {\n tsedVersion: {\n type: \"string\"\n },\n projectName: {\n type: \"string\",\n maxLength: 100\n },\n platform: {\n type: \"string\",\n description: \"The project name. By default, the project is the same as the name directory.\",\n enum: Object.values(PlatformType),\n default: PlatformType.EXPRESS\n },\n architecture: {\n type: \"string\",\n enum: Object.values(ArchitectureConvention),\n default: ArchitectureConvention.DEFAULT\n },\n convention: {\n type: \"string\",\n enum: Object.values(ProjectConvention),\n default: ProjectConvention.DEFAULT\n },\n features: {\n type: \"array\",\n items: {\n type: \"string\",\n enum: Object.values(FeatureType)\n }\n },\n packageManager: {\n type: \"string\",\n enum: Object.values(PackageManager),\n default: PackageManager.YARN\n },\n skipPrompt: {\n type: \"boolean\",\n default: false\n }\n },\n required: [\"features\"],\n additionalProperties: true\n};\n"]}
|
|
@@ -4,25 +4,18 @@ import { FeatureType } from "./FeaturesPrompt";
|
|
|
4
4
|
export declare const InitFileSchema: {
|
|
5
5
|
type: string;
|
|
6
6
|
properties: {
|
|
7
|
-
|
|
7
|
+
tsedVersion: {
|
|
8
8
|
type: string;
|
|
9
|
-
description: string;
|
|
10
|
-
enum: PlatformType[];
|
|
11
|
-
default: PlatformType;
|
|
12
9
|
};
|
|
13
10
|
projectName: {
|
|
14
11
|
type: string;
|
|
15
12
|
maxLength: number;
|
|
16
13
|
};
|
|
17
|
-
|
|
18
|
-
type: string;
|
|
19
|
-
};
|
|
20
|
-
features: {
|
|
14
|
+
platform: {
|
|
21
15
|
type: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
16
|
+
description: string;
|
|
17
|
+
enum: PlatformType[];
|
|
18
|
+
default: PlatformType;
|
|
26
19
|
};
|
|
27
20
|
architecture: {
|
|
28
21
|
type: string;
|
|
@@ -34,11 +27,22 @@ export declare const InitFileSchema: {
|
|
|
34
27
|
enum: ProjectConvention[];
|
|
35
28
|
default: ProjectConvention;
|
|
36
29
|
};
|
|
30
|
+
features: {
|
|
31
|
+
type: string;
|
|
32
|
+
items: {
|
|
33
|
+
type: string;
|
|
34
|
+
enum: FeatureType[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
37
|
packageManager: {
|
|
38
38
|
type: string;
|
|
39
39
|
enum: PackageManager[];
|
|
40
40
|
default: PackageManager;
|
|
41
41
|
};
|
|
42
|
+
skipPrompt: {
|
|
43
|
+
type: string;
|
|
44
|
+
default: boolean;
|
|
45
|
+
};
|
|
42
46
|
};
|
|
43
47
|
required: string[];
|
|
44
48
|
additionalProperties: boolean;
|