From e10185ba8de100b5f4d29a9274eacd69b1e79ad2 Mon Sep 17 00:00:00 2001 From: Clooooode <12930377+jackey8616@users.noreply.github.com> Date: Sat, 5 Oct 2024 09:53:09 +0800 Subject: [PATCH] chore(warn): deprecation of config multer options (#1695) --- packages/cli/src/module/generate-routes.ts | 13 +++++++++++-- packages/runtime/src/config.ts | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/module/generate-routes.ts b/packages/cli/src/module/generate-routes.ts index b1a14c7cd..594b620a4 100644 --- a/packages/cli/src/module/generate-routes.ts +++ b/packages/cli/src/module/generate-routes.ts @@ -5,7 +5,7 @@ import { Tsoa } from '@tsoa/runtime'; import { DefaultRouteGenerator } from '../routeGeneration/defaultRouteGenerator'; import { fsMkDir } from '../utils/fs'; import path = require('path'); -import { Config as BaseConfig } from "@tsoa/runtime"; +import { Config as BaseConfig } from '@tsoa/runtime'; export async function generateRoutes( routesConfig: Config, @@ -15,7 +15,7 @@ export async function generateRoutes( * pass in cached metadata returned in a previous step to speed things up */ metadata?: Tsoa.Metadata, - defaultNumberType?: BaseConfig['defaultNumberType'] + defaultNumberType?: BaseConfig['defaultNumberType'], ) { if (!metadata) { metadata = new MetadataGenerator(routesConfig.entryFile, compilerOptions, ignorePaths, routesConfig.controllerPathGlobs, routesConfig.rootSecurity, defaultNumberType).Generate(); @@ -26,6 +26,15 @@ export async function generateRoutes( await fsMkDir(routesConfig.routesDir, { recursive: true }); await routeGenerator.GenerateCustomRoutes(); + if (routesConfig.multerOpts) { + console.warn( + 'Config MulterOptions is deprecated since v6.4.0 instroduces RegisterRoutes can pass multerOptions,' + + 'we will quickly remove this options soon at future version.' + + '(https://github.com/lukeautry/tsoa/issues/1587#issuecomment-2391291433)' + + '(https://github.com/lukeautry/tsoa/pull/1638)', + ); + } + return metadata; } diff --git a/packages/runtime/src/config.ts b/packages/runtime/src/config.ts index eeac0f12c..f670a3816 100644 --- a/packages/runtime/src/config.ts +++ b/packages/runtime/src/config.ts @@ -47,6 +47,11 @@ export interface Config { * @example { * "dest": "/tmp" * } Allow multer to write to file instead of using Memory's buffer + * @deprecated + * since v6.4.0 instroduces RegisterRoutes can pass multerOptions, + * we will quickly remove this options soon at future version. + * (https://github.com/lukeautry/tsoa/issues/1587#issuecomment-2391291433) + * (https://github.com/lukeautry/tsoa/pull/1638) */ multerOpts?: MulterOpts;