Skip to content

Commit

Permalink
Fix 6206: Cloudflare function path resolving one step above (#6208)
Browse files Browse the repository at this point in the history
* Fix 6206: Cloudflare function path resolving one step above
  • Loading branch information
mfrachet authored Feb 13, 2023
1 parent fa5d293 commit b1e7fa5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/integrations/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ export default function createIntegration(args?: Options): AstroIntegration {
}

if (isModeDirectory) {
const functionsUrl = new URL('functions', _config.root);
const functionsUrl = new URL('functions/', _config.root);
await fs.promises.mkdir(functionsUrl, { recursive: true });

const directoryUrl = new URL('[[path]].js', functionsUrl);
await fs.promises.rename(finalBuildUrl, directoryUrl);
}
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/cloudflare/test/directory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ describe('mode: "directory"', () => {

it('generates functions folder inside the project root', async () => {
expect(await fixture.pathExists('../functions')).to.be.true;
expect(await fixture.pathExists('../functions/[[path]].js')).to.be.true;
});
});

0 comments on commit b1e7fa5

Please sign in to comment.