@tsed/cli 6.6.3 → 7.0.0-alpha.10
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/esm/bin/tsed.js +23 -2
- package/lib/esm/commands/add/AddCmd.js +16 -16
- package/lib/esm/commands/generate/GenerateCmd.js +72 -224
- package/lib/esm/commands/generate/mappers/mapGenerateContext.js +29 -0
- package/lib/esm/commands/index.js +2 -1
- package/lib/esm/commands/init/InitCmd.js +193 -172
- package/lib/esm/commands/init/config/FeaturesPrompt.js +106 -9
- package/lib/esm/commands/init/mappers/mapToContext.js +8 -3
- package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +0 -12
- package/lib/esm/commands/init/utils/hasFeature.js +3 -0
- package/lib/esm/commands/run/RunCmd.js +22 -26
- package/lib/esm/commands/template/CreateTemplateCommand.js +101 -0
- package/lib/esm/commands/update/UpdateCmd.js +9 -13
- package/lib/esm/fn/exec.js +5 -0
- package/lib/esm/fn/render.js +5 -0
- package/lib/esm/fn/taskOutput.js +7 -0
- package/lib/esm/index.js +10 -5
- package/lib/esm/interfaces/AlterPackageJson.js +1 -0
- package/lib/esm/interfaces/AlterProjectFiles.js +1 -0
- package/lib/esm/interfaces/AlterRenderFiles.js +1 -0
- package/lib/esm/interfaces/CliCommandHooks.js +1 -0
- package/lib/esm/interfaces/GenerateCmdContext.js +1 -0
- package/lib/esm/interfaces/InitCmdOptions.js +1 -0
- package/lib/esm/interfaces/RenderDataContext.js +1 -0
- package/lib/esm/interfaces/RuntimeTypes.js +1 -0
- package/lib/esm/interfaces/index.js +9 -0
- package/lib/esm/pipes/OutputFilePathPipe.js +40 -18
- package/lib/esm/pipes/RoutePipe.js +4 -8
- package/lib/esm/pipes/{ClassNamePipe.js → SymbolNamePipe.js} +14 -11
- package/lib/esm/pipes/index.js +1 -1
- package/lib/esm/platforms/{InitPlatformsModule.js → PlatformsModule.js} +4 -10
- package/lib/esm/platforms/supports/InitExpressPlatform.js +27 -10
- package/lib/esm/platforms/supports/InitFastifyPlatform.js +27 -10
- package/lib/esm/platforms/supports/InitKoaPlatform.js +16 -10
- package/lib/esm/processors/__fixtures__/createFakeProject.js +35 -0
- package/lib/esm/processors/transformBinFile.js +47 -0
- package/lib/esm/processors/transformConfigFile.js +105 -0
- package/lib/esm/processors/transformIndexFile.js +23 -0
- package/lib/esm/processors/transformServerFile.js +60 -0
- package/lib/esm/runtimes/RuntimesModule.js +7 -17
- package/lib/esm/runtimes/supports/BabelRuntime.js +5 -11
- package/lib/esm/runtimes/supports/BunRuntime.js +4 -10
- package/lib/esm/runtimes/supports/NodeRuntime.js +1 -1
- package/lib/esm/runtimes/supports/WebpackRuntime.js +1 -1
- package/lib/esm/services/CliProjectService.js +95 -0
- package/lib/esm/services/CliRunScript.js +4 -8
- package/lib/esm/services/CliTemplatesService.js +119 -0
- package/lib/esm/services/ProjectClient.js +162 -0
- package/lib/esm/services/mappers/addContextMethods.js +17 -0
- package/lib/esm/services/mappers/mapDefaultTemplateOptions.js +36 -0
- package/lib/esm/templates/asyncFactory.template.js +38 -0
- package/lib/esm/templates/barrels.template.js +27 -0
- package/lib/esm/templates/command.template.js +56 -0
- package/lib/esm/templates/config.template.js +27 -0
- package/lib/esm/templates/controller.template.js +44 -0
- package/lib/esm/templates/decorator.template.js +184 -0
- package/lib/esm/templates/docker-compose.template.js +25 -0
- package/lib/esm/templates/dockerfile.template.js +236 -0
- package/lib/esm/templates/exception-filter.template.js +19 -0
- package/lib/esm/templates/factory.template.js +37 -0
- package/lib/esm/templates/index.command.template.js +22 -0
- package/lib/esm/templates/index.config.utils.template.js +17 -0
- package/{templates/init/src/controllers/pages/IndexController.ts.hbs → lib/esm/templates/index.controller.template.js} +14 -3
- package/lib/esm/templates/index.js +32 -0
- package/lib/esm/templates/index.logger.template.js +41 -0
- package/{templates/init/src/index.ts.hbs → lib/esm/templates/index.template.js} +17 -5
- package/lib/esm/templates/interceptor.template.js +31 -0
- package/lib/esm/templates/interface.template.js +13 -0
- package/lib/esm/templates/middleware.template.js +36 -0
- package/lib/esm/templates/model.template.js +16 -0
- package/lib/esm/templates/module.template.js +16 -0
- package/lib/esm/templates/new-template.template.js +67 -0
- package/lib/esm/templates/pipe.template.js +19 -0
- package/lib/esm/templates/pm2.template.js +111 -0
- package/lib/esm/templates/prisma.service.template.js +23 -0
- package/{templates/init/README.md.hbs → lib/esm/templates/readme.template.js} +28 -13
- package/lib/esm/templates/repository.template.js +16 -0
- package/lib/esm/templates/response-filter.template.js +19 -0
- package/lib/esm/templates/server.template.js +37 -0
- package/lib/esm/templates/service.template.js +16 -0
- package/lib/esm/templates/tsconfig.spec.template.js +35 -0
- package/lib/esm/templates/value.template.js +13 -0
- package/lib/esm/utils/defineTemplate.js +13 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/bin/tsed.d.ts +1 -1
- package/lib/types/commands/add/AddCmd.d.ts +2 -2
- package/lib/types/commands/generate/GenerateCmd.d.ts +9 -98
- package/lib/types/commands/generate/mappers/mapGenerateContext.d.ts +2 -0
- package/lib/types/commands/index.d.ts +2 -1
- package/lib/types/commands/init/InitCmd.d.ts +18 -20
- package/lib/types/commands/init/config/FeaturesPrompt.d.ts +19 -3
- package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -2
- package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +1 -1
- package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +1 -7
- package/lib/types/commands/init/utils/hasFeature.d.ts +1 -0
- package/lib/types/commands/template/CreateTemplateCommand.d.ts +62 -0
- package/lib/types/commands/update/UpdateCmd.d.ts +2 -2
- package/lib/types/fn/exec.d.ts +1 -0
- package/lib/types/fn/render.d.ts +2 -0
- package/lib/types/fn/taskOutput.d.ts +1 -0
- package/lib/types/index.d.ts +10 -5
- package/lib/types/interfaces/AlterGenerateTasks.d.ts +5 -0
- package/lib/types/interfaces/AlterInitSubTasks.d.ts +5 -0
- package/lib/types/interfaces/AlterPackageJson.d.ts +5 -0
- package/lib/types/interfaces/AlterProjectFiles.d.ts +5 -0
- package/lib/types/interfaces/AlterRenderFiles.d.ts +10 -0
- package/lib/types/interfaces/CliCommandHooks.d.ts +11 -0
- package/lib/types/interfaces/GenerateCmdContext.d.ts +21 -0
- package/lib/types/interfaces/InitCmdOptions.d.ts +8 -0
- package/lib/types/interfaces/PlatformType.d.ts +7 -0
- package/lib/types/interfaces/RenderDataContext.d.ts +62 -0
- package/lib/types/interfaces/RuntimeTypes.d.ts +8 -0
- package/lib/types/interfaces/index.d.ts +9 -0
- package/lib/types/pipes/OutputFilePathPipe.d.ts +7 -4
- package/lib/types/pipes/{ClassNamePipe.d.ts → SymbolNamePipe.d.ts} +4 -4
- package/lib/types/pipes/index.d.ts +1 -1
- package/lib/types/platforms/{InitPlatformsModule.d.ts → PlatformsModule.d.ts} +1 -1
- package/lib/types/platforms/supports/InitBasePlatform.d.ts +3 -0
- package/lib/types/platforms/supports/InitExpressPlatform.d.ts +2 -0
- package/lib/types/platforms/supports/InitFastifyPlatform.d.ts +2 -0
- package/lib/types/platforms/supports/InitKoaPlatform.d.ts +2 -0
- package/lib/types/processors/__fixtures__/createFakeProject.d.ts +5 -0
- package/lib/types/processors/transformBinFile.d.ts +3 -0
- package/lib/types/processors/transformConfigFile.d.ts +3 -0
- package/lib/types/processors/transformIndexFile.d.ts +3 -0
- package/lib/types/processors/transformServerFile.d.ts +3 -0
- package/lib/types/runtimes/RuntimesModule.d.ts +5 -5
- package/lib/types/services/CliProjectService.d.ts +16 -0
- package/lib/types/services/CliTemplatesService.d.ts +35 -0
- package/lib/types/services/ProjectClient.d.ts +40 -0
- package/lib/types/services/mappers/addContextMethods.d.ts +12 -0
- package/lib/types/services/mappers/mapDefaultTemplateOptions.d.ts +11 -0
- package/lib/types/templates/asyncFactory.template.d.ts +16 -0
- package/lib/types/templates/barrels.template.d.ts +16 -0
- package/lib/types/templates/command.template.d.ts +16 -0
- package/lib/types/templates/config.template.d.ts +16 -0
- package/lib/types/templates/controller.template.d.ts +17 -0
- package/lib/types/templates/decorator.template.d.ts +17 -0
- package/lib/types/templates/docker-compose.template.d.ts +16 -0
- package/lib/types/templates/dockerfile.template.d.ts +1 -0
- package/lib/types/templates/exception-filter.template.d.ts +16 -0
- package/lib/types/templates/factory.template.d.ts +16 -0
- package/lib/types/templates/index.command.template.d.ts +16 -0
- package/lib/types/templates/index.config.utils.template.d.ts +16 -0
- package/lib/types/templates/index.controller.template.d.ts +16 -0
- package/lib/types/templates/index.d.ts +31 -0
- package/lib/types/templates/index.logger.template.d.ts +16 -0
- package/lib/types/templates/index.template.d.ts +16 -0
- package/lib/types/templates/interceptor.template.d.ts +16 -0
- package/lib/types/templates/interface.template.d.ts +16 -0
- package/lib/types/templates/middleware.template.d.ts +17 -0
- package/lib/types/templates/model.template.d.ts +16 -0
- package/lib/types/templates/module.template.d.ts +16 -0
- package/lib/types/templates/new-template.template.d.ts +9 -0
- package/lib/types/templates/pipe.template.d.ts +16 -0
- package/lib/types/templates/pm2.template.d.ts +1 -0
- package/lib/types/templates/prisma.service.template.d.ts +16 -0
- package/lib/types/templates/readme.template.d.ts +16 -0
- package/lib/types/templates/repository.template.d.ts +16 -0
- package/lib/types/templates/response-filter.template.d.ts +16 -0
- package/lib/types/templates/server.template.d.ts +16 -0
- package/lib/types/templates/service.template.d.ts +16 -0
- package/lib/types/templates/tsconfig.spec.template.d.ts +16 -0
- package/lib/types/templates/value.template.d.ts +16 -0
- package/lib/types/utils/defineTemplate.d.ts +67 -0
- package/package.json +14 -12
- package/templates/{init/tsconfig.json.hbs → tsconfig.json} +2 -7
- package/templates/tsconfig.node.json +14 -0
- package/templates/webpack.config.js +55 -0
- package/lib/esm/Cli.js +0 -57
- package/lib/esm/commands/generate/ProviderTypes.js +0 -103
- package/lib/esm/commands/init/interfaces/InitOptions.js +0 -5
- package/lib/esm/services/ProvidersInfoService.js +0 -46
- package/lib/esm/services/Renderer.js +0 -162
- package/lib/esm/utils/fillImports.js +0 -38
- package/lib/esm/utils/hbs/array.js +0 -515
- package/lib/esm/utils/hbs/collection.js +0 -60
- package/lib/esm/utils/hbs/comparison.js +0 -431
- package/lib/esm/utils/hbs/index.js +0 -11
- package/lib/esm/utils/hbs/object.js +0 -236
- package/lib/esm/utils/hbs/switch.js +0 -10
- package/lib/esm/utils/renderer/insertAfter.js +0 -12
- package/lib/esm/utils/renderer/insertImport.js +0 -11
- package/lib/types/Cli.d.ts +0 -26
- package/lib/types/commands/generate/ProviderTypes.d.ts +0 -11
- package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +0 -6
- package/lib/types/commands/init/interfaces/InitOptions.d.ts +0 -20
- package/lib/types/services/ProvidersInfoService.d.ts +0 -21
- package/lib/types/services/Renderer.d.ts +0 -44
- package/lib/types/utils/fillImports.d.ts +0 -1
- package/lib/types/utils/hbs/array.d.ts +0 -1
- package/lib/types/utils/hbs/collection.d.ts +0 -1
- package/lib/types/utils/hbs/comparison.d.ts +0 -1
- package/lib/types/utils/hbs/object.d.ts +0 -1
- package/lib/types/utils/hbs/switch.d.ts +0 -1
- package/lib/types/utils/renderer/insertAfter.d.ts +0 -1
- package/lib/types/utils/renderer/insertImport.d.ts +0 -1
- package/templates/generate/async.factory.hbs +0 -35
- package/templates/generate/command.hbs +0 -45
- package/templates/generate/controller.hbs +0 -10
- package/templates/generate/decorator.class.hbs +0 -14
- package/templates/generate/decorator.endpoint.hbs +0 -15
- package/templates/generate/decorator.generic.hbs +0 -19
- package/templates/generate/decorator.method.hbs +0 -16
- package/templates/generate/decorator.middleware.hbs +0 -26
- package/templates/generate/decorator.param.hbs +0 -15
- package/templates/generate/decorator.parameters.hbs +0 -9
- package/templates/generate/decorator.prop.hbs +0 -14
- package/templates/generate/decorator.property.hbs +0 -5
- package/templates/generate/exception-filter.hbs +0 -9
- package/templates/generate/factory.hbs +0 -11
- package/templates/generate/injectable.hbs +0 -6
- package/templates/generate/interceptor.hbs +0 -21
- package/templates/generate/interface.hbs +0 -3
- package/templates/generate/middleware.hbs +0 -9
- package/templates/generate/model.hbs +0 -6
- package/templates/generate/module.hbs +0 -6
- package/templates/generate/pipe.hbs +0 -9
- package/templates/generate/prisma.service.hbs +0 -13
- package/templates/generate/repository.hbs +0 -6
- package/templates/generate/response-filter.hbs +0 -9
- package/templates/generate/server/_partials/server-footer.hbs +0 -10
- package/templates/generate/server/_partials/server-header.hbs +0 -34
- package/templates/generate/server/express/server.hbs +0 -10
- package/templates/generate/server/fastify/server.hbs +0 -14
- package/templates/generate/server/koa/server.hbs +0 -8
- package/templates/generate/service.hbs +0 -6
- package/templates/generate/value.hbs +0 -3
- package/templates/init/.barrels.json.hbs +0 -9
- package/templates/init/.gitignore.hbs +0 -57
- package/templates/init/.npmrc.hbs +0 -2
- package/templates/init/docker/_partials/docker-body.hbs +0 -5
- package/templates/init/docker/_partials/docker-dev-tools.hbs +0 -2
- package/templates/init/docker/_partials/docker-header.hbs +0 -16
- package/templates/init/docker/bun/Dockerfile.hbs +0 -36
- package/templates/init/docker/npm/Dockerfile.hbs +0 -28
- package/templates/init/docker/pnpm/Dockerfile.hbs +0 -28
- package/templates/init/docker/yarn/Dockerfile.hbs +0 -28
- package/templates/init/docker/yarn_berry/Dockerfile.hbs +0 -31
- package/templates/init/docker-compose.yml.hbs +0 -14
- package/templates/init/pm2/bun/processes.config.cjs.hbs +0 -23
- package/templates/init/pm2/node-compiled/processes.config.cjs.hbs +0 -22
- package/templates/init/pm2/node-loader/processes.config.cjs.hbs +0 -24
- package/templates/init/src/bin/index.ts.hbs +0 -9
- package/templates/init/src/config/envs/index.ts.hbs +0 -7
- package/templates/init/src/config/index.ts.hbs +0 -38
- package/templates/init/src/config/logger/index.ts.hbs +0 -25
- package/templates/init/tsconfig.node.json.hbs +0 -20
- package/templates/init/tsconfig.spec.json.hbs +0 -25
- package/templates/init/webpack.config.js.hbs +0 -65
- /package/lib/esm/{commands/init/interfaces/InitCmdContext.js → interfaces/AlterGenerateTasks.js} +0 -0
- /package/lib/{types/utils/hbs/index.d.ts → esm/interfaces/AlterInitSubTasks.js} +0 -0
- /package/templates/{init/.babelrc.hbs → .babelrc} +0 -0
- /package/templates/{init/.dockerignore.hbs → .dockerignore} +0 -0
- /package/templates/{init/.swcrc.hbs → .swcrc} +0 -0
- /package/templates/{init/.yarnrc.hbs → .yarnrc} +0 -0
- /package/templates/{init/nodemon.json.hbs → nodemon.json} +0 -0
- /package/templates/{init/tsconfig.base.json.hbs → tsconfig.base.json} +0 -0
- /package/templates/{init/views/swagger.ejs.hbs → views/swagger.ejs} +0 -0
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {constant, injectable} from "@tsed/di";
|
|
2
|
-
|
|
3
|
-
export type {{symbolName}} = any; // implement type or interface for type checking
|
|
4
|
-
export const {{symbolName}} = injectable(Symbol.for("{{symbolName}}")
|
|
5
|
-
.factory(() => {
|
|
6
|
-
// retrieve custom configuration from settings (e.g.: `@Configuration({hello: "value"})`)
|
|
7
|
-
const hello = constant("hello");
|
|
8
|
-
|
|
9
|
-
return {hello};
|
|
10
|
-
})
|
|
11
|
-
.token();
|
|
@@ -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,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,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,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,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,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,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,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
|
-
};
|