Code Monkey home page Code Monkey logo

gw_cloudfunction's Introduction

Firebase Functions with Babel config to target the correct Execution Environment

Use Babel to target the correct execution environment for Cloud Functions for Firebase and use modern languages features (ES6+) to develop.

Here is the accompanying Medium post.

Project Layout Description

I suggest developing your Cloud Functions in the src/functions/ directory and output everything to a dist/functions/ folder. By using a single root package.json we remove the need for maintaining and possibly merging two or more for the Functions themselves and other code, like a frontend app.

Use @babel/core, @babel/cli and @babel/preset-env with some npm scripts to compile to the Cloud Functions server runtime of NodeJS v6.11.5. The output directory, dist/functions/ is created on compilation in the deploy step (yarn deploy).

Firebase predeploy scripts are used in the firebase.json to coordinate which npm scripts get called before deploying to ensure everything is built.

Download & Install

# Clone this dir
curl https://codeload.github.com/jthegedus/blog-code/tar.gz/master | tar -xz --strip=1 blog-code-master/firebase-functions-es6-babel
cd firebase-functions-es6-babel
# Install
yarn

Login to the Firebase CLI

If you're using firebase-tools globally, then skip to the Deploy to Firebase step.

yarn fblogin

Local Testing

yarn funcs:serve

Try the new experimental Firebase Shell for truly local testing:

yarn funcs:shell

Deploy to Firebase

Update .firebaserc to use your Firebase project id.

yarn funcs:deploy

gw_cloudfunction's People

Contributors

l3lcss avatar paretkf avatar

Forkers

itchampza

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.