This is a glob pattern that allows you to define which files to search for. Provide a custom subdirectory to search for function triggers. The input filenames shouldīe in kebab-case. Submodules (module groups) are separated by a dash - and the names should be in camelCase. Is a string that is the relative path to the module, and the expected output is a string with the name of your function. You may provide a custom function for generating function names based on the file path the module was found. You may specify a custom log function, and enable/disable performance logging. Settings Object logger : object, enableLogger: boolean When matching if you are using Typescript as this code is executed at runtime once the files are compiled. ![]() Pattern to only pick up files that end in _.cf.js or _.function.js Be sure to still use js as your file extension Nested on the exports object to mirror the folder structure, allowing for deployment groups. The filename and path is used to determine the function name. All matching files will then beĬhecked for a default export. How it WorksĮxportFunctions() will search the given directory using provided glob matching pattern and export firebase cloudįunctions for you automatically, without you having to require each file individually. Meaning the functions found in the http directory can be exported using firebase deploy -only functions: http. The dash http- denotes that the function is in a submodule group called http, The above function will automatically be exported as http-newUser, because it is in a directory called http and is http/ import * as functions from 'firebase-functions' export default (app). The function will export all found triggers from your index file.Īnd then in your modules, define your function triggers: ///. Ensure your main entry point file contains only:.Simply install from NPM: npm install better-firebase-functions Package to keep the bundle size as small as possible for performance reasons. Suitable for production use in almost any project. This package is bundled into one module with 0 dependencies, and is designed to be as lightweight, configurable and It also allows for a more scalable file structure for your source ![]() Your cloud functions, especially in large projects. This method will almost always improve the performance, memory usage and cold-boot time of The main feature of this package is a function that provides a better way of automatically exporting function triggers This repository is a maintained version of:
0 Comments
Leave a Reply. |