@tsed/cli 3.25.0 → 3.26.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/cjs/Cli.js.map +1 -1
- package/lib/cjs/commands/generate/GenerateCmd.js +4 -8
- package/lib/cjs/commands/generate/GenerateCmd.js.map +1 -1
- package/lib/cjs/commands/init/InitCmd.js +102 -40
- package/lib/cjs/commands/init/InitCmd.js.map +1 -1
- package/lib/cjs/commands/init/config/FeaturesPrompt.js +406 -0
- package/lib/cjs/commands/init/config/FeaturesPrompt.js.map +1 -0
- package/lib/cjs/commands/init/config/InitFileSchema.js +53 -0
- package/lib/cjs/commands/init/config/InitFileSchema.js.map +1 -0
- package/lib/cjs/commands/init/interfaces/InitCmdContext.js +3 -0
- package/lib/cjs/commands/init/interfaces/InitCmdContext.js.map +1 -0
- package/lib/cjs/commands/init/interfaces/InitOptions.js +3 -0
- package/lib/cjs/commands/init/interfaces/InitOptions.js.map +1 -0
- package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js +3 -0
- package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
- package/lib/cjs/commands/init/mappers/mapToContext.js +16 -0
- package/lib/cjs/commands/init/mappers/mapToContext.js.map +1 -0
- package/lib/cjs/commands/init/mappers/mapUniqFeatures.js +18 -0
- package/lib/cjs/commands/init/mappers/mapUniqFeatures.js.map +1 -0
- package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js +25 -0
- package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
- package/lib/cjs/commands/init/utils/hasFeature.js +13 -0
- package/lib/cjs/commands/init/utils/hasFeature.js.map +1 -0
- package/lib/cjs/commands/init/utils/isPlatform.js +8 -0
- package/lib/cjs/commands/init/utils/isPlatform.js.map +1 -0
- package/lib/cjs/index.js +5 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/PlatformType.js +9 -0
- package/lib/cjs/interfaces/PlatformType.js.map +1 -0
- package/lib/cjs/interfaces/index.js +1 -0
- package/lib/cjs/interfaces/index.js.map +1 -1
- package/lib/cjs/utils/fillImports.js +48 -0
- package/lib/cjs/utils/fillImports.js.map +1 -0
- package/lib/esm/Cli.js.map +1 -1
- package/lib/esm/commands/generate/GenerateCmd.js +4 -8
- package/lib/esm/commands/generate/GenerateCmd.js.map +1 -1
- package/lib/esm/commands/init/InitCmd.js +105 -43
- package/lib/esm/commands/init/InitCmd.js.map +1 -1
- package/lib/esm/commands/init/config/FeaturesPrompt.js +402 -0
- package/lib/esm/commands/init/config/FeaturesPrompt.js.map +1 -0
- package/lib/esm/commands/init/config/InitFileSchema.js +50 -0
- package/lib/esm/commands/init/config/InitFileSchema.js.map +1 -0
- package/lib/esm/commands/init/interfaces/InitCmdContext.js +2 -0
- package/lib/esm/commands/init/interfaces/InitCmdContext.js.map +1 -0
- package/lib/esm/commands/init/interfaces/InitOptions.js +2 -0
- package/lib/esm/commands/init/interfaces/InitOptions.js.map +1 -0
- package/lib/esm/commands/init/interfaces/InitPromptAnswers.js +2 -0
- package/lib/esm/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
- package/lib/esm/commands/init/mappers/mapToContext.js +12 -0
- package/lib/esm/commands/init/mappers/mapToContext.js.map +1 -0
- package/lib/esm/commands/init/mappers/mapUniqFeatures.js +14 -0
- package/lib/esm/commands/init/mappers/mapUniqFeatures.js.map +1 -0
- package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +21 -0
- package/lib/esm/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
- package/lib/esm/commands/init/utils/hasFeature.js +8 -0
- package/lib/esm/commands/init/utils/hasFeature.js.map +1 -0
- package/lib/esm/commands/init/utils/isPlatform.js +4 -0
- package/lib/esm/commands/init/utils/isPlatform.js.map +1 -0
- package/lib/esm/index.js +5 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/PlatformType.js +6 -0
- package/lib/esm/interfaces/PlatformType.js.map +1 -0
- package/lib/esm/interfaces/index.js +1 -0
- package/lib/esm/interfaces/index.js.map +1 -1
- package/lib/esm/utils/fillImports.js +44 -0
- package/lib/esm/utils/fillImports.js.map +1 -0
- package/lib/types/Cli.d.ts +2 -2
- package/lib/types/commands/init/InitCmd.d.ts +9 -24
- package/lib/types/commands/init/config/FeaturesPrompt.d.ts +98 -0
- package/lib/types/commands/init/config/InitFileSchema.d.ts +49 -0
- package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +6 -0
- package/lib/types/commands/init/interfaces/InitOptions.d.ts +19 -0
- package/lib/types/commands/init/interfaces/InitPromptAnswers.d.ts +16 -0
- package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -0
- package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +3 -0
- package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +2 -0
- package/lib/types/commands/init/utils/hasFeature.d.ts +2 -0
- package/lib/types/commands/init/utils/isPlatform.d.ts +1 -0
- package/lib/types/index.d.ts +5 -1
- package/lib/types/interfaces/PlatformType.d.ts +4 -0
- package/lib/types/interfaces/index.d.ts +1 -0
- package/lib/types/utils/fillImports.d.ts +1 -0
- package/package.json +4 -2
- package/readme.md +97 -0
- package/templates/generate/server.hbs +4 -23
- package/templates/init/.barrelsby.json.hbs +1 -7
- package/lib/cjs/services/Features.js +0 -528
- package/lib/cjs/services/Features.js.map +0 -1
- package/lib/esm/services/Features.js +0 -519
- package/lib/esm/services/Features.js.map +0 -1
- package/lib/types/services/Features.d.ts +0 -412
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitOptions.js","sourceRoot":"","sources":["../../../../../src/commands/init/interfaces/InitOptions.ts"],"names":[],"mappings":"","sourcesContent":["import {PackageManager} from \"@tsed/cli-core\";\nimport {PlatformType} from \"../../../interfaces/PlatformType\";\nimport {ArchitectureConvention} from \"../../../interfaces/ArchitectureConvention\";\nimport {ProjectConvention} from \"../../../interfaces/ProjectConvention\";\nimport {FeatureType} from \"../config/FeaturesPrompt\";\n\nexport interface InitOptions {\n root: string;\n projectName: string;\n features: FeatureType[];\n skipPrompt: boolean;\n platform: PlatformType;\n tsedVersion: string;\n cliVersion: string;\n architecture: ArchitectureConvention;\n convention: ProjectConvention;\n packageManager: PackageManager;\n oidcBasePath: string;\n file: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitPromptAnswers.js","sourceRoot":"","sources":["../../../../../src/commands/init/interfaces/InitPromptAnswers.ts"],"names":[],"mappings":"","sourcesContent":["import {PackageManager} from \"@tsed/cli-core\";\nimport {ArchitectureConvention, PlatformType, ProjectConvention} from \"../../../interfaces\";\n\nexport interface InitPromptAnswers {\n projectName: string;\n platform: PlatformType;\n architecture: ArchitectureConvention;\n convention: ProjectConvention;\n features: string[];\n featuresDB: string[];\n featuresTypeORM: string;\n featuresTesting: string;\n featuresExtraLinter: string[];\n featuresBundler: string;\n oidcBasePath: string;\n packageManager: PackageManager;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { camelCase } from "change-case";
|
|
2
|
+
import { mapUniqFeatures } from "./mapUniqFeatures.js";
|
|
3
|
+
export function mapToContext(options) {
|
|
4
|
+
options = mapUniqFeatures(options);
|
|
5
|
+
options.features.forEach((feature) => {
|
|
6
|
+
feature.split(":").forEach((type) => {
|
|
7
|
+
options[camelCase(type)] = true;
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
return options;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=mapToContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapToContext.js","sourceRoot":"","sources":["../../../../../src/commands/init/mappers/mapToContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,MAAM,UAAU,YAAY,CAAC,OAAY;IACvC,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAEnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAe,EAAE,EAAE;QAC3C,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAClC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import {camelCase} from \"change-case\";\nimport {InitCmdContext} from \"../interfaces/InitCmdContext\";\nimport {mapUniqFeatures} from \"./mapUniqFeatures\";\n\nexport function mapToContext(options: any): InitCmdContext {\n options = mapUniqFeatures(options);\n\n options.features.forEach((feature: string) => {\n feature.split(\":\").forEach((type) => {\n options[camelCase(type)] = true;\n });\n });\n\n return options;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function mapUniqFeatures(answers) {
|
|
2
|
+
const features = [];
|
|
3
|
+
Object.entries(answers)
|
|
4
|
+
.filter(([key]) => key.startsWith("features"))
|
|
5
|
+
.forEach(([key, value]) => {
|
|
6
|
+
delete answers[key];
|
|
7
|
+
features.push(...[].concat(value));
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
...answers,
|
|
11
|
+
features: [...new Set(features).values()]
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=mapUniqFeatures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapUniqFeatures.js","sourceRoot":"","sources":["../../../../../src/commands/init/mappers/mapUniqFeatures.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,eAAe,CAAC,OAAgC;IAC9D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SAC7C,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAQ,EAAE,EAAE;QAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEL,OAAO;QACL,GAAG,OAAO;QACV,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAkB;KAC3D,CAAC;AACJ,CAAC","sourcesContent":["import {InitPromptAnswers} from \"../interfaces/InitPromptAnswers\";\nimport {InitOptions} from \"../interfaces/InitOptions\";\nimport {FeatureType} from \"../config/FeaturesPrompt\";\n\nexport function mapUniqFeatures(answers: InitPromptAnswers & any): InitOptions {\n const features: string[] = [];\n\n Object.entries(answers)\n .filter(([key]) => key.startsWith(\"features\"))\n .forEach(([key, value]: any[]) => {\n delete answers[key];\n features.push(...[].concat(value));\n });\n\n return {\n ...answers,\n features: [...new Set(features).values()] as FeatureType[]\n };\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cleanObject, isFunction } from "@tsed/core";
|
|
2
|
+
import { FeaturesMap, FeaturesPrompt } from "../config/FeaturesPrompt.js";
|
|
3
|
+
function mapChoices(item, options) {
|
|
4
|
+
return item.choices.map((choice) => {
|
|
5
|
+
const { checked } = FeaturesMap[choice];
|
|
6
|
+
return cleanObject({
|
|
7
|
+
...FeaturesMap[choice],
|
|
8
|
+
value: choice,
|
|
9
|
+
checked: isFunction(checked) ? checked(options) : checked
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export function getFeaturesPrompt(options) {
|
|
14
|
+
return FeaturesPrompt().map((item) => {
|
|
15
|
+
return cleanObject({
|
|
16
|
+
...item,
|
|
17
|
+
choices: item.choices?.length ? mapChoices(item, options) : undefined
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=getFeaturesPrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFeaturesPrompt.js","sourceRoot":"","sources":["../../../../../src/commands/init/prompts/getFeaturesPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAGrE,SAAS,UAAU,CAAC,IAAS,EAAE,OAA6B;IAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE;QACzC,MAAM,EAAC,OAAO,EAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QAEtC,OAAO,WAAW,CAAC;YACjB,GAAG,WAAW,CAAC,MAAM,CAAC;YACtB,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;SAC1D,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAA6B;IAC7D,OAAO,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;QACxC,OAAO,WAAW,CAAC;YACjB,GAAG,IAAI;YACP,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;SACtE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {cleanObject, isFunction} from \"@tsed/core\";\nimport {FeaturesMap, FeaturesPrompt} from \"../config/FeaturesPrompt\";\nimport {InitOptions} from \"../interfaces/InitOptions\";\n\nfunction mapChoices(item: any, options: Partial<InitOptions>) {\n return item.choices.map((choice: string) => {\n const {checked} = FeaturesMap[choice];\n\n return cleanObject({\n ...FeaturesMap[choice],\n value: choice,\n checked: isFunction(checked) ? checked(options) : checked\n });\n });\n}\n\nexport function getFeaturesPrompt(options: Partial<InitOptions>) {\n return FeaturesPrompt().map((item: any) => {\n return cleanObject({\n ...item,\n choices: item.choices?.length ? mapChoices(item, options) : undefined\n });\n });\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getValue } from "@tsed/core";
|
|
2
|
+
export function hasValue(expression, value) {
|
|
3
|
+
return (ctx) => getValue(expression, ctx) === value;
|
|
4
|
+
}
|
|
5
|
+
export function hasFeature(feature) {
|
|
6
|
+
return (ctx) => !!ctx.features.find((item) => item === feature);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=hasFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasFeature.js","sourceRoot":"","sources":["../../../../../src/commands/init/utils/hasFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,UAAU,QAAQ,CAAC,UAAkB,EAAE,KAAU;IACrD,OAAO,CAAC,GAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,CAAC,GAAQ,EAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import {getValue} from \"@tsed/core\";\n\nexport function hasValue(expression: string, value: any) {\n return (ctx: any) => getValue(expression, ctx) === value;\n}\n\nexport function hasFeature(feature: string) {\n return (ctx: any): boolean => !!ctx.features.find((item: string) => item === feature);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPlatform.js","sourceRoot":"","sources":["../../../../../src/commands/init/utils/isPlatform.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,GAAG,KAAe;IAC3C,OAAO,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC","sourcesContent":["export function isPlatform(...types: string[]) {\n return (ctx: any) => [types].includes(ctx.platform);\n}\n"]}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
export * from "./commands/add/AddCmd.js";
|
|
2
2
|
export * from "./commands/init/InitCmd.js";
|
|
3
|
+
export * from "./commands/init/interfaces/InitCmdContext.js";
|
|
4
|
+
export * from "./commands/init/interfaces/InitOptions.js";
|
|
5
|
+
export * from "./commands/init/config/FeaturesPrompt.js";
|
|
6
|
+
export * from "./commands/init/config/FeaturesPrompt.js";
|
|
3
7
|
export * from "./commands/generate/GenerateCmd.js";
|
|
4
8
|
export * from "./commands/update/UpdateCmd.js";
|
|
9
|
+
export * from "./commands/init/prompts/getFeaturesPrompt.js";
|
|
5
10
|
export * from "./interfaces.js";
|
|
6
11
|
export * from "./services/ProvidersInfoService.js";
|
|
7
|
-
export * from "./services/Features.js";
|
|
8
12
|
export * from "./pipes.js";
|
|
9
13
|
export * from "./constants.js";
|
|
10
14
|
export * from "./Cli.js";
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC","sourcesContent":["export * from \"./commands/add/AddCmd\";\nexport * from \"./commands/init/InitCmd\";\nexport * from \"./commands/init/interfaces/InitCmdContext\";\nexport * from \"./commands/init/interfaces/InitOptions\";\nexport * from \"./commands/init/config/FeaturesPrompt\";\nexport * from \"./commands/init/config/FeaturesPrompt\";\nexport * from \"./commands/generate/GenerateCmd\";\nexport * from \"./commands/update/UpdateCmd\";\nexport * from \"./commands/init/prompts/getFeaturesPrompt\";\nexport * from \"./interfaces\";\nexport * from \"./services/ProvidersInfoService\";\nexport * from \"./pipes\";\nexport * from \"./constants\";\nexport * from \"./Cli\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformType.js","sourceRoot":"","sources":["../../../src/interfaces/PlatformType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,2BAAW,CAAA;AACb,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["export enum PlatformType {\n EXPRESS = \"express\",\n KOA = \"koa\"\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./ProjectConvention\";\nexport * from \"./ArchitectureConvention\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./ProjectConvention\";\nexport * from \"./PlatformType\";\nexport * from \"./ArchitectureConvention\";\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ArchitectureConvention, PlatformType } from "../interfaces.js";
|
|
2
|
+
export function fillImports(ctx) {
|
|
3
|
+
ctx = { ...ctx };
|
|
4
|
+
Object.values(PlatformType).forEach((type) => {
|
|
5
|
+
ctx[type] = ctx.platform === type;
|
|
6
|
+
});
|
|
7
|
+
const isFeature = ctx.architecture === ArchitectureConvention.FEATURE;
|
|
8
|
+
ctx.barrels = JSON.stringify([
|
|
9
|
+
isFeature ? "./src/rest" : "./src/controllers/rest",
|
|
10
|
+
(ctx.swagger || ctx.oidc) && (isFeature ? "./src/pages" : "./src/controllers/pages"),
|
|
11
|
+
ctx.oidc && "./src/interactions",
|
|
12
|
+
ctx.graphql && "./src/datasources",
|
|
13
|
+
"./src/resolvers"
|
|
14
|
+
].filter(Boolean));
|
|
15
|
+
ctx.imports = [
|
|
16
|
+
ctx.express && { from: "@tsed/platform-express", comment: " // /!\\ keep this import" },
|
|
17
|
+
ctx.express && { symbols: "bodyParser", from: "body-parser" },
|
|
18
|
+
ctx.express && { symbols: "compress", from: "compression" },
|
|
19
|
+
ctx.express && { symbols: "cookieParser", from: "cookie-parser" },
|
|
20
|
+
ctx.express && { symbols: "methodOverride", from: "method-override" },
|
|
21
|
+
ctx.express && { symbols: "cors", from: "cors" },
|
|
22
|
+
ctx.koa && { from: "@tsed/platform-koa", comment: " // /!\\ keep this import" },
|
|
23
|
+
ctx.koa && { symbols: "bodyParser", from: "koa-bodyparser" },
|
|
24
|
+
ctx.koa && { symbols: "compress", from: "koa-compress" },
|
|
25
|
+
ctx.koa && { symbols: "cors", from: "@koa/cors" },
|
|
26
|
+
ctx.koa && { symbols: "methodOverride", from: "koa-override", tsIgnore: true },
|
|
27
|
+
{ from: "@tsed/ajv" },
|
|
28
|
+
ctx.swagger && { from: "@tsed/swagger" },
|
|
29
|
+
ctx.mongoose && { from: "@tsed/mongoose" },
|
|
30
|
+
ctx.oidc && { from: "@tsed/oidc-provider" },
|
|
31
|
+
ctx.graphql && { from: "@tsed/typegraphql" },
|
|
32
|
+
ctx.graphql && { from: "./datasources/index" },
|
|
33
|
+
ctx.graphql && { from: "./resolvers/index" },
|
|
34
|
+
{ symbols: "{config}", from: "./config/index" },
|
|
35
|
+
{ symbols: "* as rest", from: isFeature ? "./rest/index" : "./controllers/rest/index" },
|
|
36
|
+
(ctx.swagger || ctx.oidc) && {
|
|
37
|
+
symbols: "* as pages",
|
|
38
|
+
from: isFeature ? "./pages/index" : "./controllers/pages/index"
|
|
39
|
+
},
|
|
40
|
+
ctx.oidc && { symbols: "{InteractionsController}", from: "./controllers/oidc/InteractionsController" }
|
|
41
|
+
].filter(Boolean);
|
|
42
|
+
return ctx;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=fillImports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fillImports.js","sourceRoot":"","sources":["../../../src/utils/fillImports.ts"],"names":[],"mappings":"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","sourcesContent":["import {ArchitectureConvention, PlatformType} from \"../interfaces\";\n\nexport function fillImports(ctx: any) {\n ctx = {...ctx};\n Object.values(PlatformType).forEach((type) => {\n ctx[type] = ctx.platform === type;\n });\n\n const isFeature = ctx.architecture === ArchitectureConvention.FEATURE;\n\n ctx.barrels = JSON.stringify(\n [\n isFeature ? \"./src/rest\" : \"./src/controllers/rest\",\n (ctx.swagger || ctx.oidc) && (isFeature ? \"./src/pages\" : \"./src/controllers/pages\"),\n ctx.oidc && \"./src/interactions\",\n ctx.graphql && \"./src/datasources\",\n \"./src/resolvers\"\n ].filter(Boolean)\n );\n\n ctx.imports = [\n ctx.express && {from: \"@tsed/platform-express\", comment: \" // /!\\\\ keep this import\"},\n ctx.express && {symbols: \"bodyParser\", from: \"body-parser\"},\n ctx.express && {symbols: \"compress\", from: \"compression\"},\n ctx.express && {symbols: \"cookieParser\", from: \"cookie-parser\"},\n ctx.express && {symbols: \"methodOverride\", from: \"method-override\"},\n ctx.express && {symbols: \"cors\", from: \"cors\"},\n ctx.koa && {from: \"@tsed/platform-koa\", comment: \" // /!\\\\ keep this import\"},\n ctx.koa && {symbols: \"bodyParser\", from: \"koa-bodyparser\"},\n ctx.koa && {symbols: \"compress\", from: \"koa-compress\"},\n ctx.koa && {symbols: \"cors\", from: \"@koa/cors\"},\n ctx.koa && {symbols: \"methodOverride\", from: \"koa-override\", tsIgnore: true},\n {from: \"@tsed/ajv\"},\n ctx.swagger && {from: \"@tsed/swagger\"},\n ctx.mongoose && {from: \"@tsed/mongoose\"},\n ctx.oidc && {from: \"@tsed/oidc-provider\"},\n ctx.graphql && {from: \"@tsed/typegraphql\"},\n ctx.graphql && {from: \"./datasources/index\"},\n ctx.graphql && {from: \"./resolvers/index\"},\n {symbols: \"{config}\", from: \"./config/index\"},\n {symbols: \"* as rest\", from: isFeature ? \"./rest/index\" : \"./controllers/rest/index\"},\n (ctx.swagger || ctx.oidc) && {\n symbols: \"* as pages\",\n from: isFeature ? \"./pages/index\" : \"./controllers/pages/index\"\n },\n ctx.oidc && {symbols: \"{InteractionsController}\", from: \"./controllers/oidc/InteractionsController\"}\n ].filter(Boolean);\n\n return ctx;\n}\n"]}
|
package/lib/types/Cli.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliCore } from "@tsed/cli-core";
|
|
2
2
|
import { ArchitectureConvention, ProjectConvention } from "./interfaces";
|
|
3
|
-
import { InitCmdContext } from "./commands/init/
|
|
3
|
+
import { InitCmdContext } from "./commands/init/interfaces/InitCmdContext";
|
|
4
4
|
import { GenerateCmdContext } from "./commands/generate/GenerateCmd";
|
|
5
5
|
export declare class Cli extends CliCore {
|
|
6
6
|
static defaults: {
|
|
@@ -8,7 +8,7 @@ export declare class Cli extends CliCore {
|
|
|
8
8
|
pkg: import("read-pkg").NormalizedPackageJson;
|
|
9
9
|
templateDir: string;
|
|
10
10
|
plugins: boolean;
|
|
11
|
-
commands: (typeof import("
|
|
11
|
+
commands: (typeof import(".").InitCmd | typeof import("./commands/generate/GenerateCmd").GenerateCmd | typeof import(".").UpdateCmd | typeof import(".").AddCmd | typeof import("./commands/run/RunCmd").RunCmd)[];
|
|
12
12
|
defaultProjectPreferences(): {
|
|
13
13
|
convention: ProjectConvention;
|
|
14
14
|
architecture: ArchitectureConvention;
|
|
@@ -1,37 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ArchitectureConvention } from "../../interfaces/ArchitectureConvention";
|
|
3
|
-
import { ProjectConvention } from "../../interfaces/ProjectConvention";
|
|
1
|
+
import { CliExeca, CliFs, CliLoadFile, CliPackageJson, CliPlugins, CliService, CommandProvider, Configuration, ProjectPackageJson, QuestionOptions, RootRendererService } from "@tsed/cli-core";
|
|
4
2
|
import { OutputFilePathPipe } from "../../pipes/OutputFilePathPipe";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
platform: "express" | "koa";
|
|
8
|
-
root: string;
|
|
9
|
-
srcDir: string;
|
|
10
|
-
projectName: string;
|
|
11
|
-
tsedVersion: string;
|
|
12
|
-
features: FeatureValue[];
|
|
13
|
-
featuresTypeORM?: FeatureValue;
|
|
14
|
-
babel?: boolean;
|
|
15
|
-
webpack?: boolean;
|
|
16
|
-
architecture?: ArchitectureConvention;
|
|
17
|
-
convention?: ProjectConvention;
|
|
18
|
-
commands?: boolean;
|
|
19
|
-
GH_TOKEN?: string;
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}
|
|
3
|
+
import { InitCmdContext } from "./interfaces/InitCmdContext";
|
|
4
|
+
import { InitOptions } from "./interfaces/InitOptions";
|
|
22
5
|
export declare class InitCmd implements CommandProvider {
|
|
23
6
|
protected configuration: Configuration;
|
|
24
7
|
protected cliPlugins: CliPlugins;
|
|
25
8
|
protected packageJson: ProjectPackageJson;
|
|
26
|
-
protected
|
|
9
|
+
protected cliPackageJson: CliPackageJson;
|
|
27
10
|
protected cliService: CliService;
|
|
11
|
+
protected cliLoadFile: CliLoadFile;
|
|
28
12
|
protected rootRenderer: RootRendererService;
|
|
29
13
|
protected outputFilePathPipe: OutputFilePathPipe;
|
|
30
14
|
protected execa: CliExeca;
|
|
31
15
|
protected fs: CliFs;
|
|
32
|
-
$beforePrompt(initialOptions: Partial<
|
|
33
|
-
$prompt(initialOptions: Partial<
|
|
34
|
-
$mapContext(ctx:
|
|
16
|
+
$beforePrompt(initialOptions: Partial<InitOptions>): Promise<any>;
|
|
17
|
+
$prompt(initialOptions: Partial<InitOptions>): QuestionOptions;
|
|
18
|
+
$mapContext(ctx: any): InitCmdContext;
|
|
35
19
|
$beforeExec(ctx: InitCmdContext): Promise<any>;
|
|
36
20
|
$exec(ctx: InitCmdContext): Promise<{
|
|
37
21
|
title: string;
|
|
@@ -48,4 +32,5 @@ export declare class InitCmd implements CommandProvider {
|
|
|
48
32
|
addFeatures(ctx: InitCmdContext): void;
|
|
49
33
|
private addExpressDependencies;
|
|
50
34
|
private addKoaDependencies;
|
|
35
|
+
static checkPrecondition(ctx: InitCmdContext): void;
|
|
51
36
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { PackageManager } from "@tsed/cli-core";
|
|
2
|
+
import { InitOptions } from "../interfaces/InitOptions";
|
|
3
|
+
import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces";
|
|
4
|
+
export interface Feature {
|
|
5
|
+
name: string;
|
|
6
|
+
value?: any;
|
|
7
|
+
checked?: boolean | ((opts: Partial<InitOptions>) => boolean);
|
|
8
|
+
when?: (opts: any) => boolean;
|
|
9
|
+
dependencies?: Record<string, any>;
|
|
10
|
+
devDependencies?: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
export declare enum FeatureType {
|
|
13
|
+
GRAPHQL = "graphql",
|
|
14
|
+
SOCKETIO = "socketio",
|
|
15
|
+
SWAGGER = "swagger",
|
|
16
|
+
OIDC = "oidc",
|
|
17
|
+
PASSPORTJS = "passportjs",
|
|
18
|
+
COMMANDS = "commands",
|
|
19
|
+
DB = "db",
|
|
20
|
+
PRISMA = "prisma",
|
|
21
|
+
MONGOOSE = "mongoose",
|
|
22
|
+
TYPEORM = "typeorm",
|
|
23
|
+
TYPEORM_MYSQL = "typeorm:mysql",
|
|
24
|
+
TYPEORM_MARIADB = "typeorm:mariadb",
|
|
25
|
+
TYPEORM_POSTGRES = "typeorm:postgres",
|
|
26
|
+
TYPEORM_COCKROACHDB = "typeorm:cockroachdb",
|
|
27
|
+
TYPEORM_SQLITE = "typeorm:sqlite",
|
|
28
|
+
TYPEORM_BETTER_SQLITE3 = "typeorm:better-sqlite3",
|
|
29
|
+
TYPEORM_CORDOVA = "typeorm:cordova",
|
|
30
|
+
TYPEORM_NATIVESCRIPT = "typeorm:nativescript",
|
|
31
|
+
TYPEORM_ORACLE = "typeorm:oracle",
|
|
32
|
+
TYPEORM_MSSQL = "typeorm:mssql",
|
|
33
|
+
TYPEORM_MONGODB = "typeorm:mongodb",
|
|
34
|
+
TYPEORM_SQLJS = "typeorm:sqljs",
|
|
35
|
+
TYPEORM_REACTNATIVE = "typeorm:reactnative",
|
|
36
|
+
TYPEORM_EXPO = "typeorm:expo",
|
|
37
|
+
TESTING = "testing",
|
|
38
|
+
JEST = "jest",
|
|
39
|
+
MOCHA = "mocha",
|
|
40
|
+
LINTER = "linter",
|
|
41
|
+
ESLINT = "eslint",
|
|
42
|
+
LINT_STAGED = "lintstaged",
|
|
43
|
+
PRETTIER = "prettier",
|
|
44
|
+
BUNDLER = "bundler",
|
|
45
|
+
BABEL = "babel",
|
|
46
|
+
WEBPACK = "babel:webpack"
|
|
47
|
+
}
|
|
48
|
+
export declare const FeaturesMap: Record<string, Feature>;
|
|
49
|
+
export declare const FeaturesPrompt: () => ({
|
|
50
|
+
message: string;
|
|
51
|
+
type: string;
|
|
52
|
+
name: string;
|
|
53
|
+
choices: PlatformType[];
|
|
54
|
+
when?: undefined;
|
|
55
|
+
default?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
message: string;
|
|
58
|
+
type: string;
|
|
59
|
+
name: string;
|
|
60
|
+
choices: ArchitectureConvention[];
|
|
61
|
+
when?: undefined;
|
|
62
|
+
default?: undefined;
|
|
63
|
+
} | {
|
|
64
|
+
message: string;
|
|
65
|
+
type: string;
|
|
66
|
+
name: string;
|
|
67
|
+
choices: ProjectConvention[];
|
|
68
|
+
when?: undefined;
|
|
69
|
+
default?: undefined;
|
|
70
|
+
} | {
|
|
71
|
+
type: string;
|
|
72
|
+
name: string;
|
|
73
|
+
message: string;
|
|
74
|
+
choices: FeatureType[];
|
|
75
|
+
when?: undefined;
|
|
76
|
+
default?: undefined;
|
|
77
|
+
} | {
|
|
78
|
+
message: string;
|
|
79
|
+
type: string;
|
|
80
|
+
name: string;
|
|
81
|
+
when: (ctx: any) => boolean;
|
|
82
|
+
choices: FeatureType[];
|
|
83
|
+
default?: undefined;
|
|
84
|
+
} | {
|
|
85
|
+
message: string;
|
|
86
|
+
name: string;
|
|
87
|
+
default: string;
|
|
88
|
+
when: (ctx: any) => boolean;
|
|
89
|
+
type: string;
|
|
90
|
+
choices?: undefined;
|
|
91
|
+
} | {
|
|
92
|
+
message: string;
|
|
93
|
+
type: string;
|
|
94
|
+
name: string;
|
|
95
|
+
choices: PackageManager[];
|
|
96
|
+
when?: undefined;
|
|
97
|
+
default?: undefined;
|
|
98
|
+
})[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PackageManager } from "@tsed/cli-core";
|
|
2
|
+
import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces";
|
|
3
|
+
import { FeatureType } from "./FeaturesPrompt";
|
|
4
|
+
export declare const InitFileSchema: {
|
|
5
|
+
type: string;
|
|
6
|
+
properties: {
|
|
7
|
+
tsedVersion: {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
projectName: {
|
|
11
|
+
type: string;
|
|
12
|
+
maxLength: number;
|
|
13
|
+
};
|
|
14
|
+
platform: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
enum: PlatformType[];
|
|
18
|
+
default: PlatformType;
|
|
19
|
+
};
|
|
20
|
+
architecture: {
|
|
21
|
+
type: string;
|
|
22
|
+
enum: ArchitectureConvention[];
|
|
23
|
+
default: ArchitectureConvention;
|
|
24
|
+
};
|
|
25
|
+
convention: {
|
|
26
|
+
type: string;
|
|
27
|
+
enum: ProjectConvention[];
|
|
28
|
+
default: ProjectConvention;
|
|
29
|
+
};
|
|
30
|
+
features: {
|
|
31
|
+
type: string;
|
|
32
|
+
items: {
|
|
33
|
+
type: string;
|
|
34
|
+
enum: FeatureType[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
packageManager: {
|
|
38
|
+
type: string;
|
|
39
|
+
enum: PackageManager[];
|
|
40
|
+
default: PackageManager;
|
|
41
|
+
};
|
|
42
|
+
skipPrompt: {
|
|
43
|
+
type: string;
|
|
44
|
+
default: boolean;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
required: string[];
|
|
48
|
+
additionalProperties: boolean;
|
|
49
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PackageManager } from "@tsed/cli-core";
|
|
2
|
+
import { PlatformType } from "../../../interfaces/PlatformType";
|
|
3
|
+
import { ArchitectureConvention } from "../../../interfaces/ArchitectureConvention";
|
|
4
|
+
import { ProjectConvention } from "../../../interfaces/ProjectConvention";
|
|
5
|
+
import { FeatureType } from "../config/FeaturesPrompt";
|
|
6
|
+
export interface InitOptions {
|
|
7
|
+
root: string;
|
|
8
|
+
projectName: string;
|
|
9
|
+
features: FeatureType[];
|
|
10
|
+
skipPrompt: boolean;
|
|
11
|
+
platform: PlatformType;
|
|
12
|
+
tsedVersion: string;
|
|
13
|
+
cliVersion: string;
|
|
14
|
+
architecture: ArchitectureConvention;
|
|
15
|
+
convention: ProjectConvention;
|
|
16
|
+
packageManager: PackageManager;
|
|
17
|
+
oidcBasePath: string;
|
|
18
|
+
file: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PackageManager } from "@tsed/cli-core";
|
|
2
|
+
import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces";
|
|
3
|
+
export interface InitPromptAnswers {
|
|
4
|
+
projectName: string;
|
|
5
|
+
platform: PlatformType;
|
|
6
|
+
architecture: ArchitectureConvention;
|
|
7
|
+
convention: ProjectConvention;
|
|
8
|
+
features: string[];
|
|
9
|
+
featuresDB: string[];
|
|
10
|
+
featuresTypeORM: string;
|
|
11
|
+
featuresTesting: string;
|
|
12
|
+
featuresExtraLinter: string[];
|
|
13
|
+
featuresBundler: string;
|
|
14
|
+
oidcBasePath: string;
|
|
15
|
+
packageManager: PackageManager;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPlatform(...types: string[]): (ctx: any) => boolean;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
export * from "./commands/add/AddCmd";
|
|
2
2
|
export * from "./commands/init/InitCmd";
|
|
3
|
+
export * from "./commands/init/interfaces/InitCmdContext";
|
|
4
|
+
export * from "./commands/init/interfaces/InitOptions";
|
|
5
|
+
export * from "./commands/init/config/FeaturesPrompt";
|
|
6
|
+
export * from "./commands/init/config/FeaturesPrompt";
|
|
3
7
|
export * from "./commands/generate/GenerateCmd";
|
|
4
8
|
export * from "./commands/update/UpdateCmd";
|
|
9
|
+
export * from "./commands/init/prompts/getFeaturesPrompt";
|
|
5
10
|
export * from "./interfaces";
|
|
6
11
|
export * from "./services/ProvidersInfoService";
|
|
7
|
-
export * from "./services/Features";
|
|
8
12
|
export * from "./pipes";
|
|
9
13
|
export * from "./constants";
|
|
10
14
|
export * from "./Cli";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fillImports(ctx: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.1",
|
|
4
4
|
"source": "./src/index.ts",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
18
18
|
"start:help": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts -h",
|
|
19
19
|
"start:help:g": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts generate -h",
|
|
20
|
+
"start:help:i": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts init -h",
|
|
20
21
|
"start:version": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts --version",
|
|
21
22
|
"start:init:help": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts init -h",
|
|
22
23
|
"start:init:run": "cross-env NODE_ENV=development cross-env CI=true ts-node -r tsconfig-paths/register src/bin/tsed.ts init -r ./.tmp/init/default",
|
|
24
|
+
"start:init:params": "cross-env NODE_ENV=development cross-env CI=true ts-node -r tsconfig-paths/register src/bin/tsed.ts init -r ./.tmp/init/default --skip-prompt --features swagger,jest,lintstaged",
|
|
23
25
|
"start:init:run:name": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts init -r ./.tmp/init awesome --verbose",
|
|
24
26
|
"start:add:run": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts add -r ./.tmp",
|
|
25
27
|
"start:generate": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts generate -r ./.tmp/init/default",
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
"node": ">=14"
|
|
57
59
|
},
|
|
58
60
|
"dependencies": {
|
|
59
|
-
"@tsed/cli-core": "3.
|
|
61
|
+
"@tsed/cli-core": "3.26.1",
|
|
60
62
|
"@tsed/core": ">=6.114.14",
|
|
61
63
|
"@tsed/di": ">=6.114.14",
|
|
62
64
|
"@tsed/logger": ">=6.0.0",
|