Socket
Book a DemoInstallSign in
Socket

@netlify/functions-utils

Package Overview
Dependencies
Maintainers
12
Versions
285
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/functions-utils

Utility for adding Functions files in Netlify Build

Source
npmnpm
Version
0.3.0
Version published
Weekly downloads
186K
-4.63%
Maintainers
12
Weekly downloads
 
Created
Source


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 onPostBuild({ utils }) {
    await utils.functions.add('./path/to/function')
  },
}

API

list()

Returns: Promise<object[]>

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

  • 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.

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.

FAQs

Package last updated on 11 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts