@tsed/cli 4.6.6 → 5.0.0-rc.2

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.
Files changed (111) hide show
  1. package/lib/cjs/commands/add/AddCmd.js +6 -1
  2. package/lib/cjs/commands/add/AddCmd.js.map +1 -1
  3. package/lib/cjs/commands/init/InitCmd.js +102 -123
  4. package/lib/cjs/commands/init/InitCmd.js.map +1 -1
  5. package/lib/cjs/commands/init/config/FeaturesPrompt.js +59 -46
  6. package/lib/cjs/commands/init/config/FeaturesPrompt.js.map +1 -1
  7. package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js +2 -2
  8. package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js.map +1 -1
  9. package/lib/cjs/commands/init/utils/hasFeature.js +1 -1
  10. package/lib/cjs/commands/init/utils/hasFeature.js.map +1 -1
  11. package/lib/cjs/commands/update/UpdateCmd.js +8 -3
  12. package/lib/cjs/commands/update/UpdateCmd.js.map +1 -1
  13. package/lib/cjs/index.js +1 -0
  14. package/lib/cjs/index.js.map +1 -1
  15. package/lib/cjs/platforms/InitPlatformsModule.js +26 -0
  16. package/lib/cjs/platforms/InitPlatformsModule.js.map +1 -0
  17. package/lib/cjs/platforms/supports/InitBasePlatform.js +3 -0
  18. package/lib/cjs/platforms/supports/InitBasePlatform.js.map +1 -0
  19. package/lib/cjs/platforms/supports/InitExpressPlatform.js +35 -0
  20. package/lib/cjs/platforms/supports/InitExpressPlatform.js.map +1 -0
  21. package/lib/cjs/platforms/supports/InitKoaPlatform.js +39 -0
  22. package/lib/cjs/platforms/supports/InitKoaPlatform.js.map +1 -0
  23. package/lib/cjs/runtimes/RuntimesModule.js +67 -0
  24. package/lib/cjs/runtimes/RuntimesModule.js.map +1 -0
  25. package/lib/cjs/runtimes/index.js +11 -0
  26. package/lib/cjs/runtimes/index.js.map +1 -0
  27. package/lib/cjs/runtimes/supports/BabelRuntime.js +40 -0
  28. package/lib/cjs/runtimes/supports/BabelRuntime.js.map +1 -0
  29. package/lib/cjs/runtimes/supports/BaseRuntime.js +45 -0
  30. package/lib/cjs/runtimes/supports/BaseRuntime.js.map +1 -0
  31. package/lib/cjs/runtimes/supports/BunRuntime.js +27 -0
  32. package/lib/cjs/runtimes/supports/BunRuntime.js.map +1 -0
  33. package/lib/cjs/runtimes/supports/NodeRuntime.js +33 -0
  34. package/lib/cjs/runtimes/supports/NodeRuntime.js.map +1 -0
  35. package/lib/cjs/runtimes/supports/SWCRuntime.js +34 -0
  36. package/lib/cjs/runtimes/supports/SWCRuntime.js.map +1 -0
  37. package/lib/cjs/runtimes/supports/WebpackRuntime.js +43 -0
  38. package/lib/cjs/runtimes/supports/WebpackRuntime.js.map +1 -0
  39. package/lib/esm/commands/add/AddCmd.js +7 -2
  40. package/lib/esm/commands/add/AddCmd.js.map +1 -1
  41. package/lib/esm/commands/init/InitCmd.js +103 -124
  42. package/lib/esm/commands/init/InitCmd.js.map +1 -1
  43. package/lib/esm/commands/init/config/FeaturesPrompt.js +59 -46
  44. package/lib/esm/commands/init/config/FeaturesPrompt.js.map +1 -1
  45. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +2 -2
  46. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js.map +1 -1
  47. package/lib/esm/commands/init/utils/hasFeature.js +1 -1
  48. package/lib/esm/commands/init/utils/hasFeature.js.map +1 -1
  49. package/lib/esm/commands/update/UpdateCmd.js +9 -4
  50. package/lib/esm/commands/update/UpdateCmd.js.map +1 -1
  51. package/lib/esm/index.js +1 -0
  52. package/lib/esm/index.js.map +1 -1
  53. package/lib/esm/platforms/InitPlatformsModule.js +23 -0
  54. package/lib/esm/platforms/InitPlatformsModule.js.map +1 -0
  55. package/lib/esm/platforms/supports/InitBasePlatform.js +2 -0
  56. package/lib/esm/platforms/supports/InitBasePlatform.js.map +1 -0
  57. package/lib/esm/platforms/supports/InitExpressPlatform.js +32 -0
  58. package/lib/esm/platforms/supports/InitExpressPlatform.js.map +1 -0
  59. package/lib/esm/platforms/supports/InitKoaPlatform.js +36 -0
  60. package/lib/esm/platforms/supports/InitKoaPlatform.js.map +1 -0
  61. package/lib/esm/runtimes/RuntimesModule.js +64 -0
  62. package/lib/esm/runtimes/RuntimesModule.js.map +1 -0
  63. package/lib/esm/runtimes/index.js +8 -0
  64. package/lib/esm/runtimes/index.js.map +1 -0
  65. package/lib/esm/runtimes/supports/BabelRuntime.js +37 -0
  66. package/lib/esm/runtimes/supports/BabelRuntime.js.map +1 -0
  67. package/lib/esm/runtimes/supports/BaseRuntime.js +41 -0
  68. package/lib/esm/runtimes/supports/BaseRuntime.js.map +1 -0
  69. package/lib/esm/runtimes/supports/BunRuntime.js +24 -0
  70. package/lib/esm/runtimes/supports/BunRuntime.js.map +1 -0
  71. package/lib/esm/runtimes/supports/NodeRuntime.js +30 -0
  72. package/lib/esm/runtimes/supports/NodeRuntime.js.map +1 -0
  73. package/lib/esm/runtimes/supports/SWCRuntime.js +31 -0
  74. package/lib/esm/runtimes/supports/SWCRuntime.js.map +1 -0
  75. package/lib/esm/runtimes/supports/WebpackRuntime.js +40 -0
  76. package/lib/esm/runtimes/supports/WebpackRuntime.js.map +1 -0
  77. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  78. package/lib/tsconfig.tsbuildinfo +1 -1
  79. package/lib/types/commands/add/AddCmd.d.ts +2 -1
  80. package/lib/types/commands/init/InitCmd.d.ts +8 -4
  81. package/lib/types/commands/init/config/FeaturesPrompt.d.ts +9 -12
  82. package/lib/types/commands/init/interfaces/InitOptions.d.ts +1 -0
  83. package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +1 -1
  84. package/lib/types/commands/init/utils/hasFeature.d.ts +1 -1
  85. package/lib/types/commands/update/UpdateCmd.d.ts +2 -1
  86. package/lib/types/index.d.ts +1 -0
  87. package/lib/types/platforms/InitPlatformsModule.d.ts +6 -0
  88. package/lib/types/platforms/supports/InitBasePlatform.d.ts +5 -0
  89. package/lib/types/platforms/supports/InitExpressPlatform.d.ts +20 -0
  90. package/lib/types/platforms/supports/InitKoaPlatform.d.ts +24 -0
  91. package/lib/types/runtimes/RuntimesModule.d.ts +20 -0
  92. package/lib/types/runtimes/index.d.ts +7 -0
  93. package/lib/types/runtimes/supports/BabelRuntime.d.ts +19 -0
  94. package/lib/types/runtimes/supports/BaseRuntime.d.ts +30 -0
  95. package/lib/types/runtimes/supports/BunRuntime.d.ts +9 -0
  96. package/lib/types/runtimes/supports/NodeRuntime.d.ts +10 -0
  97. package/lib/types/runtimes/supports/SWCRuntime.d.ts +9 -0
  98. package/lib/types/runtimes/supports/WebpackRuntime.d.ts +22 -0
  99. package/package.json +9 -6
  100. package/templates/init/.node-dev.json.hbs +5 -0
  101. package/templates/init/.swcrc.hbs +18 -0
  102. package/templates/init/docker/_partials/docker-body.hbs +5 -0
  103. package/templates/init/docker/_partials/docker-dev-tools.hbs +2 -0
  104. package/templates/init/docker/_partials/docker-header.hbs +16 -0
  105. package/templates/init/docker/bun/Dockerfile.hbs +36 -0
  106. package/templates/init/docker/npm/Dockerfile.hbs +28 -0
  107. package/templates/init/docker/pnpm/Dockerfile.hbs +28 -0
  108. package/templates/init/docker/yarn/Dockerfile.hbs +28 -0
  109. package/templates/init/docker/yarn_berry/Dockerfile.hbs +31 -0
  110. package/templates/init/processes.config.js.hbs +1 -1
  111. package/templates/init/Dockerfile.hbs +0 -60
@@ -1,10 +1,11 @@
1
- import { CliDefaultOptions, CliPlugins, CommandProvider, ProjectPackageJson, QuestionOptions } from "@tsed/cli-core";
1
+ import { CliDefaultOptions, CliPlugins, CommandProvider, PackageManagersModule, ProjectPackageJson, QuestionOptions } from "@tsed/cli-core";
2
2
  export interface AddCmdOptions extends CliDefaultOptions {
3
3
  name: string;
4
4
  }
5
5
  export declare class AddCmd implements CommandProvider {
6
6
  cliPlugins: CliPlugins;
7
7
  packageJson: ProjectPackageJson;
8
+ packageManagers: PackageManagersModule;
8
9
  $prompt(initialOptions: any): QuestionOptions;
9
10
  $exec(ctx: AddCmdOptions): ({
10
11
  title: string;
@@ -1,11 +1,16 @@
1
- import { CliExeca, CliFs, CliLoadFile, CliPackageJson, CliPlugins, CliService, CommandProvider, Configuration, ProjectPackageJson, QuestionOptions, RootRendererService } from "@tsed/cli-core";
1
+ import { CliExeca, CliFs, CliLoadFile, CliPackageJson, CliPlugins, CliService, CommandProvider, Configuration, PackageManagersModule, ProjectPackageJson, QuestionOptions, RootRendererService } from "@tsed/cli-core";
2
2
  import { OutputFilePathPipe } from "../../pipes/OutputFilePathPipe";
3
3
  import { InitCmdContext } from "./interfaces/InitCmdContext";
4
4
  import { InitOptions } from "./interfaces/InitOptions";
5
+ import { RuntimesModule } from "../../runtimes/RuntimesModule";
6
+ import { InitPlatformsModule } from "../../platforms/InitPlatformsModule";
5
7
  export declare class InitCmd implements CommandProvider {
6
8
  protected configuration: Configuration;
7
9
  protected cliPlugins: CliPlugins;
8
10
  protected packageJson: ProjectPackageJson;
11
+ protected packageManagers: PackageManagersModule;
12
+ protected runtimes: RuntimesModule;
13
+ protected platforms: InitPlatformsModule;
9
14
  protected cliPackageJson: CliPackageJson;
10
15
  protected cliService: CliService;
11
16
  protected cliLoadFile: CliLoadFile;
@@ -13,7 +18,7 @@ export declare class InitCmd implements CommandProvider {
13
18
  protected outputFilePathPipe: OutputFilePathPipe;
14
19
  protected execa: CliExeca;
15
20
  protected fs: CliFs;
16
- static checkPrecondition(availablePackageManagers: string[], ctx: InitCmdContext): void;
21
+ checkPrecondition(ctx: InitCmdContext): void;
17
22
  $beforePrompt(initialOptions: Partial<InitOptions>): Promise<any>;
18
23
  $prompt(initialOptions: Partial<InitOptions>): QuestionOptions;
19
24
  $mapContext(ctx: any): InitCmdContext;
@@ -31,6 +36,5 @@ export declare class InitCmd implements CommandProvider {
31
36
  addDependencies(ctx: InitCmdContext): void;
32
37
  addDevDependencies(ctx: InitCmdContext): void;
33
38
  addFeatures(ctx: InitCmdContext): void;
34
- private addExpressDependencies;
35
- private addKoaDependencies;
39
+ private generateFiles;
36
40
  }
@@ -38,20 +38,10 @@ export declare enum FeatureType {
38
38
  LINTER = "linter",
39
39
  ESLINT = "eslint",
40
40
  LINT_STAGED = "lintstaged",
41
- PRETTIER = "prettier",
42
- BUNDLER = "bundler",
43
- BABEL = "babel",
44
- WEBPACK = "babel:webpack"
41
+ PRETTIER = "prettier"
45
42
  }
46
43
  export declare const FeaturesMap: Record<string, Feature>;
47
- export declare const FeaturesPrompt: (availablePackageManagers: string[]) => ({
48
- message: string;
49
- type: string;
50
- name: string;
51
- when: (ctx: any) => boolean;
52
- choices: FeatureType[];
53
- default?: undefined;
54
- } | {
44
+ export declare const FeaturesPrompt: (availableRuntimes: string[], availablePackageManagers: string[]) => ({
55
45
  message: string;
56
46
  name: string;
57
47
  default: string;
@@ -63,6 +53,13 @@ export declare const FeaturesPrompt: (availablePackageManagers: string[]) => ({
63
53
  type: string;
64
54
  name: string;
65
55
  choices: string[];
56
+ default?: undefined;
66
57
  when?: undefined;
58
+ } | {
59
+ message: string;
60
+ type: string;
61
+ name: string;
62
+ when: (ctx: any) => boolean;
63
+ choices: string[];
67
64
  default?: undefined;
68
65
  })[];
@@ -14,6 +14,7 @@ export interface InitOptions {
14
14
  architecture: ArchitectureConvention;
15
15
  convention: ProjectConvention;
16
16
  packageManager: PackageManager;
17
+ runtime: "node" | "babel" | "swc" | "webpack" | "bun";
17
18
  oidcBasePath: string;
18
19
  file: string;
19
20
  }
@@ -1,2 +1,2 @@
1
1
  import { InitOptions } from "../interfaces/InitOptions";
2
- export declare function getFeaturesPrompt(availablePackageManagers: string[], options: Partial<InitOptions>): any[];
2
+ export declare function getFeaturesPrompt(runtimes: string[], availablePackageManagers: string[], options: Partial<InitOptions>): any[];
@@ -1,2 +1,2 @@
1
- export declare function hasValue(expression: string, value: any): (ctx: any) => boolean;
1
+ export declare function hasValue(expression: string, value: string | string[]): (ctx: any) => boolean;
2
2
  export declare function hasFeature(feature: string): (ctx: any) => boolean;
@@ -1,4 +1,4 @@
1
- import { CliDefaultOptions, CliPackageJson, CommandProvider, NpmRegistryClient, ProjectPackageJson, QuestionOptions } from "@tsed/cli-core";
1
+ import { CliDefaultOptions, CliPackageJson, CommandProvider, NpmRegistryClient, PackageManagersModule, ProjectPackageJson, QuestionOptions } from "@tsed/cli-core";
2
2
  export interface UpdateCmdContext extends CliDefaultOptions {
3
3
  version: string;
4
4
  [key: string]: any;
@@ -6,6 +6,7 @@ export interface UpdateCmdContext extends CliDefaultOptions {
6
6
  export declare class UpdateCmd implements CommandProvider {
7
7
  npmRegistryClient: NpmRegistryClient;
8
8
  projectPackage: ProjectPackageJson;
9
+ packageManagers: PackageManagersModule;
9
10
  cliPackage: CliPackageJson;
10
11
  private versions;
11
12
  $prompt(initialOptions: Partial<UpdateCmdContext>): Promise<QuestionOptions>;
@@ -7,6 +7,7 @@ export * from "./commands/init/config/FeaturesPrompt";
7
7
  export * from "./commands/generate/GenerateCmd";
8
8
  export * from "./commands/update/UpdateCmd";
9
9
  export * from "./commands/init/prompts/getFeaturesPrompt";
10
+ export * from "./runtimes/index";
10
11
  export * from "./interfaces";
11
12
  export * from "./services/ProvidersInfoService";
12
13
  export * from "./pipes";
@@ -0,0 +1,6 @@
1
+ import { InitBasePlatform } from "./supports/InitBasePlatform";
2
+ export declare class InitPlatformsModule {
3
+ private platforms;
4
+ constructor(platforms: InitBasePlatform[]);
5
+ get(name: string): InitBasePlatform;
6
+ }
@@ -0,0 +1,5 @@
1
+ export interface InitBasePlatform {
2
+ readonly name: string;
3
+ dependencies(ctx: any): Record<string, string>;
4
+ devDependencies(ctx: any): Record<string, string>;
5
+ }
@@ -0,0 +1,20 @@
1
+ import { InitBasePlatform } from "./InitBasePlatform";
2
+ export declare class InitExpressPlatform implements InitBasePlatform {
3
+ readonly name = "express";
4
+ dependencies(ctx: any): {
5
+ "@tsed/platform-express": any;
6
+ "body-parser": string;
7
+ cors: string;
8
+ compression: string;
9
+ "cookie-parser": string;
10
+ express: string;
11
+ "method-override": string;
12
+ };
13
+ devDependencies(ctx: any): {
14
+ "@types/cors": string;
15
+ "@types/express": string;
16
+ "@types/compression": string;
17
+ "@types/cookie-parser": string;
18
+ "@types/method-override": string;
19
+ };
20
+ }
@@ -0,0 +1,24 @@
1
+ import { InitBasePlatform } from "./InitBasePlatform";
2
+ export declare class InitKoaPlatform implements InitBasePlatform {
3
+ readonly name = "koa";
4
+ dependencies(ctx: any): {
5
+ "@tsed/platform-koa": any;
6
+ koa: string;
7
+ "@koa/cors": string;
8
+ "@koa/router": string;
9
+ "koa-qs": string;
10
+ "koa-bodyparser": string;
11
+ "koa-override": string;
12
+ "koa-compress": string;
13
+ };
14
+ devDependencies(ctx: any): {
15
+ "@types/koa": string;
16
+ "@types/koa-qs": string;
17
+ "@types/koa-json": string;
18
+ "@types/koa-bodyparser": string;
19
+ "@types/koa__router": string;
20
+ "@types/koa-compress": string;
21
+ "@types/koa-send": string;
22
+ "@types/koa__cors": string;
23
+ };
24
+ }
@@ -0,0 +1,20 @@
1
+ import { PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
2
+ import { BaseRuntime } from "./supports/BaseRuntime";
3
+ export interface RuntimeInitOptions extends Record<string, unknown> {
4
+ runtime?: string;
5
+ }
6
+ export declare class RuntimesModule {
7
+ protected runtimes: BaseRuntime[];
8
+ protected projectPackageJson: ProjectPackageJson;
9
+ protected packagesManager: PackageManagersModule;
10
+ constructor(runtimes: BaseRuntime[]);
11
+ init(ctx: RuntimeInitOptions): void;
12
+ list(): string[];
13
+ get(name?: string): BaseRuntime;
14
+ scripts(ctx: RuntimeInitOptions): {
15
+ build: string;
16
+ barrels: string;
17
+ start: string;
18
+ "start:prod": string;
19
+ };
20
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./RuntimesModule";
2
+ export * from "./supports/BabelRuntime";
3
+ export * from "./supports/BaseRuntime";
4
+ export * from "./supports/BunRuntime";
5
+ export * from "./supports/NodeRuntime";
6
+ export * from "./supports/SWCRuntime";
7
+ export * from "./supports/WebpackRuntime";
@@ -0,0 +1,19 @@
1
+ import { NodeRuntime } from "./NodeRuntime";
2
+ export declare class BabelRuntime extends NodeRuntime {
3
+ readonly name: string;
4
+ readonly order: number;
5
+ files(): string[];
6
+ startDev(main: string): string;
7
+ compile(src: string, out: string): string;
8
+ devDependencies(): {
9
+ "@babel/cli": string;
10
+ "@babel/core": string;
11
+ "@babel/node": string;
12
+ "@babel/plugin-proposal-class-properties": string;
13
+ "@babel/plugin-proposal-decorators": string;
14
+ "@babel/preset-env": string;
15
+ "@babel/preset-typescript": string;
16
+ "babel-plugin-transform-typescript-metadata": string;
17
+ "babel-watch": string;
18
+ };
19
+ }
@@ -0,0 +1,30 @@
1
+ import { CliExeca, PackageManagersModule } from "@tsed/cli-core";
2
+ export declare abstract class BaseRuntime {
3
+ abstract readonly name: string;
4
+ abstract readonly cmd: string;
5
+ readonly order: number;
6
+ protected packageManagers: PackageManagersModule;
7
+ protected cliExeca: CliExeca;
8
+ get packageManager(): import("@tsed/cli-core").BaseManager;
9
+ files(): string[];
10
+ has(): boolean;
11
+ run(args: string): string;
12
+ /**
13
+ * Returns the compile command
14
+ * @param src
15
+ * @param out
16
+ */
17
+ abstract compile(src: string, out: string): string;
18
+ /**
19
+ * Returns the start dev command
20
+ * @param main
21
+ */
22
+ abstract startDev(main: string): string;
23
+ /**
24
+ * Returns the start production command
25
+ * @param args
26
+ */
27
+ abstract startProd(args: string): string;
28
+ dependencies(): Record<string, any>;
29
+ devDependencies(): Record<string, any>;
30
+ }
@@ -0,0 +1,9 @@
1
+ import { BaseRuntime } from "./BaseRuntime";
2
+ export declare class BunRuntime extends BaseRuntime {
3
+ readonly name = "bun";
4
+ readonly cmd = "bun";
5
+ readonly order: number;
6
+ compile(src: string, out: string): string;
7
+ startDev(main: string): string;
8
+ startProd(args: string): string;
9
+ }
@@ -0,0 +1,10 @@
1
+ import { BaseRuntime } from "./BaseRuntime";
2
+ export declare class NodeRuntime extends BaseRuntime {
3
+ readonly name: string;
4
+ readonly cmd: string;
5
+ readonly order: number;
6
+ devDependencies(): Record<string, any>;
7
+ compile(src: string, out: string): string;
8
+ startDev(main: string): string;
9
+ startProd(args: string): string;
10
+ }
@@ -0,0 +1,9 @@
1
+ import { NodeRuntime } from "./NodeRuntime";
2
+ export declare class SWCRuntime extends NodeRuntime {
3
+ readonly name = "swc";
4
+ readonly order: number;
5
+ files(): string[];
6
+ startDev(main: string): string;
7
+ compile(src: string, out: string): string;
8
+ devDependencies(): Record<string, any>;
9
+ }
@@ -0,0 +1,22 @@
1
+ import { BabelRuntime } from "./BabelRuntime";
2
+ export declare class WebpackRuntime extends BabelRuntime {
3
+ readonly name = "webpack";
4
+ readonly order: number;
5
+ files(): string[];
6
+ compile(src: string, out: string): string;
7
+ startProd(main: string): string;
8
+ devDependencies(): {
9
+ "@babel/cli": string;
10
+ "@babel/core": string;
11
+ "@babel/node": string;
12
+ "@babel/plugin-proposal-class-properties": string;
13
+ "@babel/plugin-proposal-decorators": string;
14
+ "@babel/preset-env": string;
15
+ "@babel/preset-typescript": string;
16
+ "babel-plugin-transform-typescript-metadata": string;
17
+ "babel-watch": string;
18
+ "babel-loader": string;
19
+ webpack: string;
20
+ "webpack-cli": string;
21
+ };
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/cli",
3
- "version": "4.6.6",
3
+ "version": "5.0.0-rc.2",
4
4
  "source": "./src/index.ts",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -63,7 +63,7 @@
63
63
  "node": ">=14"
64
64
  },
65
65
  "dependencies": {
66
- "@tsed/cli-core": "4.6.6",
66
+ "@tsed/cli-core": "5.0.0-rc.2",
67
67
  "@tsed/core": ">=7.14.2",
68
68
  "@tsed/di": ">=7.14.2",
69
69
  "@tsed/logger": ">=6.2.1",
@@ -80,9 +80,9 @@
80
80
  "tslib": "2.3.1"
81
81
  },
82
82
  "devDependencies": {
83
- "@tsed/eslint": "4.6.6",
84
- "@tsed/jest-config": "4.6.6",
85
- "@tsed/typescript": "4.6.6",
83
+ "@tsed/eslint": "5.0.0-rc.2",
84
+ "@tsed/jest-config": "5.0.0-rc.2",
85
+ "@tsed/typescript": "5.0.0-rc.2",
86
86
  "@types/change-case": "^2.3.1",
87
87
  "cross-env": "7.0.3",
88
88
  "eslint": "8.22.0",
@@ -102,5 +102,8 @@
102
102
  },
103
103
  "homepage": "https://github.com/tsedio/tsed-cli/tree/master/packages/cli",
104
104
  "author": "Romain Lenzotti",
105
- "license": "MIT"
105
+ "license": "MIT",
106
+ "publishConfig": {
107
+ "tag": "rc"
108
+ }
106
109
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extensions": {
3
+ "ts": "@swc/register"
4
+ }
5
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "sourceMaps": true,
3
+ "jsc": {
4
+ "parser": {
5
+ "syntax": "typescript"
6
+ },
7
+ "target": "es2022",
8
+ "externalHelpers": true,
9
+ "keepClassNames": true,
10
+ "transform": {
11
+ "legacyDecorator": true,
12
+ "decoratorMetadata": true
13
+ }
14
+ },
15
+ "module": {
16
+ "type": "commonjs"
17
+ }
18
+ }
@@ -0,0 +1,5 @@
1
+ COPY . .
2
+
3
+ EXPOSE 8081
4
+ ENV PORT 8081
5
+ ENV NODE_ENV production
@@ -0,0 +1,2 @@
1
+ RUN apk update && apk add build-base git curl
2
+ RUN npm install -g pm2
@@ -0,0 +1,16 @@
1
+ ###############################################################################
2
+ ###############################################################################
3
+ ## _______ _____ ______ _____ ##
4
+ ## |__ __/ ____| ____| __ \ ##
5
+ ## | | | (___ | |__ | | | | ##
6
+ ## | | \___ \| __| | | | | ##
7
+ ## | | ____) | |____| |__| | ##
8
+ ## |_| |_____/|______|_____/ ##
9
+ ## ##
10
+ ## description : Dockerfile for TsED Application ##
11
+ ## author : TsED team ##
12
+ ## date : 2023-12-11 ##
13
+ ## version : 3.0 ##
14
+ ## ##
15
+ ###############################################################################
16
+ ###############################################################################
@@ -0,0 +1,36 @@
1
+ {{> docker-header }}
2
+
3
+ ARG BUN_VERSION=1
4
+
5
+ FROM oven/bun:${BUN_VERSION} as base
6
+ WORKDIR /opt
7
+
8
+ FROM base AS install
9
+ RUN mkdir -p /temp/dev
10
+ COPY package.json bun.lockb /temp/dev/
11
+ RUN cd /temp/dev && bun install --frozen-lockfile
12
+
13
+ # install with --production (exclude devDependencies)
14
+ RUN mkdir -p /temp/prod
15
+ COPY package.json bun.lockb /temp/prod/
16
+ RUN cd /temp/prod && bun install --frozen-lockfile --production
17
+
18
+ # copy node_modules from temp directory
19
+ # then copy all (non-ignored) project files into the image
20
+ FROM base AS prerelease
21
+ COPY --from=install /temp/dev/node_modules node_modules
22
+ COPY . .
23
+
24
+ RUN bun run build
25
+
26
+ # copy production dependencies and source code into final image
27
+ FROM base AS release
28
+ COPY --from=install /temp/prod/node_modules node_modules
29
+ COPY --from=prerelease /opt/dist/index.js .
30
+ COPY --from=prerelease /opt/package.json .
31
+
32
+ USER bun
33
+
34
+ {{> docker-body}}
35
+
36
+ CMD ["pm2-runtime", "start", "processes.config.js", "--env", "production", "--interpreter", "~/.bun/bin/bun"]
@@ -0,0 +1,28 @@
1
+ {{> docker-header }}
2
+
3
+ ARG NODE_VERSION=20.10.0
4
+
5
+ FROM node:${NODE_VERSION}-alpine as build
6
+ WORKDIR /opt
7
+
8
+ COPY package.json package-lock.json tsconfig.json tsconfig.compile.json .barrelsby.json ./
9
+
10
+ RUN npm ci
11
+
12
+ COPY ./src ./src
13
+
14
+ RUN npm run build
15
+
16
+ FROM node:${NODE_VERSION}-alpine as runtime
17
+ ENV WORKDIR /opt
18
+ WORKDIR $WORKDIR
19
+
20
+ {{> docker-dev-tools }}
21
+
22
+ COPY --from=build /opt .
23
+
24
+ RUN npm ci --omit=dev --ignore-scripts
25
+
26
+ {{> docker-body}}
27
+
28
+ CMD ["pm2-runtime", "start", "processes.config.js", "--env", "production"]
@@ -0,0 +1,28 @@
1
+ {{> docker-header }}
2
+
3
+ ARG NODE_VERSION=20.10.0
4
+
5
+ FROM node:${NODE_VERSION}-alpine as build
6
+ WORKDIR /opt
7
+
8
+ COPY package.json pnpm-lock.yaml tsconfig.json tsconfig.compile.json .barrelsby.json ./
9
+
10
+ RUN pnpm install --frozen-lockfile
11
+
12
+ COPY ./src ./src
13
+
14
+ RUN pnpm run build
15
+
16
+ FROM node:${NODE_VERSION}-alpine as runtime
17
+ ENV WORKDIR /opt
18
+ WORKDIR $WORKDIR
19
+
20
+ {{> docker-dev-tools }}
21
+
22
+ COPY --from=build /opt .
23
+
24
+ RUN pnpm install --frozen-lockfile --prod
25
+
26
+ {{> docker-body}}
27
+
28
+ CMD ["pm2-runtime", "start", "processes.config.js", "--env", "production"]
@@ -0,0 +1,28 @@
1
+ {{> docker-header }}
2
+
3
+ ARG NODE_VERSION=20.10.0
4
+
5
+ FROM node:${NODE_VERSION}-alpine as build
6
+ WORKDIR /opt
7
+
8
+ COPY package.json yarn.lock tsconfig.json tsconfig.compile.json .barrelsby.json ./
9
+
10
+ RUN yarn install --pure-lockfile
11
+
12
+ COPY ./src ./src
13
+
14
+ RUN yarn build
15
+
16
+ FROM node:${NODE_VERSION}-alpine as runtime
17
+ ENV WORKDIR /opt
18
+ WORKDIR $WORKDIR
19
+
20
+ {{> docker-dev-tools }}
21
+
22
+ COPY --from=build /opt .
23
+
24
+ RUN yarn install --pure-lockfile --production
25
+
26
+ {{> docker-body}}
27
+
28
+ CMD ["pm2-runtime", "start", "processes.config.js", "--env", "production"]
@@ -0,0 +1,31 @@
1
+ {{> docker-header }}
2
+
3
+ ARG NODE_VERSION=20.10.0
4
+
5
+ FROM node:${NODE_VERSION}-alpine as build
6
+ WORKDIR /opt
7
+
8
+ COPY package.json yarn.lock yarn.lock tsconfig.json tsconfig.compile.json .barrelsby.json ./
9
+
10
+ RUN yarn set version berry
11
+ RUN yarn install --immutable
12
+
13
+ COPY ./src ./src
14
+
15
+ RUN yarn build
16
+
17
+ FROM node:${NODE_VERSION}-alpine as runtime
18
+ ENV WORKDIR /opt
19
+ WORKDIR $WORKDIR
20
+
21
+ {{> docker-dev-tools }}
22
+
23
+ COPY --from=build /opt .
24
+
25
+ RUN yarn set version berry
26
+ RUN yarn install --immutable
27
+ ## RUN yarn workspaces focus --all --production
28
+
29
+ {{> docker-body}}
30
+
31
+ CMD ["pm2-runtime", "start", "processes.config.js", "--env", "production"]
@@ -7,9 +7,9 @@ module.exports = {
7
7
  'apps': [
8
8
  {
9
9
  name: "api",
10
+ {{#if bun}}interpreter: "~/.bun/bin/bun",{{/if}}
10
11
  'script': `${process.env.WORKDIR}/dist/index.js`,
11
12
  'cwd': process.env.WORKDIR,
12
- node_args: process.env.NODE_ARGS || "--max_old_space_size=1800",
13
13
  exec_mode: "cluster",
14
14
  instances: process.env.NODE_ENV === "test" ? 1 : process.env.NB_INSTANCES || 2,
15
15
  autorestart: true,
@@ -1,60 +0,0 @@
1
- ###############################################################################
2
- ###############################################################################
3
- ## _______ _____ ______ _____ ##
4
- ## |__ __/ ____| ____| __ \ ##
5
- ## | | | (___ | |__ | | | | ##
6
- ## | | \___ \| __| | | | | ##
7
- ## | | ____) | |____| |__| | ##
8
- ## |_| |_____/|______|_____/ ##
9
- ## ##
10
- ## description : Dockerfile for TsED Application ##
11
- ## author : TsED team ##
12
- ## date : 2022-03-05 ##
13
- ## version : 2.0 ##
14
- ## ##
15
- ###############################################################################
16
- ###############################################################################
17
- ARG NODE_VERSION=16.13.1
18
-
19
- FROM node:${NODE_VERSION}-alpine as build
20
- WORKDIR /opt
21
-
22
- COPY package.json {{#if yarn}}yarn.lock{{/if}}{{#if yarn_berry}}yarn.lock{{/if}}{{#if npm}}package-lock.json{{/if}}{{#if pnpm}}pnpm-lock.yaml{{/if}} tsconfig.json tsconfig.compile.json .barrelsby.json ./
23
-
24
- {{#if yarn}}
25
- RUN yarn install --pure-lockfile{{/if}}{{#if yarn}}
26
- RUN yarn install --immutable{{/if}}{{#if npm}}
27
- RUN npm install{{/if}}{{#if pnpm}}
28
- RUN pnpm install{{/if}}
29
-
30
- COPY ./src ./src
31
-
32
- {{#if yarn}}
33
- RUN yarn build{{/if}}
34
- {{#if yarn_berry}}
35
- RUN yarn build{{/if}}{{#if npm}}
36
- RUN npm run build{{/if}}{{#if pnpm}}
37
- RUN pnpm run build{{/if}}
38
-
39
- FROM node:${NODE_VERSION}-alpine as runtime
40
- ENV WORKDIR /opt
41
- WORKDIR $WORKDIR
42
-
43
- RUN apk update && apk add build-base git curl
44
- RUN npm install -g pm2
45
-
46
- COPY --from=build /opt .
47
-
48
- {{#if yarn}}
49
- RUN yarn install --pure-lockfile --production{{/if}}
50
-
51
- {{#if prisma}}
52
- COPY ./prisma ./prisma{{/if}}{{#or swagger oidc}}
53
- COPY ./views ./views{{/or}}
54
- COPY processes.config.js .
55
-
56
- EXPOSE 8081
57
- ENV PORT 8081
58
- ENV NODE_ENV production
59
-
60
- CMD ["pm2-runtime", "start", "processes.config.js", "--env", "production"]