Package Exports
- firebase-tools-extra
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (firebase-tools-extra) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
firebase-tools-extra
Extra functionality for firebase-tools with support for emulators and auth through service account
Installation
npm i --save-dev firebase-tools-extraSetup
- Generate a service account from within the settings section of the Firebase console
- Save the service account to
serviceAccount.jsonwithin your firebase project repo (or setSERVICE_ACCOUNTenvironment variable) - Make sure you add
serviceAccount.jsonto your.gitignoreso it is not commited as part of your changes - THIS IS EXTREMELY IMPORTANT
To use with emulators:
- Do one of the following:
- Pass the
--emulatorflag along with your command - Set
FIREBASE_DATABASE_EMULATOR_HOSTandFIRESTORE_EMULATOR_HOSTvariabes to your environment
- Pass the
- Use firebase-tools-extra the same way you would firebase-tools:
firebase-extra database:get /users
Usage
firebase-tools-extra should be used the same way that firebase-tools is used - the API is as close to the same as possible:
firebase-extra database:get --limit-to-last 10 /usersTests
Tests are currently not set up since they were causing timeouts when trying to shut down the emulator. They will be re-enabled once that is solved.
Add back
Install
yarn add -D concurrently wait-port ts-mocha chai mocha @types/mocha @types/expect @firebase/testingAdd the npm scripts:
"test:full": "concurrently \"npm run emulate\" \"wait-port -o silent 8080 && npm run test\"", "test": "ts-mocha -p ./tsconfig.json test/**/*.spec.ts --exit",
Why
firebase-tools does not have the following:
- support for emulators (feature request to add this to
firebase-tools) - full Firestore interactions including
get,add,set, andupdate
License
MIT