Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions src/lib/functions/netlify-function.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class NetlifyFunction {
constructor({
config,
directory,
displayName,
mainFile,
name,
projectRoot,
Expand All @@ -31,6 +32,7 @@ export default class NetlifyFunction {
this.errorExit = errorExit
this.mainFile = mainFile
this.name = name
this.displayName = displayName
this.projectRoot = projectRoot
this.runtime = runtime
this.timeoutBackground = timeoutBackground
Expand Down
13 changes: 10 additions & 3 deletions src/lib/functions/registry.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
warn,
watchDebounced,
} from '../../utils/command-helpers.mjs'
import { SERVE_FUNCTIONS_FOLDER } from '../../utils/functions/functions.mjs'
import { INTERNAL_FUNCTIONS_FOLDER, SERVE_FUNCTIONS_FOLDER } from '../../utils/functions/functions.mjs'
import { getLogMessage } from '../log.mjs'
import { getPathInProject } from '../settings.mjs'

Expand Down Expand Up @@ -164,7 +164,12 @@ export class FunctionsRegistry {
this.functions.set(name, func)
this.buildFunctionAndWatchFiles(func)

log(`${NETLIFYDEVLOG} ${chalk.green('Loaded')} function ${getTerminalLink(chalk.yellow(name), func.url)}.`)
log(
`${NETLIFYDEVLOG} ${chalk.green('Loaded')} function ${getTerminalLink(
chalk.yellow(func.displayName || name),
func.url,
)}.`,
)
}

// This function is here so we can mock it in tests
Expand All @@ -191,6 +196,7 @@ export class FunctionsRegistry {
buildRustSource: env.NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE === 'true',
project_deploy_configuration_api_use_per_function_configuration_files: true,
},
configFileDirectories: [join('.netlify', INTERNAL_FUNCTIONS_FOLDER)],
config: this.config.functions,
})

Expand All @@ -207,7 +213,7 @@ export class FunctionsRegistry {
await Promise.all(deletedFunctions.map((func) => this.unregisterFunction(func.name)))

await Promise.all(
functions.map(async ({ mainFile, name, runtime: runtimeName }) => {
functions.map(async ({ displayName, mainFile, name, runtime: runtimeName }) => {
const runtime = runtimes[runtimeName]

// If there is no matching runtime, it means this function is not yet
Expand All @@ -226,6 +232,7 @@ export class FunctionsRegistry {
directory: directories.find((directory) => mainFile.startsWith(directory)),
mainFile,
name,
displayName,
projectRoot: this.projectRoot,
runtime,
timeoutBackground: this.timeouts.backgroundFunctions,
Expand Down