Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ecklf/firebase-functions-boilerplate
Template for having split up cloud functions with jest testing
https://github.com/ecklf/firebase-functions-boilerplate
cloud firebase functions jest typescript
Last synced: 14 days ago
JSON representation
Template for having split up cloud functions with jest testing
- Host: GitHub
- URL: https://github.com/ecklf/firebase-functions-boilerplate
- Owner: ecklf
- License: mit
- Created: 2019-03-07T14:24:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:21:48.000Z (almost 2 years ago)
- Last Synced: 2024-10-24T03:39:26.076Z (23 days ago)
- Topics: cloud, firebase, functions, jest, typescript
- Language: TypeScript
- Size: 1.88 MB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Firebase Cloud Functions Boilerplate
Template for having split up cloud functions (_triggers_/_endpoints_) with included `jest` testing.
## Usage
Requires **firebase-tools**:
```sh
$ npm i -g firebase-tools
```Install all dependencies (node version should match package.json engines):
```sh
$ cd functions
$ nvm use # will read .nvmrc (default: v8)
$ yarn
```Add your firebase project
```sh
$ firebase use --add
```Add your `service-account.json` to the `functions` folder:
```diff
{
+ "type": "service_account",
+ "project_id": "",
+ "private_key_id": "",
+ "private_key": "",
+ "client_email": "",
+ "client_id": "",
+ "auth_uri": "",
+ "token_uri": "",
+ "auth_provider_x509_cert_url": "",
+ "client_x509_cert_url": "",
}
```Fill in your API details in `config/*.json`
Development: `firebase serve` with hot-reloading
```sh
$ yarn dev
```Testing: jest
```sh
$ yarn test
```## Config
### Node.js v10
Currently in beta. If you want to try it out you will need to enable it in your `package.json`
```diff
"engines": {
- "node": "8"
+ "node": "10"
},
```Also modify your `.nvmrc` if you use nvm / fnm / fish-nvm
```diff
- v8
+ v10
```## Useful links
- [Develop Apps Script using TypeScript](https://developers.google.com/apps-script/guides/typescript)
- [Firebase CLI Reference](https://firebase.google.com/docs/cli/)
- [Unit testing of Cloud Functions](https://firebase.google.com/docs/functions/unit-testing)
- [How to Test Firebase Cloud Functions With Jest](https://angularfirebase.com/lessons/testing-cloud-functions-in-firebase/)## License
MIT