Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: centralize edge functions feature flags #5316

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/commands/deploy/deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import prettyjson from 'prettyjson'

import { cancelDeploy } from '../../lib/api.mjs'
import { getBuildOptions, runBuild } from '../../lib/build.mjs'
import { featureFlags as edgeFunctionsFeatureFlags } from '../../lib/edge-functions/consts.mjs'
import { normalizeFunctionsConfig } from '../../lib/functions/config.mjs'
import { getLogMessage } from '../../lib/log.mjs'
import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
Expand Down Expand Up @@ -409,9 +410,7 @@ const bundleEdgeFunctions = async (options) => {
const { severityCode, success } = await runCoreSteps(['edge_functions_bundling'], {
...options,
buffer: true,
featureFlags: {
edge_functions_read_deno_config: true,
},
featureFlags: edgeFunctionsFeatureFlags,
})

if (!success) {
Expand Down
5 changes: 3 additions & 2 deletions src/lib/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import process from 'process'

import build from '@netlify/build'

import { featureFlags as edgeFunctionsFeatureFlags } from './edge-functions/consts.mjs'

/**
* The buildConfig + a missing cachedConfig
* @typedef BuildConfig
Expand Down Expand Up @@ -38,9 +40,8 @@ export const getBuildOptions = ({
offline,
cwd,
featureFlags: {
edge_functions_config_export: true,
...edgeFunctionsFeatureFlags,
functionsBundlingManifest: true,
edge_functions_produce_eszip: true,
project_deploy_configuration_api_use_per_function_configuration_files: true,
},
})
Expand Down
7 changes: 7 additions & 0 deletions src/lib/edge-functions/consts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ export const DIST_IMPORT_MAP_PATH = 'edge-functions-import-map.json'
export const INTERNAL_EDGE_FUNCTIONS_FOLDER = 'edge-functions'
export const EDGE_FUNCTIONS_FOLDER = 'edge-functions-dist'
export const PUBLIC_URL_PATH = '.netlify/internal/edge-functions'

// Feature flags related to Edge Functions that should be passed along to
// Netlify Build.
export const featureFlags = {
edge_functions_config_export: true,
edge_functions_read_deno_config: true,
}