GithubHelp home page GithubHelp logo

thisguychris / firebase-functions-unittest-cd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeremylorino/firebase-functions-unittest-cd

0.0 0.0 0.0 77 KB

How to setup, test, and continuously deploy Firebase Cloud Function v1.0

License: MIT License

TypeScript 100.00%

firebase-functions-unittest-cd's Introduction

Firebase Cloud Functions

How to setup, test, and continuously deploy Firebase Cloud Function v1.0

Table of Contents

Setup

To learn how to get started with Cloud Functions for Firebase by having a look at their Getting Started Guide, trying the quickstart samples and looking at the documentation.

  1. Install Node.js v8.10.0 or greater

  2. Install Node.js dependencies

    This will install everything required to setup, test, and deploy this repository:

     npm install
    

Obtain service account credentials

  • Go to API Manager -> Credentials
  • Click "New Credentials", and create a service account or click here
  • Download the JSON for this service account, and set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to the file containing the JSON credentials.

Set the GOOGLE_APPLICATION_CREDENTIALS environment variable:

Linux:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account_file.json

Windows:

set GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account_file.json

Windows (PowerShell):

$env:GOOGLE_APPLICATION_CREDENTIALS="/path/to/service_account_file.json"

Read more about Google Cloud Platform Authentication.

Authenticate the Firebase CLI

npm run firebase:login
> [email protected] firebase:login /home/ubuntu/workspace/firebase-functions-unittest-cd
> npm run firebase -- login --no-localhost


> [email protected] firebase /home/ubuntu/workspace/firebase-functions-unittest-cd
> firebase "login" "--no-localhost"

? Allow Firebase to collect anonymous CLI usage and error reporting information? Yes

Visit this URL on any device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=...

? Paste authorization code here: 4/my-auth-code

✔  Success! Logged in as [email protected]

Initialize the project directory

npm run firebase:init:functions
> [email protected] firebase:init:funcs /home/ubuntu/workspace/firebase-functions-unittest-cd
> npm run firebase -- init functions


> [email protected] firebase /home/ubuntu/workspace/firebase-functions-unittest-cd
> firebase "init" "functions"


     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /home/ubuntu/workspace/firebase-functions-unittest-cd


=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

? Select a default Firebase project for this directory: (Use arrow keys)
  [don't setup a default project]
❯ My Firebase Project (myproject-198914)
  [create a new project]
=== Functions Setup

A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.

? What language would you like to use to write Cloud Functions?
  JavaScript
❯ TypeScript
? Do you want to use TSLint to catch probable bugs and enforce style? Yes
? File functions/package.json already exists. Overwrite? No
i  Skipping write of functions/package.json
? File functions/tslint.json already exists. Overwrite? No
? File functions/tsconfig.json already exists. Overwrite? No
i  Skipping write of functions/tslint.json
i  Skipping write of functions/tsconfig.json
? File functions/src/index.ts already exists. Overwrite? No
i  Skipping write of functions/src/index.ts
? Do you want to install dependencies with npm now? Yes

npm notice created a lockfile as package-lock.json. You should commit this file.
added 570 packages from 469 contributors in 29.528s

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

✔  Firebase initialization complete!

testing

firebase-functions-unittest-cd's People

Contributors

jeremylorino avatar

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.