Adding a watch flag to the command line app
I've been finding this command useful when developing firebase-bolt rules:
$ node_modules/.bin/nodemon -x 'node_modules/.bin/firebase-bolt < database.rules.bolt > database.rules.json' -w database.rules.bolt
It uses nodemon to watch my .bolt file for changes. When a change is detected, it generates the .json firebase rules file using the firebase-bolt command.
This allows me to open the .bolt and .json files side-by-side, split screen in my editor (VSCode) and see how the .json file is being generated in real time as I edit my .bolt file.
It would be a nice enhancement if the firebase-bolt command had a --watch flag that provided this functionality.
This would be especially useful when learning Bolt, though I don't think I'd use it at this point. I was constantly generating json when I started with Bolt to compare the two.
That's a fair point. I can see how, after gaining some experience with Bolt, I'll begin to trust that Bolt is going to output what I expect... especially if I have some automated tests in place that verify my expectations.
This feature might just be a nice-to-have that smoothes the way for the on-boarding process.
You'll begin to trust Bolt so much that you may go a bit overboard locking things down. It's so much easier to write complicated & duplicative rules that your json will become nearly unreadable, while your bolt stays clean and organized.
Still, I was looking for this exact functionality several months ago.
@patrickmcd Ha! Literally a minute before reading your response I finished a .write rule in Bolt where I had this thought. The .bolt file is remarkably easy to understand (types are amazing!), but the .write rule that gets outputted in my .json is crazy. There's no way I could write and maintain that without experiencing strong cranial pain. Bolt FTW.