Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored and astrobot-houston committed Sep 6, 2023
1 parent 9ffa1a8 commit eb8c4cc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
27 changes: 13 additions & 14 deletions packages/integrations/vercel/src/serverless/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
});

0 comments on commit eb8c4cc

Please sign in to comment.