This repository contains a template for the functions that can be deployed as part of Snap-Ins.
- Create a new repository from this template.
- In the new repository, you can add functions at path
src/functions
where the folder name corresponds to the function name in your manifest file. - Each function you add will also need to be mentioned in
src/function-factory.ts
.
You can test your code by adding test events under src/fixtures
similar to the example event provided. You can add keyring values to the event payload to test API calls as well.
Once you have added the event, you can test your code by running:
npm install
npm run start:watch -- --functionName=function_1 --fixturePath=function_1_event.json
You can also add dependencies on external packages in package.json under the "dependencies" key. These dependencies will be made available to your function at runtime and testing.
Once you are done with the testing, Run
npm run build
npm run package
and ensure it succeeds.
You will see a build.tar.gz
file is created and you can provide it while creating the snap_in_version.