From eb8c4cc2fc578095e73f80c712615f323c7cbc61 Mon Sep 17 00:00:00 2001 From: ematipico Date: Wed, 6 Sep 2023 04:46:18 +0000 Subject: [PATCH] [ci] format --- .../vercel/src/serverless/adapter.ts | 27 +++++++++---------- .../serverless-with-dynamic-routes.test.js | 7 +++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index 32735da03..a1d8b18bf 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -207,25 +207,24 @@ You can set functionPerRoute: false to prevent surpassing the limit.` // Multiple entrypoint support if (_entryPoints.size) { - const getRouteFuncName = (route: RouteData) => - route.component.replace('src/pages/', '') + const getRouteFuncName = (route: RouteData) => route.component.replace('src/pages/', ''); - const getFallbackFuncName = (entryFile: URL) => - basename(entryFile.toString()) - .replace('entry.', '') - .replace(/\.mjs$/, ''); + const getFallbackFuncName = (entryFile: URL) => + basename(entryFile.toString()) + .replace('entry.', '') + .replace(/\.mjs$/, ''); - for (const [route, entryFile] of _entryPoints) { - const func = route.component.startsWith('src/pages/') + for (const [route, entryFile] of _entryPoints) { + const func = route.component.startsWith('src/pages/') ? getRouteFuncName(route) - : getFallbackFuncName(entryFile) - + : getFallbackFuncName(entryFile); + await createFunctionFolder(func, entryFile, filesToInclude, logger); routeDefinitions.push({ - src: route.pattern.source, - dest: func, - }); - } + src: route.pattern.source, + dest: func, + }); + } } else { await createFunctionFolder( 'render', diff --git a/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js b/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js index 325f9c5b0..fae3aef95 100644 --- a/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js +++ b/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js @@ -16,7 +16,10 @@ describe('Serverless with dynamic routes', () => { it('build successful', async () => { expect(await fixture.readFile('../.vercel/output/static/index.html')).to.be.ok; - expect(await fixture.readFile('../.vercel/output/functions/[id]/index.astro.func/.vc-config.json')).to.be.ok; - expect(await fixture.readFile('../.vercel/output/functions/api/[id].js.func/.vc-config.json')).to.be.ok; + expect( + await fixture.readFile('../.vercel/output/functions/[id]/index.astro.func/.vc-config.json') + ).to.be.ok; + expect(await fixture.readFile('../.vercel/output/functions/api/[id].js.func/.vc-config.json')) + .to.be.ok; }); });