All Projects β†’ robisim74 β†’ firebase-functions-typescript-starter

robisim74 / firebase-functions-typescript-starter

Licence: MIT license
Create & test Firebase Cloud Functions in TypeScript

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to firebase-functions-typescript-starter

aria-vue
Testing tools for Vue components
Stars: ✭ 21 (-79.21%)
Mutual labels:  mocha, rollup
Jshistory Cn
πŸ‡¨πŸ‡³ γ€ŠJavaScript δΊŒεεΉ΄γ€‹δΈ­ζ–‡η‰ˆ
Stars: ✭ 3,686 (+3549.5%)
Mutual labels:  mocha
React Redux Universal Boilerplate
An Universal ReactJS/Redux Boilerplate
Stars: ✭ 165 (+63.37%)
Mutual labels:  mocha
Yarsk
Don't use this, use Create React App
Stars: ✭ 199 (+97.03%)
Mutual labels:  mocha
Snap Shot
Jest-like snapshot feature for the rest of us, works magically by finding the right caller function
Stars: ✭ 170 (+68.32%)
Mutual labels:  mocha
Testdeck
Object oriented testing
Stars: ✭ 206 (+103.96%)
Mutual labels:  mocha
Earl
β˜• Ergonomic, modern and type-safe assertion library for TypeScript
Stars: ✭ 153 (+51.49%)
Mutual labels:  mocha
Express Mongoose Es6 Rest Api
πŸ’₯ A boilerplate application for building RESTful APIs Microservice in Node.js using express and mongoose in ES6 with code coverage and JsonWebToken Authentication
Stars: ✭ 2,811 (+2683.17%)
Mutual labels:  mocha
Babel Plugin Tester
Utilities for testing babel plugins
Stars: ✭ 228 (+125.74%)
Mutual labels:  mocha
Mocha Parallel Tests
Parallel test runner for mocha tests. Looking for maintainer.
Stars: ✭ 197 (+95.05%)
Mutual labels:  mocha
Feathers Vue
A boiler plate template using Feathers with Email Verification, Vue 2 with Server Side Rendering, stylus, scss, jade, babel, webpack, ES 6-8, login form, user authorization, and SEO
Stars: ✭ 195 (+93.07%)
Mutual labels:  mocha
Angular Js Es6 Testing Example
Enhanced testing of Angular JS 1.X applications using ES6 modules
Stars: ✭ 170 (+68.32%)
Mutual labels:  mocha
Co Mocha
Enable support for generators in Mocha tests
Stars: ✭ 216 (+113.86%)
Mutual labels:  mocha
Mochapack
Mocha test runner with integrated webpack precompiler
Stars: ✭ 166 (+64.36%)
Mutual labels:  mocha
Nspec
A battle hardened testing framework for C# that's heavily inspired by Mocha and RSpec.
Stars: ✭ 242 (+139.6%)
Mutual labels:  mocha
Karma
Spectacular Test Runner for JavaScript
Stars: ✭ 11,591 (+11376.24%)
Mutual labels:  mocha
Mocha.parallel
Run async mocha specs in parallel
Stars: ✭ 194 (+92.08%)
Mutual labels:  mocha
Root Cause
πŸ” Root Cause is a tool for troubleshooting Puppeteer and Playwright tests. πŸ”Ž
Stars: ✭ 205 (+102.97%)
Mutual labels:  mocha
Nodebestpractices
βœ… The Node.js best practices list (December 2021)
Stars: ✭ 72,734 (+71913.86%)
Mutual labels:  mocha
Eslint Plugin Mocha
ESLint rules for mocha
Stars: ✭ 249 (+146.53%)
Mutual labels:  mocha

Firebase Functions TypeScript starter

Create & test Firebase Cloud Functions in TypeScript

This starter allows you to create & test Firebase Cloud Functions in TypeScript.

Get the Changelog.

Contents

1 Project structure

  • functions:
    • src folder for the Functions
      • index.ts entry point for all your Firebase Functions
    • tests folder for the Mocha tests
    • package.json npm options
    • rollup.config.js Rollup configuration for building the ES bundle
    • tsconfig.json TypeScript compiler options
    • .mocharc.json Mocha options
    • .eslintrc.json ESLint configuration
  • .firebaserc: Firebase projects

2 Customizing

  1. Update Firebase CLI.

  2. Update .firebaserc with your project-id.

  3. Add your Firebase Functions to index.ts and create different files for each one.

  4. Update in rollup.config.js file external dependencies with those that actually you use to build the ES bundle.

  5. Create unit tests in tests folder.

3 Testing

The following command runs unit tests using Mocha that are in the tests folder:

npm test 

4 Building

Development

Start tsc compiler with watch option:

npm run build:dev

Start the emulator firebase emulators:start --only functions

npm run serve:dev

For the other supported emulators, please refer to the official documentation: Run Functions Locally

Production

The following command:

npm run build

creates lib folder with the file of distribution:

└── functions
    └──lib
        └── index.js

5 Publishing

npm run deploy

6 What it is important to know

  1. Node.js

    The engine in package.json is set to Node.js 16

  2. ES Modules

    Node.js 16 supports ES Modules: so you have "type": "module" in package.json, format: 'es' in rollup.config.js and tsconfig.js used by tsc compiler targets ES2021 with ES2020 modules

  3. Bundling with Rollup

    Firebase Cloud Functions do not require the deployment of a single bundle. In any case the building with Rollup offers some advantages:

    • Tree shaking of unused code
    • No request for other files at runtime

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].