@tsed/cli 6.3.0 → 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.3.0",
4
+ "version": "6.4.0",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "source": "./src/index.ts",
@@ -48,7 +48,7 @@
48
48
  "@swc-node/register": "^1.10.9",
49
49
  "@swc/core": "1.7.26",
50
50
  "@swc/helpers": "^0.5.13",
51
- "@tsed/cli-core": "6.3.0",
51
+ "@tsed/cli-core": "6.4.0",
52
52
  "@tsed/core": ">=8.0.0",
53
53
  "@tsed/di": ">=8.0.0",
54
54
  "@tsed/hooks": ">=8.0.0",
@@ -67,7 +67,7 @@
67
67
  "tslib": "^2.7.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@tsed/typescript": "6.3.0",
70
+ "@tsed/typescript": "6.4.0",
71
71
  "@types/change-case": "^2.3.1",
72
72
  "@types/consolidate": "0.14.4",
73
73
  "cross-env": "7.0.3",
@@ -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,