@tsed/cli 6.0.0-alpha.8 → 6.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.
- package/lib/esm/Cli.js +0 -1
- package/lib/esm/bin/tsed.js +2 -2
- package/lib/esm/commands/add/AddCmd.js +0 -1
- package/lib/esm/commands/generate/GenerateCmd.js +6 -7
- package/lib/esm/commands/generate/ProviderTypes.js +0 -1
- package/lib/esm/commands/index.js +0 -1
- package/lib/esm/commands/init/InitCmd.js +4 -5
- package/lib/esm/commands/init/config/FeaturesPrompt.js +0 -1
- package/lib/esm/commands/init/config/InitFileSchema.js +0 -1
- package/lib/esm/commands/init/interfaces/InitCmdContext.js +0 -1
- package/lib/esm/commands/init/interfaces/InitOptions.js +0 -1
- package/lib/esm/commands/init/interfaces/InitPromptAnswers.js +0 -1
- package/lib/esm/commands/init/mappers/mapToContext.js +0 -1
- package/lib/esm/commands/init/mappers/mapUniqFeatures.js +0 -1
- package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +0 -1
- package/lib/esm/commands/init/utils/hasFeature.js +0 -1
- package/lib/esm/commands/init/utils/isPlatform.js +0 -1
- package/lib/esm/commands/run/RunCmd.js +0 -1
- package/lib/esm/commands/update/UpdateCmd.js +0 -1
- package/lib/esm/constants/index.js +2 -3
- package/lib/esm/index.js +0 -1
- package/lib/esm/interfaces/ArchitectureConvention.js +0 -1
- package/lib/esm/interfaces/PlatformType.js +0 -1
- package/lib/esm/interfaces/ProjectConvention.js +0 -1
- package/lib/esm/interfaces/index.js +0 -1
- package/lib/esm/loaders/alias.hook.js +0 -1
- package/lib/esm/pipes/ClassNamePipe.js +2 -3
- package/lib/esm/pipes/OutputFilePathPipe.js +0 -1
- package/lib/esm/pipes/RoutePipe.js +3 -4
- package/lib/esm/pipes/index.js +0 -1
- package/lib/esm/platforms/InitPlatformsModule.js +0 -1
- package/lib/esm/platforms/supports/InitBasePlatform.js +0 -1
- package/lib/esm/platforms/supports/InitExpressPlatform.js +0 -1
- package/lib/esm/platforms/supports/InitKoaPlatform.js +0 -1
- package/lib/esm/runtimes/RuntimesModule.js +0 -1
- package/lib/esm/runtimes/index.js +0 -1
- package/lib/esm/runtimes/supports/BabelRuntime.js +0 -1
- package/lib/esm/runtimes/supports/BaseRuntime.js +0 -1
- package/lib/esm/runtimes/supports/BunRuntime.js +0 -1
- package/lib/esm/runtimes/supports/NodeRuntime.js +0 -1
- package/lib/esm/runtimes/supports/WebpackRuntime.js +0 -1
- package/lib/esm/services/ProvidersInfoService.js +0 -1
- package/lib/esm/utils/fillImports.js +0 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/Cli.d.ts +1 -1
- package/lib/types/constants/index.d.ts +1 -1
- package/package.json +41 -41
- package/lib/esm/Cli.js.map +0 -1
- package/lib/esm/bin/tsed.js.map +0 -1
- package/lib/esm/commands/add/AddCmd.js.map +0 -1
- package/lib/esm/commands/generate/GenerateCmd.js.map +0 -1
- package/lib/esm/commands/generate/ProviderTypes.js.map +0 -1
- package/lib/esm/commands/index.js.map +0 -1
- package/lib/esm/commands/init/InitCmd.js.map +0 -1
- package/lib/esm/commands/init/config/FeaturesPrompt.js.map +0 -1
- package/lib/esm/commands/init/config/InitFileSchema.js.map +0 -1
- package/lib/esm/commands/init/interfaces/InitCmdContext.js.map +0 -1
- package/lib/esm/commands/init/interfaces/InitOptions.js.map +0 -1
- package/lib/esm/commands/init/interfaces/InitPromptAnswers.js.map +0 -1
- package/lib/esm/commands/init/mappers/mapToContext.js.map +0 -1
- package/lib/esm/commands/init/mappers/mapUniqFeatures.js.map +0 -1
- package/lib/esm/commands/init/prompts/getFeaturesPrompt.js.map +0 -1
- package/lib/esm/commands/init/utils/hasFeature.js.map +0 -1
- package/lib/esm/commands/init/utils/isPlatform.js.map +0 -1
- package/lib/esm/commands/run/RunCmd.js.map +0 -1
- package/lib/esm/commands/update/UpdateCmd.js.map +0 -1
- package/lib/esm/constants/index.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/interfaces/ArchitectureConvention.js.map +0 -1
- package/lib/esm/interfaces/PlatformType.js.map +0 -1
- package/lib/esm/interfaces/ProjectConvention.js.map +0 -1
- package/lib/esm/interfaces/index.js.map +0 -1
- package/lib/esm/loaders/alias.hook.js.map +0 -1
- package/lib/esm/pipes/ClassNamePipe.js.map +0 -1
- package/lib/esm/pipes/OutputFilePathPipe.js.map +0 -1
- package/lib/esm/pipes/RoutePipe.js.map +0 -1
- package/lib/esm/pipes/index.js.map +0 -1
- package/lib/esm/platforms/InitPlatformsModule.js.map +0 -1
- package/lib/esm/platforms/supports/InitBasePlatform.js.map +0 -1
- package/lib/esm/platforms/supports/InitExpressPlatform.js.map +0 -1
- package/lib/esm/platforms/supports/InitKoaPlatform.js.map +0 -1
- package/lib/esm/runtimes/RuntimesModule.js.map +0 -1
- package/lib/esm/runtimes/index.js.map +0 -1
- package/lib/esm/runtimes/supports/BabelRuntime.js.map +0 -1
- package/lib/esm/runtimes/supports/BaseRuntime.js.map +0 -1
- package/lib/esm/runtimes/supports/BunRuntime.js.map +0 -1
- package/lib/esm/runtimes/supports/NodeRuntime.js.map +0 -1
- package/lib/esm/runtimes/supports/WebpackRuntime.js.map +0 -1
- package/lib/esm/services/ProvidersInfoService.js.map +0 -1
- package/lib/esm/utils/fillImports.js.map +0 -1
package/lib/esm/Cli.js
CHANGED
package/lib/esm/bin/tsed.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { register } from "node:module";
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
-
|
|
4
|
+
const EXT = process.env.CLI_MODE === "ts" ? "ts" : "js";
|
|
5
|
+
register(pathToFileURL(`${import.meta.dirname}/../loaders/alias.hook.${EXT}`), {
|
|
5
6
|
parentURL: import.meta.dirname,
|
|
6
7
|
data: {
|
|
7
8
|
"@tsed/core": fileURLToPath(import.meta.resolve("@tsed/core")),
|
|
@@ -17,4 +18,3 @@ Cli.bootstrap({}).catch((error) => {
|
|
|
17
18
|
console.error(error);
|
|
18
19
|
process.exit(-1);
|
|
19
20
|
});
|
|
20
|
-
//# sourceMappingURL=tsed.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var GenerateCmd_1;
|
|
2
2
|
import { __decorate, __metadata } from "tslib";
|
|
3
3
|
import { Command, Inject, ProjectPackageJson, SrcRendererService } from "@tsed/cli-core";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { normalizePath } from "@tsed/normalize-path";
|
|
5
|
+
import { kebabCase, pascalCase } from "change-case";
|
|
6
|
+
import { globbySync } from "globby";
|
|
7
7
|
import { basename, dirname, join } from "path";
|
|
8
8
|
import { ProjectConvention } from "../../interfaces/ProjectConvention.js";
|
|
9
9
|
import { ClassNamePipe } from "../../pipes/ClassNamePipe.js";
|
|
@@ -131,7 +131,7 @@ let GenerateCmd = GenerateCmd_1 = class GenerateCmd {
|
|
|
131
131
|
type = "prisma.service";
|
|
132
132
|
}
|
|
133
133
|
const symbolName = this.classNamePipe.transform({ name, type, format: ProjectConvention.DEFAULT });
|
|
134
|
-
const symbolParamName =
|
|
134
|
+
const symbolParamName = kebabCase(symbolName);
|
|
135
135
|
return fillImports({
|
|
136
136
|
...ctx,
|
|
137
137
|
type,
|
|
@@ -183,7 +183,7 @@ let GenerateCmd = GenerateCmd_1 = class GenerateCmd {
|
|
|
183
183
|
return [];
|
|
184
184
|
}
|
|
185
185
|
getDirectories(dir) {
|
|
186
|
-
const directories =
|
|
186
|
+
const directories = globbySync("**/*", {
|
|
187
187
|
cwd: join(this.srcRenderService.rootDir, dir),
|
|
188
188
|
ignore: ["__*"]
|
|
189
189
|
});
|
|
@@ -230,7 +230,7 @@ GenerateCmd = GenerateCmd_1 = __decorate([
|
|
|
230
230
|
}
|
|
231
231
|
},
|
|
232
232
|
options: {
|
|
233
|
-
"
|
|
233
|
+
"--route <route>": {
|
|
234
234
|
type: String,
|
|
235
235
|
description: "The route for the controller generated file"
|
|
236
236
|
},
|
|
@@ -251,4 +251,3 @@ GenerateCmd = GenerateCmd_1 = __decorate([
|
|
|
251
251
|
__metadata("design:paramtypes", [ProvidersInfoService])
|
|
252
252
|
], GenerateCmd);
|
|
253
253
|
export { GenerateCmd };
|
|
254
|
-
//# sourceMappingURL=GenerateCmd.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { CliExeca, CliFs, CliLoadFile, CliPackageJson, CliPlugins, CliService, Command, Configuration, createSubTasks, createTasksRunner, Inject, PackageManager, PackageManagersModule, ProjectPackageJson, RootRendererService } from "@tsed/cli-core";
|
|
3
|
-
import {
|
|
3
|
+
import { kebabCase, pascalCase } from "change-case";
|
|
4
4
|
import { basename, join } from "path";
|
|
5
5
|
import { DEFAULT_TSED_TAGS } from "../../constants/index.js";
|
|
6
6
|
import { ArchitectureConvention } from "../../interfaces/ArchitectureConvention.js";
|
|
@@ -66,10 +66,10 @@ let InitCmd = class InitCmd {
|
|
|
66
66
|
type: "input",
|
|
67
67
|
name: "projectName",
|
|
68
68
|
message: "What is your project name",
|
|
69
|
-
default:
|
|
69
|
+
default: kebabCase(initialOptions.root),
|
|
70
70
|
when: initialOptions.root !== ".",
|
|
71
71
|
transformer(input) {
|
|
72
|
-
return
|
|
72
|
+
return kebabCase(input);
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
...getFeaturesPrompt(runtimes, packageManagers.filter((o) => o !== "bun"), initialOptions)
|
|
@@ -184,7 +184,7 @@ let InitCmd = class InitCmd {
|
|
|
184
184
|
];
|
|
185
185
|
}
|
|
186
186
|
resolveRootDir(ctx) {
|
|
187
|
-
const rootDirName =
|
|
187
|
+
const rootDirName = kebabCase(ctx.projectName || basename(this.packageJson.dir));
|
|
188
188
|
if (this.packageJson.dir.endsWith(rootDirName)) {
|
|
189
189
|
ctx.projectName = ctx.projectName || rootDirName;
|
|
190
190
|
ctx.root = ".";
|
|
@@ -427,4 +427,3 @@ InitCmd = __decorate([
|
|
|
427
427
|
})
|
|
428
428
|
], InitCmd);
|
|
429
429
|
export { InitCmd };
|
|
430
|
-
//# sourceMappingURL=InitCmd.js.map
|
|
@@ -3,4 +3,3 @@ import { ArchitectureConvention } from "../../../interfaces/ArchitectureConventi
|
|
|
3
3
|
import { PlatformType } from "../../../interfaces/PlatformType.js";
|
|
4
4
|
import { ProjectConvention } from "../../../interfaces/ProjectConvention.js";
|
|
5
5
|
import { FeatureType } from "../config/FeaturesPrompt.js";
|
|
6
|
-
//# sourceMappingURL=InitOptions.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dirname, join } from "path";
|
|
2
|
-
import
|
|
3
|
-
const { path, packageJson } =
|
|
2
|
+
import { readPackageUpSync } from "read-pkg-up";
|
|
3
|
+
const { path, packageJson } = readPackageUpSync({
|
|
4
4
|
cwd: join(import.meta.dirname, "..", "..")
|
|
5
5
|
});
|
|
6
6
|
export const PKG = packageJson;
|
|
@@ -9,4 +9,3 @@ export const DEFAULT_TSED_TAGS = "latest";
|
|
|
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");
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Injectable, ProjectPackageJson } from "@tsed/cli-core";
|
|
3
3
|
import { Inject } from "@tsed/di";
|
|
4
|
-
import {
|
|
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";
|
|
@@ -10,7 +10,7 @@ let ClassNamePipe = class ClassNamePipe {
|
|
|
10
10
|
const format = options.format || this.projectPackageJson.preferences.convention || ProjectConvention.DEFAULT;
|
|
11
11
|
const meta = this.providers.get(options.type)?.model || "{{symbolName}}.{{symbolType}}?";
|
|
12
12
|
const type = options.type.split(":").at(-1);
|
|
13
|
-
const symbolName =
|
|
13
|
+
const symbolName = kebabCase(basename(options.name)).replace(`-${type}`, "");
|
|
14
14
|
const names = meta.split(".").reduce((acc, key) => {
|
|
15
15
|
return key
|
|
16
16
|
.replace(/{{symbolName}}/gi, symbolName)
|
|
@@ -38,4 +38,3 @@ ClassNamePipe = __decorate([
|
|
|
38
38
|
Injectable()
|
|
39
39
|
], ClassNamePipe);
|
|
40
40
|
export { ClassNamePipe };
|
|
41
|
-
//# sourceMappingURL=ClassNamePipe.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { Injectable } from "@tsed/cli-core";
|
|
3
|
-
import {
|
|
3
|
+
import { kebabCase } from "change-case";
|
|
4
4
|
let RoutePipe = class RoutePipe {
|
|
5
5
|
transform(route) {
|
|
6
6
|
const r = route
|
|
7
7
|
.split("/")
|
|
8
8
|
.reduce((paths, path) => {
|
|
9
|
-
const word =
|
|
9
|
+
const word = kebabCase(path);
|
|
10
10
|
if (paths.includes(`${word}s`) || paths.includes(word)) {
|
|
11
11
|
return paths;
|
|
12
12
|
}
|
|
13
|
-
return [...paths,
|
|
13
|
+
return [...paths, kebabCase(path)];
|
|
14
14
|
}, [])
|
|
15
15
|
.join("/");
|
|
16
16
|
return `/${r}`.replace(/\/\//gi, "/");
|
|
@@ -20,4 +20,3 @@ RoutePipe = __decorate([
|
|
|
20
20
|
Injectable()
|
|
21
21
|
], RoutePipe);
|
|
22
22
|
export { RoutePipe };
|
|
23
|
-
//# sourceMappingURL=RoutePipe.js.map
|
package/lib/esm/pipes/index.js
CHANGED