@tsed/cli 7.0.0-alpha.5 → 7.0.0-alpha.7

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.
@@ -298,7 +298,7 @@ export class InitCmd {
298
298
  // files with higher priority
299
299
  const promises = [
300
300
  "tsconfig.base.json",
301
- "tsconfig.config.json",
301
+ "tsconfig.json",
302
302
  "tsconfig.spec.json",
303
303
  "tsconfig.node.json",
304
304
  "docker-compose.yml",
@@ -311,6 +311,7 @@ export class InitCmd {
311
311
  "index.config.util",
312
312
  "index.logger",
313
313
  "index.controller",
314
+ ctx.commands && "index.command",
314
315
  "barrels",
315
316
  "readme",
316
317
  `pm2.${pm2}`,
@@ -1,5 +1,6 @@
1
1
  import { command, inject, ProjectPackageJson } from "@tsed/cli-core";
2
2
  import { snakeCase } from "change-case";
3
+ import { PKG } from "../../constants/index.js";
3
4
  import { render } from "../../fn/render.js";
4
5
  import { CliTemplatesService } from "../../services/CliTemplatesService.js";
5
6
  const searchFactory = (list) => {
@@ -67,6 +68,7 @@ export class CreateTemplateCommand {
67
68
  };
68
69
  }
69
70
  $exec(ctx) {
71
+ this.projectPackageJson.addDevDependencies({ "@tsed/cli": PKG.version });
70
72
  return [
71
73
  {
72
74
  title: "Generate " + ctx.from === "new" ? `new template ${ctx.templateId}` : `template ${ctx.templateId} from ${ctx.from}`,
@@ -1,23 +1,23 @@
1
1
  export function transformConfigFile(project, data) {
2
2
  if (!data.config && data.commandName === "init") {
3
3
  project.addConfigSource("EnvsConfigSource", {
4
- moduleSpecifier: "@tsedio/config-envs/envs"
4
+ moduleSpecifier: "@tsed/config/envs"
5
5
  });
6
6
  }
7
7
  if (data.config) {
8
8
  if (data.configDotenv) {
9
9
  project.addConfigSource("DotenvConfigSource", {
10
- moduleSpecifier: "@tsedio/config-envs/dotenv"
10
+ moduleSpecifier: "@tsed/config/dotenv"
11
11
  });
12
12
  }
13
13
  else if (data.configEnvs) {
14
14
  project.addConfigSource("EnvsConfigSource", {
15
- moduleSpecifier: "@tsedio/config-envs/envs"
15
+ moduleSpecifier: "@tsed/config/envs"
16
16
  });
17
17
  }
18
18
  if (data.configJson) {
19
19
  project.addConfigSource("JsonConfigSource", {
20
- moduleSpecifier: "@tsedio/config-envs/json",
20
+ moduleSpecifier: "@tsed/config/json",
21
21
  content: `withOptions(JsonConfigSource, {
22
22
  path: "./config.json"
23
23
  })`
@@ -25,7 +25,7 @@ export function transformConfigFile(project, data) {
25
25
  }
26
26
  if (data.configYaml) {
27
27
  project.addConfigSource("YamlConfigSource", {
28
- moduleSpecifier: "@tsedio/config-envs/yaml",
28
+ moduleSpecifier: "@tsed/config/yaml",
29
29
  content: `withOptions(YamlConfigSource, {
30
30
  path: "./config.yaml"
31
31
  })`
@@ -14,7 +14,11 @@ export default defineTemplate({
14
14
  },
15
15
  render(_, context) {
16
16
  const barrels = $alter("$alterBarrels", {
17
- directory: ["./src/controllers/rest", (context.swagger || context.oidc) && "./src/controllers/pages"].filter(Boolean),
17
+ directory: [
18
+ "./src/controllers/rest",
19
+ context.commands && "./src/bin/commands",
20
+ (context.swagger || context.oidc) && "./src/controllers/pages"
21
+ ].filter(Boolean),
18
22
  exclude: ["**/__mock__", "**/__mocks__", "**/*.spec.ts"],
19
23
  delete: true
20
24
  });
@@ -4,15 +4,18 @@ export default defineTemplate({
4
4
  label: "CLI Entry Point",
5
5
  description: "Create a new CLI entry point file",
6
6
  outputDir: "{{srcDir}}/bin",
7
+ fileName: "index",
7
8
  hidden: true,
9
+ preserveCase: true,
8
10
  render() {
9
11
  return `#!/usr/bin/env node
10
12
  import {CliCore} from "@tsed/cli-core";
11
- import {config} from "@/config";
13
+ import {config} from "@/config/config.js";
14
+ import * commands from "@/bin/commands/index.js";
12
15
 
13
16
  CliCore.bootstrap({
14
17
  ...config,
15
- commands: []
18
+ commands: [...Object.values(commands)]
16
19
  }).catch(console.error);
17
20
  `;
18
21
  }
@@ -24,7 +24,6 @@ import "./index.controller.template.js";
24
24
  import "./index.command.template.js";
25
25
  import "./index.logger.template.js";
26
26
  import "./index.config.utils.template.js";
27
- import "./tsconfig.template.js";
28
27
  import "./tsconfig.spec.template.js";
29
28
  import "./docker-compose.template.js";
30
29
  import "./dockerfile.template.js";
@@ -10,7 +10,7 @@ defineTemplate({
10
10
  if (context.from === "new") {
11
11
  return `import {defineTemplate} from "@tsed/cli";
12
12
 
13
- defineTemplate({
13
+ export default defineTemplate({
14
14
  id: "${context.templateId}",
15
15
  label: "${context.name}",
16
16
  fileName: "{{symbolName}}.services",
@@ -3,7 +3,7 @@ export default defineTemplate({
3
3
  id: "tsconfig.spec.json",
4
4
  label: "TSConfig spec",
5
5
  description: "Create a tsconfig.json file.",
6
- fileName: "tsconfig",
6
+ fileName: "tsconfig.spec",
7
7
  outputDir: ".",
8
8
  ext: "json",
9
9
  preserveCase: true,