Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wcandillon/firebase-bolt-compiler
Compiles Firebase Bolt files to TypeScript, Flow, and more
https://github.com/wcandillon/firebase-bolt-compiler
Last synced: about 2 months ago
JSON representation
Compiles Firebase Bolt files to TypeScript, Flow, and more
- Host: GitHub
- URL: https://github.com/wcandillon/firebase-bolt-compiler
- Owner: wcandillon
- Created: 2017-09-23T18:18:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T09:52:38.000Z (about 2 years ago)
- Last Synced: 2024-10-14T05:27:04.143Z (2 months ago)
- Language: TypeScript
- Size: 245 KB
- Stars: 14
- Watchers: 3
- Forks: 6
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Firebase Bolt Compiler
[![CircleCI](https://circleci.com/gh/wcandillon/firebase-bolt-compiler.svg?style=svg)](https://circleci.com/gh/wcandillon/firebase-bolt-compiler)
[![npm](https://img.shields.io/npm/v/firebase-bolt-compiler.svg)](https://www.npmjs.com/package/firebase-bolt-compiler)Compiles Firebase Bolt files to TypeScript, Flow, and more.
This package is a rewrite of [firebase-bolt-transpiler](https://github.com/fny/firebase-bolt-transpiler) in TypeScript. It uses the same AST types from the original [firebase-bolt](https://github.com/firebase/bolt) package providing more safety and flexibility to generate different code artifacts.
## Installation
```bash
yarn install firebase-bolt-compiler
```## Usage
To generate TypeScript:
```bash
firebase-bolt-compiler < rules.bolt
```To generate Flow:
```bash
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;
}
```