Skip to content

Commit

Permalink
fix: use correct paths in EF on deploy (#4760)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas authored Jul 1, 2022
1 parent f8cc372 commit 80df246
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/lib/edge-functions/deploy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @ts-check
const { stat } = require('fs').promises
const path = require('path')

const { getPathInProject } = require('../settings')

Expand All @@ -10,7 +9,7 @@ const distPath = getPathInProject([EDGE_FUNCTIONS_FOLDER])

const deployFileNormalizer = (file) => {
const isEdgeFunction = file.root === distPath
const normalizedPath = isEdgeFunction ? path.join(PUBLIC_URL_PATH, file.normalizedPath) : file.normalizedPath
const normalizedPath = isEdgeFunction ? `${PUBLIC_URL_PATH}/${file.normalizedPath}` : file.normalizedPath

return {
...file,
Expand All @@ -32,7 +31,7 @@ const getDistPathIfExists = async () => {
}
}

const isEdgeFunctionFile = (filePath) => filePath.startsWith(`${PUBLIC_URL_PATH}${path.sep}`)
const isEdgeFunctionFile = (filePath) => filePath.startsWith(`${PUBLIC_URL_PATH}/`)

module.exports = {
deployFileNormalizer,
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/210.command.deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ if (process.env.NETLIFY_TEST_DISABLE_LIVE !== 'true') {
})
})

// TODO: Re-add when feature flag is no longer needed.
test.serial.skip('should deploy Edge Functions when directory exists', async (t) => {
test.serial('should deploy Edge Functions when directory exists', async (t) => {
await withSiteBuilder('site-with-public-folder', async (builder) => {
const content = '<h1>loud</h1>'
builder
Expand Down

1 comment on commit 80df246

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

Package size: 221 MB

Please sign in to comment.