firebase-rules-bundler
v2.0.8
Published
CLI tool that generates a consolidated file from separated files for Firebase Firestore or Storage rules.
Downloads
206
Readme
firebase-rules-bundler
Description
This npm package is a CLI tool that generates a consolidated file from separated files for Firebase Firestore or Storage rules.
installation
Please set the 'type' field in your package.json to 'module' since this package supports Pure ESM.
{
"type": "module"
}
$ npm i firebase-rules-bundler
$ ts-node-esm node_modules/.bin/frb
# or
$ node --loader ts-node/esm node_modules/.bin/frb
or
{
"scripts": {
"frb": "ts-node-esm node_modules/.bin/frb",
"firebase-rules-bundler": "ts-node-esm node_modules/.bin/firebase-rules-bundler"
}
}
then
$ npm run frb -- bundle
$ npm run frb -- bundle --only firestore
set .frbrc.js
export default {
firestore: {
doc: true,
directoryPath: 'firestore',
main: 'firestore.main.rules',
output: 'firestore.rules',
},
storage: [
{
doc: true,
directoryPath: 'storage',
main: 'storage.main.rules',
output: 'storage.rules',
},
],
}
rules_version = '2';
// @import ./functions/firestore.index.rules
service cloud.firestore {
match /databases/{database}/documents {
// @import ./hero/index.rules
}
}