aputinski / butane Goto Github PK
View Code? Open in Web Editor NEWA simple Firebase Security Rules preprocessor
License: MIT License
A simple Firebase Security Rules preprocessor
License: MIT License
I installed 2.0.4 and am getting the following error:
D:\temp> npm install -g butane
C:\Users\Mike2\AppData\Roaming\npm\butane -> C:\Users\Mike2\AppData\Roaming\npm\node_modules\butane\bin\butane.js
[email protected] C:\Users\Mike2\AppData\Roaming\npm\node_modules\butane
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
└── [email protected]
D:\temp> butane rules.yaml rules.json
module.js:340
throw err;
^
Error: Cannot find module 'require-relative-main'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (C:\Users\Mike2\AppData\Roaming\npm\node_modules\butane\bin\butane.js:3:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
It'd be great if we could have a convertString function that just takes a YAML string and returns the JSON string!
To me, it would seem that this...
.functions:
isAuthed(): (auth !== null || auth.One)
isOther(): (auth.Two || auth.Three)
rules:
.read: isAuthed() && isOther()'
... would evaluate to...
.read: "(auth !== null || auth.One) && (auth.Two || auth.Three)
... but it evaluates to...
.read: "auth !== null || auth.One && auth.Two || auth.Three"
... which has different results, however...
.read: (isAuthed()) && (isOther())
...does compile as expected. I think you could automatically wrap all function calls in parenthesis that way these logic issues are avoided. Thoughts?
When running butane (v2.0.3) I am receiving the following error:
D:\temp> butane rules.yaml rules.json
module.js:340
throw err;
^
Error: Cannot find module 'babel-runtime/helpers/sliced-to-array'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (C:\Users\Mike2\AppData\Roaming\npm\node_modules\butane\dist\cli.js:3:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
This yaml:
root.users[next].email.replace('.', ',')
produces this:
root.child('users').child(newData.val()).child('email').replace('.', ',')
when it should .val()
the ss before the replace:
root.child('users').child(newData.val()).child('email').val().replace('.', ',')
workaround is to explicitly include the .val()
in the butane yaml
Butane does not warn you when you attempt to use an undefined function. This seems error prone.
Input
.read: isWorker() # isWorker is not defined
Output
".read": "isWorker()"
Maybe throw an error here?
It would be nice to place .indexOn rules next to .read/.write/.validate rules. Currently I have to manually edit the generated JSON.
In Chai's expect(fn).to.throw
, throw is a function.
Assertions such as https://github.com/aputinski/butane/blob/master/test/rules.js#L97 aren't testing anything
// Improper usage (these both always pass)
expect(fn).to.throw
expect(fn).to.not.throw
// Proper usage
expect(fn).to.throw(/some error/)
I installed 2.0.4 and am getting the following error:
D:\temp> npm install -g butane
C:\Users\Mike2\AppData\Roaming\npm\butane -> C:\Users\Mike2\AppData\Roaming\npm\node_modules\butane\bin\butane.js
[email protected] C:\Users\Mike2\AppData\Roaming\npm\node_modules\butane
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
└── [email protected]
D:\temp> butane rules.yaml rules.json
module.js:340
throw err;
^
Error: Cannot find module 'require-relative-main'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (C:\Users\Mike2\AppData\Roaming\npm\node_modules\butane\bin\butane.js:3:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.