From 7ae6e892921fd47c630b289a28d8100414f861e2 Mon Sep 17 00:00:00 2001 From: matthewp Date: Thu, 29 Jun 2023 20:21:41 +0000 Subject: [PATCH] [ci] format --- packages/integrations/vercel/README.md | 4 ++-- .../integrations/vercel/src/serverless/adapter.ts | 14 +++++--------- packages/integrations/vercel/test/split.test.js | 6 +++--- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index c32a5f57c..41a5591dc 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -228,8 +228,8 @@ export default defineConfig({ output: 'server', adapter: vercel(), build: { - split: true - } + split: true, + }, }); ``` diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index 52fb9b34b..007fb8537 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -1,6 +1,7 @@ import type { AstroAdapter, AstroConfig, AstroIntegration, RouteData } from 'astro'; import glob from 'fast-glob'; +import { basename } from 'node:path'; import { pathToFileURL } from 'url'; import { defaultImageConfig, @@ -12,7 +13,6 @@ import { exposeEnv } from '../lib/env.js'; import { getVercelOutput, removeDir, writeJson } from '../lib/fs.js'; import { copyDependenciesToFunction } from '../lib/nft.js'; import { getRedirects } from '../lib/redirects.js'; -import { basename } from 'node:path'; const PACKAGE_NAME = '@astrojs/vercel/serverless'; @@ -130,13 +130,13 @@ export default function vercelServerless({ const routeDefinitions: { src: string; dest: string }[] = []; // Multiple entrypoint support - if(_entryPoints.size) { - for(const [route, entryFile] of _entryPoints) { + if (_entryPoints.size) { + for (const [route, entryFile] of _entryPoints) { const func = basename(entryFile.toString()).replace(/\.mjs$/, ''); await createFunctionFolder(func, entryFile, inc); routeDefinitions.push({ src: route.pattern.source, - dest: func + dest: func, }); } } else { @@ -148,11 +148,7 @@ export default function vercelServerless({ // https://vercel.com/docs/build-output-api/v3#build-output-configuration await writeJson(new URL(`./config.json`, _config.outDir), { version: 3, - routes: [ - ...getRedirects(routes, _config), - { handle: 'filesystem' }, - ...routeDefinitions - ], + routes: [...getRedirects(routes, _config), { handle: 'filesystem' }, ...routeDefinitions], ...(imageService || imagesConfig ? { images: imagesConfig ? imagesConfig : defaultImageConfig } : {}), diff --git a/packages/integrations/vercel/test/split.test.js b/packages/integrations/vercel/test/split.test.js index b89a428be..4f3f3904e 100644 --- a/packages/integrations/vercel/test/split.test.js +++ b/packages/integrations/vercel/test/split.test.js @@ -11,13 +11,13 @@ describe('build: split', () => { output: 'server', build: { split: true, - } + }, }); await fixture.build(); }); it('creates separate functions for each page', async () => { - const files = await fixture.readdir('../.vercel/output/functions/') + const files = await fixture.readdir('../.vercel/output/functions/'); expect(files.length).to.equal(2); }); @@ -25,5 +25,5 @@ describe('build: split', () => { const json = await fixture.readFile('../.vercel/output/config.json'); const config = JSON.parse(json); expect(config.routes).to.have.a.lengthOf(3); - }) + }); });