@netlify/functions-utils
Utility for adding Functions files in Netlify Build
Last updated 3 months ago by netlify-bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @netlify/functions-utils 
SYNC missed versions from official npm registry.

Coverage Status Build

Utility for handling Netlify Functions in Netlify Build plugins.

This allows plugins to:

  • list available Netlify Functions
  • dynamically inject Netlify Functions inside users builds.

Example

module.exports = {
  // Add a Netlify Functions file or directory to a build
  async onPreBuild({ utils }) {
    await utils.functions.add('./path/to/function')
  },
}

API

list()

Returns: Promise<object[]>

Returns the list of Netlify Functions main files as a Promise resolving to an array of objects with the following properties:

  • name {string}: Function name, as used in the URL https://{hostname}/.netlify/functions/{name}
  • mainFile {string}: absolute path to the Function's main file
  • extension {string}: file extension of the Function's main file. For Go Functions, this might be an empty string. For Node.js Functions, this is either .js or .zip.
  • runtime "js" | "go": Function's programming language

This throws when no functions directory was specified by the user, or when it points to a non-existing directory.

listAll()

Returns: Promise<object[]>

Same as list() except it also returns the files required by the Functions main files. This is much slower. The object have the following additional member:

  • srcFile {string}: absolute path to the file

add(path)

path: string
Returns: Promise

Add a Functions file or directory to a build.

This throws when no functions directory was specified by the user, or when it points to a non-existing directory.

Current Tags

  • 2.0.2                                ...           latest (3 months ago)
  • 2.0.0-rc                                ...           rc (3 months ago)

82 Versions

  • 2.0.2                                ...           3 months ago
  • 2.0.1                                ...           3 months ago
  • 2.0.0                                ...           3 months ago
  • 1.4.7                                ...           3 months ago
  • 2.0.0-rc                                ...           3 months ago
  • 1.4.6                                ...           3 months ago
  • 1.4.5                                ...           3 months ago
  • 1.4.4                                ...           3 months ago
  • 1.4.3                                ...           3 months ago
  • 1.4.2                                ...           3 months ago
  • 1.4.1                                ...           4 months ago
  • 1.4.0                                ...           4 months ago
  • 1.3.47                                ...           4 months ago
  • 1.3.46                                ...           4 months ago
  • 1.3.45                                ...           4 months ago
  • 1.3.44                                ...           4 months ago
  • 1.3.43                                ...           4 months ago
  • 1.3.42                                ...           4 months ago
  • 1.3.41                                ...           4 months ago
  • 1.3.40                                ...           4 months ago
  • 1.3.39                                ...           4 months ago
  • 1.3.38                                ...           4 months ago
  • 1.3.37                                ...           5 months ago
  • 1.3.36                                ...           5 months ago
  • 1.3.35                                ...           5 months ago
  • 1.3.34                                ...           5 months ago
  • 1.3.33                                ...           5 months ago
  • 1.3.32                                ...           5 months ago
  • 1.3.31                                ...           5 months ago
  • 1.3.29                                ...           5 months ago
  • 1.3.28                                ...           6 months ago
  • 1.3.27                                ...           6 months ago
  • 1.3.26                                ...           6 months ago
  • 1.3.25                                ...           6 months ago
  • 1.3.24                                ...           6 months ago
  • 1.3.23                                ...           6 months ago
  • 1.3.22                                ...           6 months ago
  • 1.3.21                                ...           7 months ago
  • 1.3.20                                ...           7 months ago
  • 1.3.19                                ...           7 months ago
  • 1.3.18                                ...           7 months ago
  • 1.3.17                                ...           7 months ago
  • 1.3.16                                ...           7 months ago
  • 1.3.15                                ...           7 months ago
  • 1.3.14                                ...           8 months ago
  • 1.3.13                                ...           8 months ago
  • 1.3.12                                ...           8 months ago
  • 1.3.11                                ...           8 months ago
  • 1.3.10                                ...           8 months ago
  • 1.3.9                                ...           9 months ago
  • 1.3.8                                ...           9 months ago
  • 1.3.7                                ...           9 months ago
  • 1.3.6                                ...           9 months ago
  • 1.3.5                                ...           9 months ago
  • 1.3.4                                ...           9 months ago
  • 1.3.3                                ...           10 months ago
  • 1.3.2                                ...           a year ago
  • 1.3.1                                ...           a year ago
  • 1.3.0                                ...           a year ago
  • 1.2.11                                ...           a year ago
  • 1.2.10                                ...           a year ago
  • 1.2.9                                ...           a year ago
  • 1.2.8                                ...           a year ago
  • 1.2.7                                ...           a year ago
  • 1.2.6                                ...           a year ago
  • 1.2.5                                ...           a year ago
  • 1.2.4                                ...           a year ago
  • 1.2.3                                ...           a year ago
  • 1.2.2                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.4                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Downloads
Today 0
This Week 199
This Month 241
Last Day 2
Last Week 36
Last Month 198
Dependencies (3)
Dev Dependencies (5)

Copyright 2014 - 2021 © npmmirror.com |