@singpath/rules

1.1.1 • Public • Published

firebase-rules

Build Status Coverage Status

Rules and migration scripts for Singpath Firbase db.

Requirements

  • node 4+; you can use something like nvm to install multiple node version.
  • one or more Firebase project. If it will be used in production, you should have at production and a staging db

Setup

We will rely firebase-tools to upload data.

  1. setup a new npm project and install dependencies:

     ```shell
     npm install -g firebase-tools
     npm install -g @singpath/singpath-rules
     ```
    
  2. setup a Firebase project in the current directory (it should like to your staging DB):

     ```shell
     npm init
     firebase init
     firebase login
     ```
    
  3. edit firebase.json to add the "rules" entry:

     ```json
     {
       "firebase": "singpath-dev",
       "rules": "rules.json",
       "public": "public",
       "ignore": [
         "firebase.json",
         "**/.*",
         "**/node_modules/**"
       ]
     }
     ```
    
  4. upload rules and seed data to your Firebase DB.

     ```
     singpath-rules init-db
     ```
    

Building json rules

firebase-tools (see below) will support bolt rules directly sometime in the future, but for now we need them in the current json encoded form.

To compile the rules:

singpath-rules compile

You will find the rules in rules.json.

Uploading rules

./node_modules/.bin/singpath-rules upload-rules

Use the -f to switch the Firebase DB to upload to and -a to set the secret.

Development

See CONTRIBUTING.md.

Readme

Keywords

none

Package Sidebar

Install

npm i @singpath/rules

Weekly Downloads

1

Version

1.1.1

License

MIT

Last publish

Collaborators

  • dinoboff
  • singpath