@tsed/cli 7.0.0-alpha.9 → 7.0.0-beta.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.
@@ -15,8 +15,28 @@ register(pathToFileURL(join(import.meta.dirname, `../loaders/alias.hook.${EXT}`)
15
15
  },
16
16
  transferList: []
17
17
  });
18
- const { Cli } = await import("../Cli.js");
19
- Cli.bootstrap({}).catch((error) => {
18
+ const { commands, CliCore, PKG, TEMPLATE_DIR, ArchitectureConvention, ProjectConvention } = await import("../index.js");
19
+ CliCore.bootstrap({
20
+ name: "tsed",
21
+ pkg: PKG,
22
+ templateDir: TEMPLATE_DIR,
23
+ plugins: true,
24
+ updateNotifier: true,
25
+ checkPrecondition: true,
26
+ commands,
27
+ defaultProjectPreferences() {
28
+ return {
29
+ convention: ProjectConvention.DEFAULT,
30
+ architecture: ArchitectureConvention.DEFAULT
31
+ };
32
+ },
33
+ project: {
34
+ reinstallAfterRun: true
35
+ },
36
+ logger: {
37
+ level: "info"
38
+ }
39
+ }).catch((error) => {
20
40
  console.error(error);
21
41
  process.exit(-1);
22
42
  });
package/lib/esm/index.js CHANGED
@@ -1,7 +1,8 @@
1
+ import "@tsed/logger-std";
1
2
  import "./templates/index.js";
2
- export * from "./Cli.js";
3
3
  export * from "./commands/add/AddCmd.js";
4
4
  export * from "./commands/generate/GenerateCmd.js";
5
+ export { default as commands } from "./commands/index.js";
5
6
  export * from "./commands/init/config/FeaturesPrompt.js";
6
7
  export * from "./commands/init/config/FeaturesPrompt.js";
7
8
  export * from "./commands/init/InitCmd.js";
@@ -17,3 +18,4 @@ export * from "./services/CliProjectService.js";
17
18
  export * from "./services/CliTemplatesService.js";
18
19
  export * from "./services/ProjectClient.js";
19
20
  export * from "./utils/defineTemplate.js";
21
+ export { CliCore } from "@tsed/cli-core";
@@ -8,10 +8,9 @@ export class CliTemplatesService {
8
8
  constructor() {
9
9
  this.rootDir = constant("project.rootDir", process.cwd());
10
10
  this.fs = inject(CliFs);
11
- this.#templates = new Map();
11
+ this.renderedFiles = [];
12
12
  }
13
13
  #customTemplates;
14
- #templates;
15
14
  get srcDir() {
16
15
  return join(...[this.rootDir, constant("project.srcDir")].filter(Boolean));
17
16
  }
@@ -89,7 +88,7 @@ export class CliTemplatesService {
89
88
  template.fileName?.replace("{{symbolName}}", opts.symbolName)?.replace("{{srcDir}}", this.srcDir) ||
90
89
  opts.symbolName;
91
90
  const outputPath = `${filePath}${template.ext ? "." + template.ext : ""}`;
92
- return {
91
+ return this.pushRenderResult({
93
92
  templateId,
94
93
  content: render,
95
94
  outputPath,
@@ -97,20 +96,24 @@ export class CliTemplatesService {
97
96
  symbolName: opts.symbolName,
98
97
  symbolPath: opts.symbolPath,
99
98
  symbolPathBasename: opts.symbolPathBasename
100
- };
99
+ });
101
100
  }
102
101
  else {
103
102
  const from = data.from || TEMPLATE_DIR;
104
103
  const fromPath = join(from, templateId.replace("{{srcDir}}", "src"));
105
104
  if (await this.fs.fileExists(fromPath)) {
106
105
  const content = await inject(CliFs).readFile(fromPath);
107
- return {
106
+ return this.pushRenderResult({
108
107
  templateId,
109
108
  content,
110
109
  outputPath: templateId.replace("{{srcDir}}", constant("project.srcDir", ""))
111
- };
110
+ });
112
111
  }
113
112
  }
114
113
  }
114
+ pushRenderResult(renderedFile) {
115
+ this.renderedFiles.push(renderedFile);
116
+ return renderedFile;
117
+ }
115
118
  }
116
119
  injectable(CliTemplatesService);