[ci] format

This commit is contained in:
ematipico 2023-09-06 04:46:18 +00:00 committed by astrobot-houston
parent 9ffa1a84e8
commit eb8c4cc2fc
2 changed files with 18 additions and 16 deletions

View file

@ -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',

View file

@ -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;
});
});