@tsed/cli 6.6.3 → 7.0.0-alpha.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 (246) hide show
  1. package/lib/esm/commands/add/AddCmd.js +16 -16
  2. package/lib/esm/commands/generate/GenerateCmd.js +69 -222
  3. package/lib/esm/commands/generate/mappers/mapGenerateContext.js +29 -0
  4. package/lib/esm/commands/init/InitCmd.js +190 -171
  5. package/lib/esm/commands/init/config/FeaturesPrompt.js +101 -3
  6. package/lib/esm/commands/init/mappers/mapToContext.js +4 -3
  7. package/lib/esm/commands/run/RunCmd.js +22 -26
  8. package/lib/esm/commands/update/UpdateCmd.js +9 -13
  9. package/lib/esm/fn/exec.js +5 -0
  10. package/lib/esm/fn/render.js +5 -0
  11. package/lib/esm/fn/taskOutput.js +7 -0
  12. package/lib/esm/index.js +7 -4
  13. package/lib/esm/interfaces/AlterPackageJson.js +1 -0
  14. package/lib/esm/interfaces/AlterProjectFiles.js +1 -0
  15. package/lib/esm/interfaces/AlterRenderFiles.js +1 -0
  16. package/lib/esm/interfaces/CliCommandHooks.js +1 -0
  17. package/lib/esm/interfaces/GenerateCmdContext.js +1 -0
  18. package/lib/esm/interfaces/InitCmdOptions.js +1 -0
  19. package/lib/esm/interfaces/RenderDataContext.js +1 -0
  20. package/lib/esm/interfaces/RuntimeTypes.js +1 -0
  21. package/lib/esm/interfaces/index.js +9 -0
  22. package/lib/esm/pipes/OutputFilePathPipe.js +40 -18
  23. package/lib/esm/pipes/RoutePipe.js +4 -8
  24. package/lib/esm/pipes/{ClassNamePipe.js → SymbolNamePipe.js} +14 -11
  25. package/lib/esm/pipes/index.js +1 -1
  26. package/lib/esm/platforms/{InitPlatformsModule.js → PlatformsModule.js} +4 -10
  27. package/lib/esm/platforms/supports/InitExpressPlatform.js +27 -10
  28. package/lib/esm/platforms/supports/InitFastifyPlatform.js +27 -10
  29. package/lib/esm/platforms/supports/InitKoaPlatform.js +16 -10
  30. package/lib/esm/processors/__fixtures__/createFakeProject.js +35 -0
  31. package/lib/esm/processors/transformBinFile.js +47 -0
  32. package/lib/esm/processors/transformConfigFile.js +105 -0
  33. package/lib/esm/processors/transformIndexFile.js +23 -0
  34. package/lib/esm/processors/transformServerFile.js +60 -0
  35. package/lib/esm/runtimes/RuntimesModule.js +7 -17
  36. package/lib/esm/runtimes/supports/BabelRuntime.js +5 -11
  37. package/lib/esm/runtimes/supports/BunRuntime.js +4 -10
  38. package/lib/esm/runtimes/supports/NodeRuntime.js +1 -1
  39. package/lib/esm/runtimes/supports/WebpackRuntime.js +1 -1
  40. package/lib/esm/services/CliProjectService.js +96 -0
  41. package/lib/esm/services/CliRunScript.js +4 -8
  42. package/lib/esm/services/CliTemplatesService.js +68 -0
  43. package/lib/esm/services/ProjectClient.js +161 -0
  44. package/lib/esm/services/mappers/mapDefaultTemplateOptions.js +30 -0
  45. package/lib/esm/templates/asyncFactory.template.js +38 -0
  46. package/lib/esm/templates/barrels.template.js +22 -0
  47. package/lib/esm/templates/command.template.js +56 -0
  48. package/lib/esm/templates/config.template.js +27 -0
  49. package/lib/esm/templates/controller.template.js +45 -0
  50. package/lib/esm/templates/decorator.template.js +182 -0
  51. package/lib/esm/templates/docker-compose.template.js +25 -0
  52. package/lib/esm/templates/dockerfile.template.js +236 -0
  53. package/lib/esm/templates/exception-filter.template.js +19 -0
  54. package/lib/esm/templates/factory.template.js +37 -0
  55. package/lib/esm/templates/index.command.template.js +18 -0
  56. package/lib/esm/templates/index.config.utils.template.js +17 -0
  57. package/{templates/init/src/controllers/pages/IndexController.ts.hbs → lib/esm/templates/index.controller.template.js} +14 -3
  58. package/lib/esm/templates/index.js +32 -0
  59. package/lib/esm/templates/index.logger.template.js +38 -0
  60. package/{templates/init/src/index.ts.hbs → lib/esm/templates/index.template.js} +17 -5
  61. package/lib/esm/templates/interceptor.template.js +31 -0
  62. package/lib/esm/templates/interface.template.js +13 -0
  63. package/lib/esm/templates/middleware.template.js +34 -0
  64. package/lib/esm/templates/model.template.js +16 -0
  65. package/lib/esm/templates/module.template.js +16 -0
  66. package/lib/esm/templates/pipe.template.js +19 -0
  67. package/lib/esm/templates/pm2.template.js +111 -0
  68. package/lib/esm/templates/prisma.service.template.js +23 -0
  69. package/{templates/init/README.md.hbs → lib/esm/templates/readme.template.js} +28 -13
  70. package/lib/esm/templates/repository.template.js +16 -0
  71. package/lib/esm/templates/response-filter.template.js +19 -0
  72. package/lib/esm/templates/server.template.js +37 -0
  73. package/lib/esm/templates/service.template.js +16 -0
  74. package/lib/esm/templates/tsconfig.spec.template.js +34 -0
  75. package/lib/esm/templates/tsconfig.template.js +31 -0
  76. package/lib/esm/templates/value.template.js +13 -0
  77. package/lib/esm/utils/defineTemplate.js +13 -0
  78. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  79. package/lib/types/commands/add/AddCmd.d.ts +2 -2
  80. package/lib/types/commands/generate/GenerateCmd.d.ts +33 -87
  81. package/lib/types/commands/generate/mappers/mapGenerateContext.d.ts +2 -0
  82. package/lib/types/commands/init/InitCmd.d.ts +18 -20
  83. package/lib/types/commands/init/config/FeaturesPrompt.d.ts +11 -2
  84. package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -2
  85. package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +1 -1
  86. package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +1 -1
  87. package/lib/types/commands/update/UpdateCmd.d.ts +2 -2
  88. package/lib/types/fn/exec.d.ts +1 -0
  89. package/lib/types/fn/render.d.ts +2 -0
  90. package/lib/types/fn/taskOutput.d.ts +1 -0
  91. package/lib/types/index.d.ts +7 -4
  92. package/lib/types/interfaces/AlterGenerateTasks.d.ts +5 -0
  93. package/lib/types/interfaces/AlterInitSubTasks.d.ts +5 -0
  94. package/lib/types/interfaces/AlterPackageJson.d.ts +5 -0
  95. package/lib/types/interfaces/AlterProjectFiles.d.ts +5 -0
  96. package/lib/types/interfaces/AlterRenderFiles.d.ts +10 -0
  97. package/lib/types/interfaces/CliCommandHooks.d.ts +11 -0
  98. package/lib/types/interfaces/GenerateCmdContext.d.ts +19 -0
  99. package/lib/types/interfaces/InitCmdOptions.d.ts +8 -0
  100. package/lib/types/interfaces/PlatformType.d.ts +7 -0
  101. package/lib/types/interfaces/RenderDataContext.d.ts +61 -0
  102. package/lib/types/interfaces/RuntimeTypes.d.ts +8 -0
  103. package/lib/types/interfaces/index.d.ts +9 -0
  104. package/lib/types/pipes/OutputFilePathPipe.d.ts +7 -4
  105. package/lib/types/pipes/{ClassNamePipe.d.ts → SymbolNamePipe.d.ts} +3 -3
  106. package/lib/types/pipes/index.d.ts +1 -1
  107. package/lib/types/platforms/{InitPlatformsModule.d.ts → PlatformsModule.d.ts} +1 -1
  108. package/lib/types/platforms/supports/InitBasePlatform.d.ts +3 -0
  109. package/lib/types/platforms/supports/InitExpressPlatform.d.ts +2 -0
  110. package/lib/types/platforms/supports/InitFastifyPlatform.d.ts +2 -0
  111. package/lib/types/platforms/supports/InitKoaPlatform.d.ts +2 -0
  112. package/lib/types/processors/__fixtures__/createFakeProject.d.ts +5 -0
  113. package/lib/types/processors/transformBinFile.d.ts +3 -0
  114. package/lib/types/processors/transformConfigFile.d.ts +3 -0
  115. package/lib/types/processors/transformIndexFile.d.ts +3 -0
  116. package/lib/types/processors/transformServerFile.d.ts +3 -0
  117. package/lib/types/runtimes/RuntimesModule.d.ts +5 -5
  118. package/lib/types/services/CliProjectService.d.ts +16 -0
  119. package/lib/types/services/CliTemplatesService.d.ts +29 -0
  120. package/lib/types/services/ProjectClient.d.ts +40 -0
  121. package/lib/types/services/mappers/mapDefaultTemplateOptions.d.ts +11 -0
  122. package/lib/types/templates/asyncFactory.template.d.ts +2 -0
  123. package/lib/types/templates/barrels.template.d.ts +2 -0
  124. package/lib/types/templates/command.template.d.ts +2 -0
  125. package/lib/types/templates/config.template.d.ts +2 -0
  126. package/lib/types/templates/controller.template.d.ts +2 -0
  127. package/lib/types/templates/decorator.template.d.ts +2 -0
  128. package/lib/types/templates/docker-compose.template.d.ts +2 -0
  129. package/lib/types/templates/dockerfile.template.d.ts +1 -0
  130. package/lib/types/templates/exception-filter.template.d.ts +2 -0
  131. package/lib/types/templates/factory.template.d.ts +2 -0
  132. package/lib/types/templates/index.command.template.d.ts +2 -0
  133. package/lib/types/templates/index.config.utils.template.d.ts +2 -0
  134. package/lib/types/templates/index.controller.template.d.ts +2 -0
  135. package/lib/types/templates/index.d.ts +31 -0
  136. package/lib/types/templates/index.logger.template.d.ts +2 -0
  137. package/lib/types/templates/index.template.d.ts +2 -0
  138. package/lib/types/templates/interceptor.template.d.ts +2 -0
  139. package/lib/types/templates/interface.template.d.ts +2 -0
  140. package/lib/types/templates/middleware.template.d.ts +2 -0
  141. package/lib/types/templates/model.template.d.ts +2 -0
  142. package/lib/types/templates/module.template.d.ts +2 -0
  143. package/lib/types/templates/pipe.template.d.ts +2 -0
  144. package/lib/types/templates/pm2.template.d.ts +1 -0
  145. package/lib/types/templates/prisma.service.template.d.ts +2 -0
  146. package/lib/types/templates/readme.template.d.ts +2 -0
  147. package/lib/types/templates/repository.template.d.ts +2 -0
  148. package/lib/types/templates/response-filter.template.d.ts +2 -0
  149. package/lib/types/templates/server.template.d.ts +2 -0
  150. package/lib/types/templates/service.template.d.ts +2 -0
  151. package/lib/types/templates/tsconfig.spec.template.d.ts +2 -0
  152. package/lib/types/templates/tsconfig.template.d.ts +2 -0
  153. package/lib/types/templates/value.template.d.ts +2 -0
  154. package/lib/types/utils/defineTemplate.d.ts +39 -0
  155. package/package.json +14 -12
  156. package/templates/tsconfig.node.json +14 -0
  157. package/templates/webpack.config.js +55 -0
  158. package/lib/esm/commands/generate/ProviderTypes.js +0 -103
  159. package/lib/esm/commands/init/interfaces/InitOptions.js +0 -5
  160. package/lib/esm/services/ProvidersInfoService.js +0 -46
  161. package/lib/esm/services/Renderer.js +0 -162
  162. package/lib/esm/utils/fillImports.js +0 -38
  163. package/lib/esm/utils/hbs/array.js +0 -515
  164. package/lib/esm/utils/hbs/collection.js +0 -60
  165. package/lib/esm/utils/hbs/comparison.js +0 -431
  166. package/lib/esm/utils/hbs/index.js +0 -11
  167. package/lib/esm/utils/hbs/object.js +0 -236
  168. package/lib/esm/utils/hbs/switch.js +0 -10
  169. package/lib/esm/utils/renderer/insertAfter.js +0 -12
  170. package/lib/esm/utils/renderer/insertImport.js +0 -11
  171. package/lib/types/commands/generate/ProviderTypes.d.ts +0 -11
  172. package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +0 -6
  173. package/lib/types/commands/init/interfaces/InitOptions.d.ts +0 -20
  174. package/lib/types/services/ProvidersInfoService.d.ts +0 -21
  175. package/lib/types/services/Renderer.d.ts +0 -44
  176. package/lib/types/utils/fillImports.d.ts +0 -1
  177. package/lib/types/utils/hbs/array.d.ts +0 -1
  178. package/lib/types/utils/hbs/collection.d.ts +0 -1
  179. package/lib/types/utils/hbs/comparison.d.ts +0 -1
  180. package/lib/types/utils/hbs/object.d.ts +0 -1
  181. package/lib/types/utils/hbs/switch.d.ts +0 -1
  182. package/lib/types/utils/renderer/insertAfter.d.ts +0 -1
  183. package/lib/types/utils/renderer/insertImport.d.ts +0 -1
  184. package/templates/generate/async.factory.hbs +0 -35
  185. package/templates/generate/command.hbs +0 -45
  186. package/templates/generate/controller.hbs +0 -10
  187. package/templates/generate/decorator.class.hbs +0 -14
  188. package/templates/generate/decorator.endpoint.hbs +0 -15
  189. package/templates/generate/decorator.generic.hbs +0 -19
  190. package/templates/generate/decorator.method.hbs +0 -16
  191. package/templates/generate/decorator.middleware.hbs +0 -26
  192. package/templates/generate/decorator.param.hbs +0 -15
  193. package/templates/generate/decorator.parameters.hbs +0 -9
  194. package/templates/generate/decorator.prop.hbs +0 -14
  195. package/templates/generate/decorator.property.hbs +0 -5
  196. package/templates/generate/exception-filter.hbs +0 -9
  197. package/templates/generate/factory.hbs +0 -11
  198. package/templates/generate/injectable.hbs +0 -6
  199. package/templates/generate/interceptor.hbs +0 -21
  200. package/templates/generate/interface.hbs +0 -3
  201. package/templates/generate/middleware.hbs +0 -9
  202. package/templates/generate/model.hbs +0 -6
  203. package/templates/generate/module.hbs +0 -6
  204. package/templates/generate/pipe.hbs +0 -9
  205. package/templates/generate/prisma.service.hbs +0 -13
  206. package/templates/generate/repository.hbs +0 -6
  207. package/templates/generate/response-filter.hbs +0 -9
  208. package/templates/generate/server/_partials/server-footer.hbs +0 -10
  209. package/templates/generate/server/_partials/server-header.hbs +0 -34
  210. package/templates/generate/server/express/server.hbs +0 -10
  211. package/templates/generate/server/fastify/server.hbs +0 -14
  212. package/templates/generate/server/koa/server.hbs +0 -8
  213. package/templates/generate/service.hbs +0 -6
  214. package/templates/generate/value.hbs +0 -3
  215. package/templates/init/.barrels.json.hbs +0 -9
  216. package/templates/init/.gitignore.hbs +0 -57
  217. package/templates/init/.npmrc.hbs +0 -2
  218. package/templates/init/docker/_partials/docker-body.hbs +0 -5
  219. package/templates/init/docker/_partials/docker-dev-tools.hbs +0 -2
  220. package/templates/init/docker/_partials/docker-header.hbs +0 -16
  221. package/templates/init/docker/bun/Dockerfile.hbs +0 -36
  222. package/templates/init/docker/npm/Dockerfile.hbs +0 -28
  223. package/templates/init/docker/pnpm/Dockerfile.hbs +0 -28
  224. package/templates/init/docker/yarn/Dockerfile.hbs +0 -28
  225. package/templates/init/docker/yarn_berry/Dockerfile.hbs +0 -31
  226. package/templates/init/docker-compose.yml.hbs +0 -14
  227. package/templates/init/pm2/bun/processes.config.cjs.hbs +0 -23
  228. package/templates/init/pm2/node-compiled/processes.config.cjs.hbs +0 -22
  229. package/templates/init/pm2/node-loader/processes.config.cjs.hbs +0 -24
  230. package/templates/init/src/bin/index.ts.hbs +0 -9
  231. package/templates/init/src/config/envs/index.ts.hbs +0 -7
  232. package/templates/init/src/config/index.ts.hbs +0 -38
  233. package/templates/init/src/config/logger/index.ts.hbs +0 -25
  234. package/templates/init/tsconfig.json.hbs +0 -16
  235. package/templates/init/tsconfig.node.json.hbs +0 -20
  236. package/templates/init/tsconfig.spec.json.hbs +0 -25
  237. package/templates/init/webpack.config.js.hbs +0 -65
  238. /package/lib/esm/{commands/init/interfaces/InitCmdContext.js → interfaces/AlterGenerateTasks.js} +0 -0
  239. /package/lib/{types/utils/hbs/index.d.ts → esm/interfaces/AlterInitSubTasks.js} +0 -0
  240. /package/templates/{init/.babelrc.hbs → .babelrc} +0 -0
  241. /package/templates/{init/.dockerignore.hbs → .dockerignore} +0 -0
  242. /package/templates/{init/.swcrc.hbs → .swcrc} +0 -0
  243. /package/templates/{init/.yarnrc.hbs → .yarnrc} +0 -0
  244. /package/templates/{init/nodemon.json.hbs → nodemon.json} +0 -0
  245. /package/templates/{init/tsconfig.base.json.hbs → tsconfig.base.json} +0 -0
  246. /package/templates/{init/views/swagger.ejs.hbs → views/swagger.ejs} +0 -0
@@ -1,21 +0,0 @@
1
- import {InterceptorMethods, InterceptorContext, InterceptorMethods, Interceptor} from "@tsed/di";
2
-
3
- @Interceptor()
4
- export class {{symbolName}} implements InterceptorMethods {
5
- /**
6
- * ctx: The context that holds the dynamic data related to the method execution and the proceed method
7
- * to proceed with the original method execution
8
- *
9
- * opts: Static params that can be provided when the interceptor is attached to a specific method
10
- */
11
- async intercept(context: InterceptorContext<any>, next: InterceptorMethods) {
12
- console.log(`the method ${context.propertyKey} will be executed with args ${context.args} and static data ${context.options}`);
13
- // let the original method by calling next function
14
- const result = await next();
15
-
16
- console.log(`the method was executed, and returned ${result}`);
17
-
18
- // must return the returned value back to the caller
19
- return result;
20
- }
21
- }
@@ -1,3 +0,0 @@
1
- export interface {{symbolName}} {
2
-
3
- }
@@ -1,9 +0,0 @@
1
- import {Middleware, MiddlewareMethods} from "@tsed/platform-middlewares";
2
- import {Context} from "@tsed/platform-params";
3
-
4
- @Middleware()
5
- export class {{symbolName}} implements MiddlewareMethods {
6
- use(@Context() ctx: Context) {
7
-
8
- }
9
- }
@@ -1,6 +0,0 @@
1
- import {Property} from "@tsed/schema";
2
-
3
- export class {{symbolName}} {
4
- @Property()
5
- id: string;
6
- }
@@ -1,6 +0,0 @@
1
- import {Module} from "@tsed/di";
2
-
3
- @Module()
4
- export class {{symbolName}} {
5
-
6
- }
@@ -1,9 +0,0 @@
1
- import {Injectable} from "@tsed/di";
2
- import {PipeMethods, ParamMetadata} from "@tsed/platform-params";
3
-
4
- @Injectable()
5
- export class {{symbolName}} extends PipeMethods {
6
- transform(value: any, param: ParamMetadata) {
7
- return null;
8
- }
9
- }
@@ -1,13 +0,0 @@
1
- import { Injectable, OnInit, OnDestroy } from "@tsed/di";
2
- import { PrismaClient } from "@prisma/client";
3
-
4
- @Injectable()
5
- export class PrismaService extends PrismaClient implements OnInit, OnDestroy {
6
- async $onInit() {
7
- await this.$connect();
8
- }
9
-
10
- async $onDestroy() {
11
- await this.$disconnect();
12
- }
13
- }
@@ -1,6 +0,0 @@
1
- import {Injectable} from "@tsed/di";
2
-
3
- @Injectable()
4
- export class {{symbolName}} {
5
-
6
- }
@@ -1,9 +0,0 @@
1
- import {ResponseFilter, ResponseFilterMethods} from "@tsed/platform-response-filter";
2
- import {BaseContext} from "@tsed/di";
3
-
4
- @ResponseFilter("text/xml")
5
- export class XmlResponseFilter implements ResponseFilterMethods {
6
- transform(data: any, ctx: BaseContext) {
7
- return jsToXML(data);
8
- }
9
- }
@@ -1,10 +0,0 @@
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
- }
@@ -1,34 +0,0 @@
1
- import {join} from "node:path";
2
- import {Configuration} from "@tsed/di";
3
- import {application} from "@tsed/platform-http";
4
- {{#forEach imports}}{{#if tsIngore}}
5
- // @ts-ignore
6
- {{/if}}import {{symbols}}{{#if symbols}} from {{/if}}"{{from}}";{{comment}}
7
- {{/forEach}}
8
-
9
- @Configuration({
10
- ...config,
11
- acceptMimes: ["application/json"],
12
- httpPort: process.env.PORT || 8083,
13
- httpsPort: false, // CHANGE
14
- mount: {
15
- "{{route}}": [
16
- ...Object.values(rest)
17
- ]{{#or swagger oidc}},
18
- "/": [{{#if swagger}}
19
- ...Object.values(pages){{/if}}{{#and swagger oidc}},{{/and}}{{#if oidc}}
20
- InteractionsController{{/if}}
21
- ]{{/or}}
22
- },{{#if swagger}}
23
- swagger: [
24
- {
25
- path: "/doc",
26
- specVersion: "3.0.1"
27
- }
28
- ],{{/if}}{{#if scalar}}
29
- scalar: [
30
- {
31
- path: {{#if swagger}}"/scalar/doc"{{else}}"/doc"{{/if}},
32
- specVersion: "3.0.1"
33
- }
34
- ],{{/if}}
@@ -1,10 +0,0 @@
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 }}
@@ -1,14 +0,0 @@
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 }}
@@ -1,8 +0,0 @@
1
- {{> server-header }}
2
- middlewares: [
3
- "@koa/cors",
4
- "koa-compress",
5
- "koa-override",
6
- "koa-bodyparser"
7
- ],
8
- {{> server-footer }}
@@ -1,6 +0,0 @@
1
- import {Injectable} from "@tsed/di";
2
-
3
- @Injectable()
4
- export class {{symbolName}} {
5
-
6
- }
@@ -1,3 +0,0 @@
1
- import {injectable} from "@tsed/di";
2
-
3
- export const {{symbolName}} = injectable(Symbol.for("{{symbolName}}")).value({}).token();
@@ -1,9 +0,0 @@
1
- {
2
- "directory": {{{barrels}}},
3
- "exclude": [
4
- "**/__mock__",
5
- "**/__mocks__",
6
- "**/*.spec.ts"
7
- ],
8
- "delete": true
9
- }
@@ -1,57 +0,0 @@
1
- ### Node template
2
- .DS_Store
3
- # Logs
4
- logs
5
- *.log
6
- npm-debug.log*
7
-
8
- # Runtime data
9
- pids
10
- *.pid
11
- *.seed
12
-
13
- # Directory for instrumented libs generated by jscoverage/JSCover
14
- lib-cov
15
-
16
- # Coverage directory used by tools like istanbul
17
- coverage
18
-
19
- # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
20
- .grunt
21
-
22
- # node-waf configuration
23
- .lock-wscript
24
-
25
- # Compiled binary addons (http://nodejs.org/api/addons.html)
26
- build/Release
27
-
28
- # Dependency directory
29
- # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
30
- node_modules
31
- .npmrc
32
- *.log
33
-
34
- # Typings
35
- typings/
36
-
37
- # Typescript
38
- {{srcDir}}/**/*.js
39
- {{srcDir}}/**/*.js.map
40
- test/**/*.js
41
- test/**/*.js.map
42
-
43
- # Test
44
- /.tmp
45
- /.nyc_output
46
-
47
- # IDE
48
- .vscode
49
- .idea
50
-
51
- # Project
52
- /public
53
- /dist
54
-
55
- #env
56
- .env.local
57
- .env.development
@@ -1,2 +0,0 @@
1
- @tsedio:registry=https://npm.pkg.github.com
2
- //npm.pkg.github.com/:_authToken=${GH_TOKEN}
@@ -1,5 +0,0 @@
1
- COPY . .
2
-
3
- EXPOSE 8081
4
- ENV PORT 8081
5
- ENV NODE_ENV production
@@ -1,2 +0,0 @@
1
- RUN apk update && apk add build-base git curl
2
- RUN npm install -g pm2
@@ -1,16 +0,0 @@
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
- ###############################################################################
@@ -1,36 +0,0 @@
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.cjs", "--env", "production", "--interpreter", "~/.bun/bin/bun"]
@@ -1,28 +0,0 @@
1
- {{> docker-header }}
2
-
3
- ARG NODE_VERSION=20.11.0
4
-
5
- FROM node:${NODE_VERSION}-alpine AS build
6
- WORKDIR /opt
7
-
8
- COPY package.json package-lock.json tsconfig.json tsconfig.base.json tsconfig.node.json tsconfig.spec.json .barrels.json .swcrc ./
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.cjs", "--env", "production"]
@@ -1,28 +0,0 @@
1
- {{> docker-header }}
2
-
3
- ARG NODE_VERSION=20.11.0
4
-
5
- FROM node:${NODE_VERSION}-alpine AS build
6
- WORKDIR /opt
7
-
8
- COPY package.json pnpm-lock.yaml tsconfig.json tsconfig.base.json tsconfig.node.json tsconfig.spec.json .barrels.json .swcrc ./
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.cjs", "--env", "production"]
@@ -1,28 +0,0 @@
1
- {{> docker-header }}
2
-
3
- ARG NODE_VERSION=20.11.0
4
-
5
- FROM node:${NODE_VERSION}-alpine AS build
6
- WORKDIR /opt
7
-
8
- COPY package.json yarn.lock tsconfig.json tsconfig.base.json tsconfig.node.json tsconfig.spec.json .barrels.json .swcrc ./
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.cjs", "--env", "production"]
@@ -1,31 +0,0 @@
1
- {{> docker-header }}
2
-
3
- ARG NODE_VERSION=20.11.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.base.json tsconfig.node.json tsconfig.spec.json .barrels.json .swcrc ./
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.cjs", "--env", "production"]
@@ -1,14 +0,0 @@
1
- version: '3.5'
2
- services:
3
- server:
4
- build:
5
- context: .
6
- dockerfile: ./Dockerfile
7
- args:
8
- - http_proxy
9
- - https_proxy
10
- - no_proxy
11
- image: {{projectName}}/server:latest
12
- ports:
13
- - "8081:8081"
14
-
@@ -1,23 +0,0 @@
1
- 'use strict'
2
-
3
- const path = require('path')
4
- const defaultLogFile = path.join(__dirname, '/logs/project-server.log')
5
-
6
- module.exports = {
7
- 'apps': [
8
- {
9
- name: 'api',
10
- interpreter: '~/.bun/bin/bun',
11
- 'script': `${process.env.WORKDIR}/dist/index.js`,
12
- 'cwd': process.env.WORKDIR,
13
- exec_mode: 'cluster',
14
- instances: process.env.NODE_ENV === 'test' ? 1 : process.env.NB_INSTANCES || 2,
15
- autorestart: true,
16
- max_memory_restart: process.env.MAX_MEMORY_RESTART || '750M',
17
- 'out_file': defaultLogFile,
18
- 'error_file': defaultLogFile,
19
- 'merge_logs': true,
20
- 'kill_timeout': 30000,
21
- }
22
- ]
23
- }
@@ -1,22 +0,0 @@
1
- 'use strict'
2
-
3
- const path = require('path')
4
- const defaultLogFile = path.join(__dirname, '/logs/project-server.log')
5
-
6
- module.exports = {
7
- 'apps': [
8
- {
9
- name: 'api',
10
- 'script': `${process.env.WORKDIR}/dist/index.js`,
11
- 'cwd': process.env.WORKDIR,
12
- exec_mode: "cluster",
13
- instances: process.env.NODE_ENV === 'test' ? 1 : process.env.NB_INSTANCES || 2,
14
- autorestart: true,
15
- max_memory_restart: process.env.MAX_MEMORY_RESTART || '750M',
16
- 'out_file': defaultLogFile,
17
- 'error_file': defaultLogFile,
18
- 'merge_logs': true,
19
- 'kill_timeout': 30000,
20
- }
21
- ]
22
- }
@@ -1,24 +0,0 @@
1
- 'use strict'
2
-
3
- const path = require('path')
4
- const defaultLogFile = path.join(__dirname, '/logs/project-server.log')
5
-
6
- module.exports = {
7
- 'apps': [
8
- {
9
- name: 'api',
10
- 'interpreter': 'node',
11
- interpreter_args: '--import @swc-node/register/esm-register --enable-source-maps',
12
- 'script': `${process.env.WORKDIR}/src/index.ts`,
13
- 'cwd': process.env.WORKDIR,
14
- exec_mode: 'cluster',
15
- instances: process.env.NODE_ENV === 'test' ? 1 : process.env.NB_INSTANCES || 2,
16
- autorestart: true,
17
- max_memory_restart: process.env.MAX_MEMORY_RESTART || '750M',
18
- 'out_file': defaultLogFile,
19
- 'error_file': defaultLogFile,
20
- 'merge_logs': true,
21
- 'kill_timeout': 30000,
22
- }
23
- ]
24
- }
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import {CliCore} from "@tsed/cli-core";
3
- import {config} from "../config/index.js";
4
-
5
- CliCore.bootstrap({
6
- ...config,
7
- commands: [
8
- ]
9
- }).catch(console.error);
@@ -1,7 +0,0 @@
1
- import dotenv from "dotenv-flow";
2
-
3
- process.env.NODE_ENV = process.env.NODE_ENV || "development";
4
-
5
- export const config = dotenv.config();
6
- export const isProduction = process.env.NODE_ENV === "production";
7
- export const envs = process.env
@@ -1,38 +0,0 @@
1
- import {readFileSync} from "node:fs";
2
- import {envs} from "./envs/index.js";
3
- import loggerConfig from "./logger/index.js";{{#if mongoose}}
4
- import mongooseConfig from "./mongoose/index.js";
5
- {{/if}}{{#if oidc}}
6
- import oidcConfig from "./oidc/index.js";
7
- import {FileSyncAdapter} from "@tsed/adapters";
8
- {{/if}}
9
-
10
- const pkg = JSON.parse(readFileSync("./package.json", {encoding: "utf8"}));
11
-
12
- export const config: Partial<TsED.Configuration> = {
13
- version: pkg.version,
14
- envs,
15
- ajv: {
16
- returnsCoercedValues: true
17
- },
18
- logger: loggerConfig,
19
- {{#if mongoose}}
20
- mongoose: mongooseConfig,
21
- {{/if}}
22
- {{#if graphql}}
23
- graphql: {
24
- default: {
25
- path: "/graphql",
26
- buildSchemaOptions: {
27
- }
28
- }
29
- },
30
- {{/if}}
31
- {{#if oidc}}
32
- oidc: oidcConfig,
33
- adapters: [
34
- FileSyncAdapter
35
- ]
36
- {{/if}}
37
- // additional shared configuration
38
- };
@@ -1,25 +0,0 @@
1
- import {DILoggerOptions} from "@tsed/di";
2
- import {$log} from "@tsed/logger";
3
- import {isProduction} from "../envs/index.js";
4
-
5
- if (isProduction) {
6
- $log.appenders.set("stdout", {
7
- type: "stdout",
8
- levels: ["info", "debug"],
9
- layout: {
10
- type: "json"
11
- }
12
- });
13
-
14
- $log.appenders.set("stderr", {
15
- levels: ["trace", "fatal", "error", "warn"],
16
- type: "stderr",
17
- layout: {
18
- type: "json"
19
- }
20
- });
21
- }
22
-
23
- export default <DILoggerOptions> {
24
- disableRoutesSummary: isProduction
25
- };
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "./tsconfig.base.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "noEmit": true
6
- },
7
- "include": [],
8
- "references": [
9
- {
10
- "path": "./tsconfig.node.json"
11
- }{{#if testing}},
12
- {
13
- "path": "./tsconfig.spec.json"
14
- }{{/if}}
15
- ]
16
- }
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "./tsconfig.base.json",
3
- "compilerOptions": {
4
- "baseUrl": "."
5
- },
6
- "include": [
7
- "src/**/*"
8
- ],
9
- "exclude": [
10
- "src/**/*.spec.ts",
11
- "dist",
12
- "node_modules",
13
- "**/helpers/*Fixture.ts",
14
- "**/__mock__/**",
15
- "coverage"
16
- ],
17
- "linterOptions": {
18
- "exclude": []
19
- }
20
- }