![]() ![]() extractTrigger: methodīy passing this method you can customise how exportFunctions() gets the function trigger from the module. 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 functions. In your main entry point file, simply include these two lines of code: Almost every default behaviour can be customised by the settings object. Trigger and export it as the default export. Module's default export ( export default _or = \*). This function scans a directory for modules (_.js files), then exports them automatically. Automatically create function groups based on directory structure, allowing for -only functions: groupA deploys.įor JS projects that cant use export default syntax, just use equivalent =. ![]() Functions are automatically named after their path from the root functions directory.onCreate ( /* Function */ ) exportFunctions()Īutomatically export all function triggers from your index file, without having to manually import each module.įunction triggers are exported in a special way that increases performance and reduces cold-boot time of your cloud src/auth/on-create.ts import * as functions from 'firebase-functions' export default functions. ![]()
0 Comments
Leave a Reply. |