diff --git a/postman-snap-in/README.md b/postman-snap-in/README.md new file mode 100644 index 0000000..5e10102 --- /dev/null +++ b/postman-snap-in/README.md @@ -0,0 +1,153 @@ +## DevRev Snaps TypeScript Template + +This repository contains a template for the functions that can be deployed as +part of Snap-Ins. + +For reference on snap-ins, refer to the [documentation](https://github.com/devrev/snap-in-docs). + +### Getting started with the template + +1. Create a new repository using this template. +2. In the new repository, you can add functions at the path `src/functions` where the folder name corresponds to the function name in your manifest file. +3. Ensure to include each new function in the file named "src/function-factory.ts". + +### Testing locally + +To test your code locally, add test events under 'src/fixtures' following the example event provided. Additionally, you can include keyring values in the event payload to test API calls.``` + +After adding the event, execute the following commands to test your code: + +``` +npm install +npm run start -- --functionName=on_work_creation --fixturePath=on_work_created_event.json +``` + +### Adding external dependencies + +You can also add dependencies on external packages to package.json under the “dependencies” key. These dependencies will be made available to your function at runtime and during testing. + +### Linting + +To check for lint errors, run the following command: + +```bash +npm run lint +``` + +To automatically fix fixable lint errors, run: + +```bash +npm run lint:fix +``` + +### Deploying Snap-ins + +Once you are done with the testing, run the following commands to deploy your snap-in: + +1. Authenticate to devrev CLI, run the following command: + +``` +devrev profiles authenticate --org --usr +``` + +2. To create a snap_in_version, run the following command: + +``` +devrev snap_in_version create-one --path