firebase-rules-bundler
TypeScript icon, indicating that this package has built-in type declarations

2.0.8 • Public • Published

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',
    },
  ],
}

example files

rules_version = '2';

// @import ./functions/firestore.index.rules

service cloud.firestore {
  match /databases/{database}/documents {
    // @import ./hero/index.rules
  }
}

Package Sidebar

Install

npm i firebase-rules-bundler

Weekly Downloads

25

Version

2.0.8

License

MIT

Unpacked Size

46.6 kB

Total Files

66

Last publish

Collaborators

  • cilly