@tsed/cli 6.2.1 → 6.4.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.
@@ -1,4 +1,5 @@
1
1
  import { type CliDefaultOptions, type CommandProvider, ProjectPackageJson } from "@tsed/cli-core";
2
+ import type { PlatformType } from "../../interfaces/index.js";
2
3
  import { ProjectConvention } from "../../interfaces/ProjectConvention.js";
3
4
  import { ClassNamePipe } from "../../pipes/ClassNamePipe.js";
4
5
  import { OutputFilePathPipe } from "../../pipes/OutputFilePathPipe.js";
@@ -10,7 +11,7 @@ export interface GenerateCmdContext extends CliDefaultOptions {
10
11
  name: string;
11
12
  route: string;
12
13
  directory: string;
13
- platform: string;
14
+ platform: PlatformType;
14
15
  templateType: string;
15
16
  middlewarePosition: "before" | "after";
16
17
  symbolName: string;
@@ -47,11 +48,7 @@ export declare class GenerateCmd implements CommandProvider {
47
48
  type: string;
48
49
  name: string;
49
50
  when(state: any): boolean;
50
- choices: {
51
- name: string;
52
- checked: boolean;
53
- value: string;
54
- }[];
51
+ choices: any[];
55
52
  default?: undefined;
56
53
  source?: undefined;
57
54
  } | {
@@ -1,3 +1,4 @@
1
+ import { PlatformType } from "../../../interfaces/index.js";
1
2
  import type { InitOptions } from "../interfaces/InitOptions.js";
2
3
  export interface Feature {
3
4
  name: string;
@@ -43,6 +44,12 @@ export declare enum FeatureType {
43
44
  PRETTIER = "prettier"
44
45
  }
45
46
  export declare const FeaturesMap: Record<string, Feature>;
47
+ export declare const FrameworksPrompt: {
48
+ message: string;
49
+ type: string;
50
+ name: string;
51
+ choices: PlatformType[];
52
+ };
46
53
  export declare const FeaturesPrompt: (availableRuntimes: string[], availablePackageManagers: string[]) => ({
47
54
  message: string;
48
55
  name: string;
@@ -1,2 +1,8 @@
1
1
  import type { InitOptions } from "../interfaces/InitOptions.js";
2
2
  export declare function getFeaturesPrompt(runtimes: string[], availablePackageManagers: string[], options: Partial<InitOptions>): any[];
3
+ export declare function getFrameworksPrompt(): {
4
+ choices: any[];
5
+ message: string;
6
+ type: string;
7
+ name: string;
8
+ };
@@ -1,4 +1,5 @@
1
1
  export declare enum PlatformType {
2
2
  EXPRESS = "express",
3
- KOA = "koa"
3
+ KOA = "koa",
4
+ FASTIFY = "fastify"
4
5
  }
@@ -0,0 +1,18 @@
1
+ import type { InitBasePlatform } from "./InitBasePlatform.js";
2
+ export declare class InitFastifyPlatform implements InitBasePlatform {
3
+ readonly name = "fastify";
4
+ dependencies(ctx: any): {
5
+ "@tsed/platform-fastify": any;
6
+ "@fastify/accepts": string;
7
+ "@fastify/middie": string;
8
+ "@fastify/static": string;
9
+ "@fastify/cookie": string;
10
+ "@fastify/formbody": string;
11
+ "@fastify/session": string;
12
+ fastify: string;
13
+ "fastify-raw-body": string;
14
+ };
15
+ devDependencies(ctx: any): {
16
+ "@types/content-disposition": string;
17
+ };
18
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsed/cli",
3
3
  "description": "CLI to bootstrap your Ts.ED project",
4
- "version": "6.2.1",
4
+ "version": "6.4.0",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "source": "./src/index.ts",
@@ -9,6 +9,7 @@
9
9
  "typings": "./lib/types/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
+ "cli-tsed-source": "./src/index.ts",
12
13
  "types": "./lib/types/index.d.ts",
13
14
  "import": "./lib/esm/index.js",
14
15
  "default": "./lib/esm/index.js"
@@ -16,27 +17,7 @@
16
17
  },
17
18
  "scripts": {
18
19
  "build": "yarn build:ts",
19
- "build:ts": "tsc --build tsconfig.json",
20
- "run-cmd": "cross-env NODE_ENV=development CLI_MODE=ts CI=true node --import @swc-node/register/esm-register src/bin/tsed.ts",
21
- "start:help": "yarn run-cmd -h",
22
- "start:help:g": "yarn run-cmd generate -h",
23
- "start:help:i": "yarn run-cmd init -h",
24
- "start:version": "yarn run-cmd --version",
25
- "start:init:help": "yarn run-cmd init -h",
26
- "start:init:test": "yarn run-cmd init init -r ./.tmp/init/default --features=oidc --arch=default --convention=conv_default --platform=express --package-manager=npm --skip-prompt .",
27
- "start:init:test:jest": "yarn run-cmd init -r ./.tmp/init/default --features=jest --arch=default --convention=conv_default --platform=express --package-manager=npm --skip-prompt .",
28
- "start:init:run": "yarn run-cmd init -r ./.tmp/init/default",
29
- "start:init:params": "yarn run-cmd init -r ./.tmp/init/default --skip-prompt --features swagger,jest,lintstaged",
30
- "start:init:run:name": "yarn run-cmd init -r ./.tmp/init awesome --verbose",
31
- "start:init:args": "yarn run-cmd init -r ./.tmp/cmd --package-manager=npm --project-name=untitled3 --features=graphql,typeorm,passportjs,socketio,linter,eslint,prettier --arch=default --convention=default --platform=express --skip-prompt .",
32
- "start:add:run": "yarn run-cmd add -r ./.tmp",
33
- "start:generate": "yarn run-cmd generate -r ./.tmp/init/default",
34
- "start:generate:help": "yarn run-cmd generate -h",
35
- "start:generate:model": "yarn run-cmd generate model -r ./.tmp/init/awesome",
36
- "start:g:model": "yarn run-cmd g model -r ./.tmp/init/awesome",
37
- "start:g:prisma": "yarn run-cmd g service -r ./.tmp/init/awesome prisma",
38
- "start:generate:run": "yarn run-cmd generate -r ./.tmp/init/awesome",
39
- "start:typeorm:run": "yarn run-cmd typeorm entity:create -r ./.tmp/init/awesome --name User",
20
+ "build:ts": "tsc --build tsconfig.esm.json",
40
21
  "test": "vitest run",
41
22
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
42
23
  },
@@ -67,7 +48,7 @@
67
48
  "@swc-node/register": "^1.10.9",
68
49
  "@swc/core": "1.7.26",
69
50
  "@swc/helpers": "^0.5.13",
70
- "@tsed/cli-core": "6.2.1",
51
+ "@tsed/cli-core": "6.4.0",
71
52
  "@tsed/core": ">=8.0.0",
72
53
  "@tsed/di": ">=8.0.0",
73
54
  "@tsed/hooks": ">=8.0.0",
@@ -86,12 +67,12 @@
86
67
  "tslib": "^2.7.0"
87
68
  },
88
69
  "devDependencies": {
89
- "@tsed/typescript": "6.2.1",
70
+ "@tsed/typescript": "6.4.0",
90
71
  "@types/change-case": "^2.3.1",
91
72
  "@types/consolidate": "0.14.4",
92
73
  "cross-env": "7.0.3",
93
74
  "typescript": "5.6.2",
94
- "vitest": "2.1.1"
75
+ "vitest": "3.0.9"
95
76
  },
96
77
  "peerDependencies": {
97
78
  "@tsed/core": ">=8.0.0",
@@ -0,0 +1,10 @@
1
+ views: {
2
+ root: join(process.cwd(), "../views"),
3
+ extensions: {
4
+ ejs: "ejs"
5
+ }
6
+ }
7
+ })
8
+ export class {{symbolName}} {
9
+ protected app = application();
10
+ }
@@ -11,10 +11,6 @@ import {application} from "@tsed/platform-http";
11
11
  acceptMimes: ["application/json"],
12
12
  httpPort: process.env.PORT || 8083,
13
13
  httpsPort: false, // CHANGE
14
- disableComponentsScan: true,
15
- ajv: {
16
- returnsCoercedValues: true
17
- },
18
14
  mount: {
19
15
  "{{route}}": [
20
16
  ...Object.values(rest)
@@ -36,28 +32,3 @@ import {application} from "@tsed/platform-http";
36
32
  specVersion: "3.0.1"
37
33
  }
38
34
  ],{{/if}}
39
- middlewares: [{{#if express}}
40
- "cors",
41
- "cookie-parser",
42
- "compression",
43
- "method-override",
44
- "json-parser",
45
- { use: "urlencoded-parser", options: { extended: true }}{{/if}}{{#if koa}}
46
- "@koa/cors",
47
- "koa-compress",
48
- "koa-override",
49
- "koa-bodyparser"{{/if}}
50
- ],
51
- views: {
52
- root: join(process.cwd(), "../views"),
53
- extensions: {
54
- ejs: "ejs"
55
- }
56
- },
57
- exclude: [
58
- "**/*.spec.ts"
59
- ]
60
- })
61
- export class {{symbolName}} {
62
- protected app = application();
63
- }
@@ -0,0 +1,10 @@
1
+ {{> server-header }}
2
+ middlewares: [
3
+ "cors",
4
+ "cookie-parser",
5
+ "compression",
6
+ "method-override",
7
+ "json-parser",
8
+ { use: "urlencoded-parser", options: { extended: true }}
9
+ ],
10
+ {{> server-footer }}
@@ -0,0 +1,14 @@
1
+ {{> server-header }}
2
+ plugins: [
3
+ "@fastify/accepts",
4
+ "@fastify/cookie",
5
+ {
6
+ use: "fastify-raw-body",
7
+ options: {
8
+ global: false,
9
+ runFirst: true
10
+ }
11
+ },
12
+ "@fastify/formbody"
13
+ ],
14
+ {{> server-footer }}
@@ -0,0 +1,8 @@
1
+ {{> server-header }}
2
+ middlewares: [
3
+ "@koa/cors",
4
+ "koa-compress",
5
+ "koa-override",
6
+ "koa-bodyparser"
7
+ ],
8
+ {{> server-footer }}
@@ -12,6 +12,9 @@ const pkg = JSON.parse(readFileSync("./package.json", {encoding: "utf8"}));
12
12
  export const config: Partial<TsED.Configuration> = {
13
13
  version: pkg.version,
14
14
  envs,
15
+ ajv: {
16
+ returnsCoercedValues: true
17
+ },
15
18
  logger: loggerConfig,
16
19
  {{#if mongoose}}
17
20
  mongoose: mongooseConfig,