Skip to content

Compiles Firebase Bolt files to TypeScript, Flow, and more

Notifications You must be signed in to change notification settings

brandonpearcy/firebase-bolt-compiler

 
 

Repository files navigation

Firebase Bolt Compiler

CircleCI npm

Compiles Firebase Bolt files to TypeScript, Flow, and more.

This package is a rewrite of firebase-bolt-transpiler in TypeScript. It uses the same AST types from the original firebase-bolt package providing more safety and flexibility to generate different code artifacts.

Installation

yarn install firebase-bolt-compiler

Usage

To generate TypeScript:

firebase-bolt-compiler < rules.bolt

To generate Flow:

firebase-bolt-compiler --flow < rules.bolt

Example

Using the following rules.bolt file as an input:

path /users/{uid} is Users {
  read() { true }
  write() { isCurrentUser(uid) }
}

type Users extends User[] {}

type User {
  firstName: String;
  lastName: String;
}

Will generate the TypeScript code below:

type Users = { [key: string]: User };

export interface User {
    firstName: string;
    lastName: string;
}

About

Compiles Firebase Bolt files to TypeScript, Flow, and more

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 96.2%
  • JavaScript 3.8%