From 4d58e1a3f6aa60ebb897130291fd54c1a497521b Mon Sep 17 00:00:00 2001 From: guiyom-e Date: Fri, 28 Oct 2022 18:22:15 +0200 Subject: [PATCH] fix: eslint errors --- packages/deployment/src/cdkConstruct/apiLambda/index.ts | 5 +++-- packages/deployment/src/helpers/nextImport.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/deployment/src/cdkConstruct/apiLambda/index.ts b/packages/deployment/src/cdkConstruct/apiLambda/index.ts index 254a0b3..a96157d 100644 --- a/packages/deployment/src/cdkConstruct/apiLambda/index.ts +++ b/packages/deployment/src/cdkConstruct/apiLambda/index.ts @@ -1,7 +1,9 @@ import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs'; import { RetentionDays } from 'aws-cdk-lib/aws-logs'; -import { DEPENDENCY_FOLDER, RUNTIME_SETTINGS_FILE } from 'constants/paths/handlerPaths'; import { Construct } from 'constructs'; +import { join } from 'path'; + +import { DEPENDENCY_FOLDER, RUNTIME_SETTINGS_FILE } from 'constants/paths/handlerPaths'; import { createRuntimeSettingsFile } from 'helpers/createRuntimeSettingsFile'; import { getAPIHandlersFolder, @@ -11,7 +13,6 @@ import { requirePageManifest, requireRoutesManifest, } from 'helpers/nextImport'; -import { join } from 'path'; import { createAPIRuntimeSettings } from 'runtimeSettings/api'; const API_HANDLER_NAME = 'NextJSApi'; diff --git a/packages/deployment/src/helpers/nextImport.ts b/packages/deployment/src/helpers/nextImport.ts index 026a322..43828ff 100644 --- a/packages/deployment/src/helpers/nextImport.ts +++ b/packages/deployment/src/helpers/nextImport.ts @@ -39,11 +39,12 @@ export const requireHandlerFromPath = (nextRoot: string): PagesManifest => * { * "/api/hello": "pages/api/hello.js", * "/api/bye": "pages/api/bye.js" + * "/api/[...slug]": "pages/api/[...slug].js", + * "/api/[id]": "pages/api/[id].js", * } * ``` */ -export const getNextAPIHandlers = (nextRoot: string): PagesManifest => { - const pageManifest = requirePageManifest(nextRoot); +export const getNextAPIHandlers = (pageManifest: PagesManifest): PagesManifest => { const APIPaths = Object.keys(pageManifest).filter(path => path.startsWith(API_PATH_PREFIX)); return Object.fromEntries(APIPaths.map(path => [path, pageManifest[path] as string]));