Fix 6206: Cloudflare function path resolving one step above (#6208)
* Fix 6206: Cloudflare function path resolving one step above
This commit is contained in:
parent
8b7cb64dad
commit
79f49acbe1
3 changed files with 8 additions and 1 deletions
5
.changeset/lazy-coins-compete.md
Normal file
5
.changeset/lazy-coins-compete.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/cloudflare': patch
|
||||
---
|
||||
|
||||
Fix path file that was generated outside the functions folder
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue