@tsed/cli 6.0.0-beta.1 → 6.0.0-beta.2

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.
@@ -1,7 +1,11 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { CliPlugins, Command, createSubTasks, PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
3
- import { Inject } from "@tsed/di";
1
+ import { __decorate } from "tslib";
2
+ import { CliPlugins, Command, createSubTasks, inject, PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
4
3
  let AddCmd = class AddCmd {
4
+ constructor() {
5
+ this.cliPlugins = inject(CliPlugins);
6
+ this.packageJson = inject(ProjectPackageJson);
7
+ this.packageManagers = inject(PackageManagersModule);
8
+ }
5
9
  $prompt(initialOptions) {
6
10
  return [
7
11
  {
@@ -34,18 +38,6 @@ let AddCmd = class AddCmd {
34
38
  ];
35
39
  }
36
40
  };
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
- __decorate([
46
- Inject(PackageManagersModule),
47
- __metadata("design:type", PackageManagersModule)
48
- ], AddCmd.prototype, "packageManagers", void 0);
49
41
  AddCmd = __decorate([
50
42
  Command({
51
43
  name: "add",
@@ -1,6 +1,6 @@
1
1
  var GenerateCmd_1;
2
2
  import { __decorate, __metadata } from "tslib";
3
- import { Command, Inject, ProjectPackageJson, SrcRendererService } from "@tsed/cli-core";
3
+ import { Command, Inject, inject, ProjectPackageJson, SrcRendererService } from "@tsed/cli-core";
4
4
  import { normalizePath } from "@tsed/normalize-path";
5
5
  import { kebabCase, pascalCase } from "change-case";
6
6
  import { globbySync } from "globby";
@@ -1,5 +1,5 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { CliExeca, CliFs, CliLoadFile, CliPackageJson, CliPlugins, CliService, Command, Configuration, createSubTasks, createTasksRunner, Inject, PackageManager, PackageManagersModule, ProjectPackageJson, RootRendererService } from "@tsed/cli-core";
1
+ import { __decorate } from "tslib";
2
+ import { CliExeca, CliFs, CliLoadFile, cliPackageJson, CliPlugins, CliService, Command, Configuration, createSubTasks, createTasksRunner, Inject, inject, PackageManager, PackageManagersModule, ProjectPackageJson, RootRendererService } from "@tsed/cli-core";
3
3
  import { kebabCase, pascalCase } from "change-case";
4
4
  import { basename, join } from "path";
5
5
  import { DEFAULT_TSED_TAGS } from "../../constants/index.js";
@@ -17,6 +17,21 @@ import { InitFileSchema } from "./config/InitFileSchema.js";
17
17
  import { mapToContext } from "./mappers/mapToContext.js";
18
18
  import { getFeaturesPrompt } from "./prompts/getFeaturesPrompt.js";
19
19
  let InitCmd = class InitCmd {
20
+ constructor() {
21
+ this.configuration = inject(Configuration);
22
+ this.cliPlugins = inject(CliPlugins);
23
+ this.packageJson = inject(ProjectPackageJson);
24
+ this.packageManagers = inject(PackageManagersModule);
25
+ this.runtimes = inject(RuntimesModule);
26
+ this.platforms = inject(InitPlatformsModule);
27
+ this.cliPackageJson = cliPackageJson();
28
+ this.cliService = inject(CliService);
29
+ this.cliLoadFile = inject(CliLoadFile);
30
+ this.rootRenderer = inject(RootRendererService);
31
+ this.outputFilePathPipe = inject(OutputFilePathPipe);
32
+ this.execa = inject(CliExeca);
33
+ this.fs = inject(CliFs);
34
+ }
20
35
  checkPrecondition(ctx) {
21
36
  const isValid = (types, value) => (value ? Object.values(types).includes(value) : true);
22
37
  if (!isValid(PlatformType, ctx.platform)) {
@@ -211,7 +226,7 @@ let InitCmd = class InitCmd {
211
226
  "@tsed/openspec": ctx.tsedVersion,
212
227
  "@tsed/platform-cache": ctx.tsedVersion,
213
228
  "@tsed/platform-exceptions": ctx.tsedVersion,
214
- "@tsed/platform-log-middleware": ctx.tsedVersion,
229
+ "@tsed/platform-log-request": ctx.tsedVersion,
215
230
  "@tsed/platform-middlewares": ctx.tsedVersion,
216
231
  "@tsed/platform-params": ctx.tsedVersion,
217
232
  "@tsed/platform-response-filter": ctx.tsedVersion,
@@ -308,58 +323,6 @@ let InitCmd = class InitCmd {
308
323
  });
309
324
  }
310
325
  };
311
- __decorate([
312
- Configuration(),
313
- __metadata("design:type", Object)
314
- ], InitCmd.prototype, "configuration", void 0);
315
- __decorate([
316
- Inject(),
317
- __metadata("design:type", CliPlugins)
318
- ], InitCmd.prototype, "cliPlugins", void 0);
319
- __decorate([
320
- Inject(),
321
- __metadata("design:type", ProjectPackageJson)
322
- ], InitCmd.prototype, "packageJson", void 0);
323
- __decorate([
324
- Inject(),
325
- __metadata("design:type", PackageManagersModule)
326
- ], InitCmd.prototype, "packageManagers", void 0);
327
- __decorate([
328
- Inject(),
329
- __metadata("design:type", RuntimesModule)
330
- ], InitCmd.prototype, "runtimes", void 0);
331
- __decorate([
332
- Inject(),
333
- __metadata("design:type", InitPlatformsModule)
334
- ], InitCmd.prototype, "platforms", void 0);
335
- __decorate([
336
- CliPackageJson(),
337
- __metadata("design:type", Object)
338
- ], InitCmd.prototype, "cliPackageJson", void 0);
339
- __decorate([
340
- Inject(),
341
- __metadata("design:type", CliService)
342
- ], InitCmd.prototype, "cliService", void 0);
343
- __decorate([
344
- Inject(),
345
- __metadata("design:type", CliLoadFile)
346
- ], InitCmd.prototype, "cliLoadFile", void 0);
347
- __decorate([
348
- Inject(),
349
- __metadata("design:type", RootRendererService)
350
- ], InitCmd.prototype, "rootRenderer", void 0);
351
- __decorate([
352
- Inject(),
353
- __metadata("design:type", OutputFilePathPipe)
354
- ], InitCmd.prototype, "outputFilePathPipe", void 0);
355
- __decorate([
356
- Inject(),
357
- __metadata("design:type", CliExeca)
358
- ], InitCmd.prototype, "execa", void 0);
359
- __decorate([
360
- Inject(),
361
- __metadata("design:type", CliFs)
362
- ], InitCmd.prototype, "fs", void 0);
363
326
  InitCmd = __decorate([
364
327
  Command({
365
328
  name: "init",
@@ -1,7 +1,12 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { CliFs, CliRunScript, Command, normalizePath, ProjectPackageJson } from "@tsed/cli-core";
1
+ import { __decorate } from "tslib";
2
+ import { CliFs, CliRunScript, Command, inject, normalizePath, ProjectPackageJson } from "@tsed/cli-core";
3
3
  import { Inject } from "@tsed/di";
4
4
  let RunCmd = class RunCmd {
5
+ constructor() {
6
+ this.fs = inject(CliFs);
7
+ this.projectPackageJson = inject(ProjectPackageJson);
8
+ this.runScript = inject(CliRunScript);
9
+ }
5
10
  async $exec(ctx) {
6
11
  const cmd = "node";
7
12
  const args = ["--import", "@swc-node/register/register-esm"];
@@ -12,18 +17,6 @@ let RunCmd = class RunCmd {
12
17
  return [];
13
18
  }
14
19
  };
15
- __decorate([
16
- Inject(),
17
- __metadata("design:type", CliFs)
18
- ], RunCmd.prototype, "fs", void 0);
19
- __decorate([
20
- Inject(),
21
- __metadata("design:type", ProjectPackageJson)
22
- ], RunCmd.prototype, "projectPackageJson", void 0);
23
- __decorate([
24
- Inject(),
25
- __metadata("design:type", CliRunScript)
26
- ], RunCmd.prototype, "runScript", void 0);
27
20
  RunCmd = __decorate([
28
21
  Command({
29
22
  name: "run",
@@ -1,5 +1,5 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { CliPackageJson, Command, createSubTasks, Inject, NpmRegistryClient, PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
1
+ import { __decorate } from "tslib";
2
+ import { CliPackageJson, Command, createSubTasks, Inject, inject, NpmRegistryClient, PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
3
3
  import { getValue } from "@tsed/core";
4
4
  import semver from "semver";
5
5
  import { IGNORE_TAGS, IGNORE_VERSIONS, MINIMAL_TSED_VERSION } from "../../constants/index.js";
@@ -15,6 +15,12 @@ function shouldUpdate(pkg) {
15
15
  return pkg.includes("@tsed") && !pkg.includes("@tsed/cli") && !pkg.includes("@tsed/logger");
16
16
  }
17
17
  let UpdateCmd = class UpdateCmd {
18
+ constructor() {
19
+ this.npmRegistryClient = inject(NpmRegistryClient);
20
+ this.projectPackage = inject(ProjectPackageJson);
21
+ this.packageManagers = inject(PackageManagersModule);
22
+ this.cliPackage = inject(CliPackageJson);
23
+ }
18
24
  async $prompt(initialOptions) {
19
25
  const versions = await this.getAvailableVersions();
20
26
  return [
@@ -92,22 +98,6 @@ let UpdateCmd = class UpdateCmd {
92
98
  return version && isGreaterThan(version, this.cliPackage.version) ? version : this.cliPackage.version;
93
99
  }
94
100
  };
95
- __decorate([
96
- Inject(NpmRegistryClient),
97
- __metadata("design:type", NpmRegistryClient)
98
- ], UpdateCmd.prototype, "npmRegistryClient", void 0);
99
- __decorate([
100
- Inject(ProjectPackageJson),
101
- __metadata("design:type", ProjectPackageJson)
102
- ], UpdateCmd.prototype, "projectPackage", void 0);
103
- __decorate([
104
- Inject(PackageManagersModule),
105
- __metadata("design:type", PackageManagersModule)
106
- ], UpdateCmd.prototype, "packageManagers", void 0);
107
- __decorate([
108
- CliPackageJson(),
109
- __metadata("design:type", Object)
110
- ], UpdateCmd.prototype, "cliPackage", void 0);
111
101
  UpdateCmd = __decorate([
112
102
  Command({
113
103
  name: "update",
@@ -4,8 +4,8 @@ const { path, packageJson } = readPackageUpSync({
4
4
  cwd: join(import.meta.dirname, "..", "..")
5
5
  });
6
6
  export const PKG = packageJson;
7
- export const MINIMAL_TSED_VERSION = "7";
8
- export const DEFAULT_TSED_TAGS = "latest";
7
+ export const MINIMAL_TSED_VERSION = "8";
8
+ export const DEFAULT_TSED_TAGS = "beta";
9
9
  export const IGNORE_VERSIONS = ["6.0.0"];
10
10
  export const IGNORE_TAGS = false; // /alpha|beta/
11
11
  export const TEMPLATE_DIR = join(dirname(path), "templates");
@@ -1,11 +1,15 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { Injectable, ProjectPackageJson } from "@tsed/cli-core";
3
- import { Inject } from "@tsed/di";
1
+ import { __decorate } from "tslib";
2
+ import { ProjectPackageJson } from "@tsed/cli-core";
3
+ import { inject, Injectable } from "@tsed/di";
4
4
  import { kebabCase, pascalCase } from "change-case";
5
5
  import { basename } from "path";
6
6
  import { ProjectConvention } from "../interfaces/ProjectConvention.js";
7
7
  import { ProvidersInfoService } from "../services/ProvidersInfoService.js";
8
8
  let ClassNamePipe = class ClassNamePipe {
9
+ constructor() {
10
+ this.providers = inject(ProvidersInfoService);
11
+ this.projectPackageJson = inject(ProjectPackageJson);
12
+ }
9
13
  transform(options) {
10
14
  const format = options.format || this.projectPackageJson.preferences.convention || ProjectConvention.DEFAULT;
11
15
  const meta = this.providers.get(options.type)?.model || "{{symbolName}}.{{symbolType}}?";
@@ -26,14 +30,6 @@ let ClassNamePipe = class ClassNamePipe {
26
30
  return [...names].join(".").toLowerCase();
27
31
  }
28
32
  };
29
- __decorate([
30
- Inject(),
31
- __metadata("design:type", ProvidersInfoService)
32
- ], ClassNamePipe.prototype, "providers", void 0);
33
- __decorate([
34
- Inject(),
35
- __metadata("design:type", ProjectPackageJson)
36
- ], ClassNamePipe.prototype, "projectPackageJson", void 0);
37
33
  ClassNamePipe = __decorate([
38
34
  Injectable()
39
35
  ], ClassNamePipe);
@@ -1,13 +1,15 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { Injectable, ProjectPackageJson } from "@tsed/cli-core";
1
+ import { __decorate } from "tslib";
2
+ import { inject, Injectable, ProjectPackageJson } from "@tsed/cli-core";
3
3
  import { Inject } from "@tsed/di";
4
4
  import { dirname, join } from "path";
5
5
  import { ArchitectureConvention, ProjectConvention } from "../interfaces/index.js";
6
6
  import { ProvidersInfoService } from "../services/ProvidersInfoService.js";
7
7
  import { ClassNamePipe } from "./ClassNamePipe.js";
8
8
  let OutputFilePathPipe = class OutputFilePathPipe {
9
- constructor(classNamePipe) {
10
- this.classNamePipe = classNamePipe;
9
+ constructor() {
10
+ this.providers = inject(ProvidersInfoService);
11
+ this.projectPackageJson = inject(ProjectPackageJson);
12
+ this.classNamePipe = inject(ClassNamePipe);
11
13
  }
12
14
  transform(options) {
13
15
  options.format = options.format || this.projectPackageJson.preferences.convention || ProjectConvention.DEFAULT;
@@ -19,16 +21,7 @@ let OutputFilePathPipe = class OutputFilePathPipe {
19
21
  return join(baseDir, options.subDir || "", featureDir, this.classNamePipe.transform(options));
20
22
  }
21
23
  };
22
- __decorate([
23
- Inject(),
24
- __metadata("design:type", ProvidersInfoService)
25
- ], OutputFilePathPipe.prototype, "providers", void 0);
26
- __decorate([
27
- Inject(),
28
- __metadata("design:type", ProjectPackageJson)
29
- ], OutputFilePathPipe.prototype, "projectPackageJson", void 0);
30
24
  OutputFilePathPipe = __decorate([
31
- Injectable(),
32
- __metadata("design:paramtypes", [ClassNamePipe])
25
+ Injectable()
33
26
  ], OutputFilePathPipe);
34
27
  export { OutputFilePathPipe };
@@ -1,11 +1,11 @@
1
- import { __decorate, __metadata, __param } from "tslib";
2
- import { Inject } from "@tsed/cli-core";
1
+ import { __decorate } from "tslib";
2
+ import { Inject, injectMany } from "@tsed/cli-core";
3
3
  import { Module } from "@tsed/di";
4
4
  import { InitExpressPlatform } from "./supports/InitExpressPlatform.js";
5
5
  import { InitKoaPlatform } from "./supports/InitKoaPlatform.js";
6
6
  let InitPlatformsModule = class InitPlatformsModule {
7
- constructor(platforms) {
8
- this.platforms = platforms;
7
+ constructor() {
8
+ this.platforms = injectMany("platform:init");
9
9
  }
10
10
  get(name) {
11
11
  return this.platforms.find((platform) => platform.name === name);
@@ -14,8 +14,6 @@ let InitPlatformsModule = class InitPlatformsModule {
14
14
  InitPlatformsModule = __decorate([
15
15
  Module({
16
16
  imports: [InitExpressPlatform, InitKoaPlatform]
17
- }),
18
- __param(0, Inject("platform:init")),
19
- __metadata("design:paramtypes", [Array])
17
+ })
20
18
  ], InitPlatformsModule);
21
19
  export { InitPlatformsModule };
@@ -1,6 +1,6 @@
1
1
  import { __decorate, __metadata, __param } from "tslib";
2
2
  import { PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
3
- import { Inject, Module } from "@tsed/di";
3
+ import { Inject, inject, Module } from "@tsed/di";
4
4
  import { BabelRuntime } from "./supports/BabelRuntime.js";
5
5
  import { BaseRuntime } from "./supports/BaseRuntime.js";
6
6
  import { BunRuntime } from "./supports/BunRuntime.js";
@@ -9,6 +9,8 @@ import { WebpackRuntime } from "./supports/WebpackRuntime.js";
9
9
  let RuntimesModule = class RuntimesModule {
10
10
  constructor(runtimes) {
11
11
  this.runtimes = runtimes;
12
+ this.projectPackageJson = inject(ProjectPackageJson);
13
+ this.packagesManager = inject(PackageManagersModule);
12
14
  this.runtimes = runtimes.filter((manager) => manager.has());
13
15
  }
14
16
  init(ctx) {
@@ -42,14 +44,6 @@ let RuntimesModule = class RuntimesModule {
42
44
  };
43
45
  }
44
46
  };
45
- __decorate([
46
- Inject(),
47
- __metadata("design:type", ProjectPackageJson)
48
- ], RuntimesModule.prototype, "projectPackageJson", void 0);
49
- __decorate([
50
- Inject(),
51
- __metadata("design:type", PackageManagersModule)
52
- ], RuntimesModule.prototype, "packagesManager", void 0);
53
47
  RuntimesModule = __decorate([
54
48
  Module({
55
49
  imports: [NodeRuntime, BabelRuntime, WebpackRuntime, BunRuntime]
@@ -13,6 +13,7 @@ export function fillImports(ctx) {
13
13
  ctx.graphql && "./src/resolvers"
14
14
  ].filter(Boolean));
15
15
  ctx.imports = [
16
+ { from: "@tsed/platform-log-request", comment: " // remove this import if you don't want log request" },
16
17
  ctx.express && { from: "@tsed/platform-express", comment: " // /!\\ keep this import" },
17
18
  ctx.koa && { from: "@tsed/platform-koa", comment: " // /!\\ keep this import" },
18
19
  { from: "@tsed/ajv" },