@tsed/cli 7.0.1 → 7.1.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/esm/commands/template/CreateTemplateCommand.js +3 -1
- package/lib/esm/services/CliStats.js +3 -1
- package/lib/esm/services/CliTemplatesService.js +6 -7
- package/lib/esm/templates/new-template.template.js +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/services/CliStats.d.ts +3 -0
- package/package.json +6 -6
- package/templates/views/home.ejs +3 -0
|
@@ -59,7 +59,9 @@ export class CreateTemplateCommand {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
$exec(ctx) {
|
|
62
|
-
this.projectPackageJson.
|
|
62
|
+
if (this.projectPackageJson.devDependencies["@tsed/cli"] === undefined) {
|
|
63
|
+
this.projectPackageJson.addDevDependencies({ "@tsed/cli": PKG.version });
|
|
64
|
+
}
|
|
63
65
|
return [
|
|
64
66
|
{
|
|
65
67
|
title: "Generate " + ctx.from === "new" ? `new template ${ctx.templateId}` : `template ${ctx.templateId} from ${ctx.from}`,
|
|
@@ -10,13 +10,13 @@ export class CliStats extends CliHttpClient {
|
|
|
10
10
|
}
|
|
11
11
|
sendInit(opts) {
|
|
12
12
|
if (!this.disabled) {
|
|
13
|
-
console.log();
|
|
14
13
|
const data = {
|
|
15
14
|
features: [],
|
|
16
15
|
is_success: true,
|
|
17
16
|
...opts,
|
|
18
17
|
os: os.type(),
|
|
19
18
|
convention: this.projectPackage.preferences.convention === "conv_default" ? "tsed" : "angular",
|
|
19
|
+
style: this.projectPackage.preferences.architecture === "arc_default" ? "tsed" : "angular",
|
|
20
20
|
platform: this.projectPackage.preferences.platform,
|
|
21
21
|
package_manager: this.projectPackage.preferences.packageManager,
|
|
22
22
|
runtime: this.projectPackage.preferences.runtime,
|
|
@@ -36,6 +36,8 @@ export class CliStats extends CliHttpClient {
|
|
|
36
36
|
return this.sendInit({
|
|
37
37
|
channel: "cli",
|
|
38
38
|
is_success: !er,
|
|
39
|
+
error_name: er?.name || "",
|
|
40
|
+
error_message: er?.message,
|
|
39
41
|
features: data.features
|
|
40
42
|
});
|
|
41
43
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { CliFs } from "@tsed/cli-core";
|
|
3
|
-
import { constant, context, inject, injectable, injectMany, logger } from "@tsed/di";
|
|
3
|
+
import { constant, context, inject, injectable, injectMany, lazyInject, logger } from "@tsed/di";
|
|
4
4
|
import { globby } from "globby";
|
|
5
5
|
import { TEMPLATE_DIR } from "../constants/index.js";
|
|
6
6
|
import { mapDefaultTemplateOptions } from "./mappers/mapDefaultTemplateOptions.js";
|
|
@@ -29,18 +29,17 @@ export class CliTemplatesService {
|
|
|
29
29
|
});
|
|
30
30
|
const promises = files.map(async (file) => {
|
|
31
31
|
try {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
if (token) {
|
|
35
|
-
return inject(token);
|
|
36
|
-
}
|
|
32
|
+
const modulePath = join(this.templatesDir, file);
|
|
33
|
+
return await lazyInject(() => import(modulePath));
|
|
37
34
|
}
|
|
38
35
|
catch (er) {
|
|
39
36
|
logger().warn("Unable to load custom template %s: %s", file, er.message);
|
|
40
37
|
}
|
|
41
38
|
});
|
|
42
39
|
let customs = await Promise.all(promises);
|
|
43
|
-
this.#customTemplates = customs
|
|
40
|
+
this.#customTemplates = customs
|
|
41
|
+
.filter((template) => !!template)
|
|
42
|
+
.map((template) => {
|
|
44
43
|
return {
|
|
45
44
|
...template,
|
|
46
45
|
label: template.label + " (custom)"
|