Manage your schema with built in run-time type checking.
Navigate to the @schemafire/firestore to learn how to use this library with firestore in your project.
The following are some pointers to getting started with contributing to the codebase.
Open up a terminal and run the following commands from the command line to get your local environment set up:
git clone https://github.com/ifiokjr/schemafire
cd schemafire # go to the firebase-admin-node directory
yarn # Yarn is preferred for its `workspace` supportIn order to run the tests, you also need to
download the gcloud CLI, run the following command, and
follow the prompts:
gcloud beta auth application-default login
yarn global add firebase-tools # npm install --global firebase-toolsThere are two test suites: unit and live. The unit test suite is intended to be run during development, and the live test suite is intended to be run on the CI and before packaging up release candidates.
To run the unit test suite:
yarn checks # Run lints, type-checks and tests the codebaseIf you wish to skip the linter and type-checking, and only run the unit tests:
yarn testThe live test suite requires a service account JSON key file for a Firebase
project. Create a new project in the Firebase console if
you do not already have one. Use a separate, dedicated project for integration tests since the
test suite makes a large number of writes to the Firebase realtime database. Download the service
account key file from the "Settings > Service Accounts" page of the project, and copy it to
config/test/key.json.
After this run
yarn setupSome Auth integration tests require that you enable the IAM API for your Firebase/GCP project, and grant your service account ID the "Service Account Token Creator" role. These must be done via the Google Cloud Console. Refer to the troubleshooting instructions in the official documentation for more details on how to achieve this.
Finally, to run the integration test suite:
$ yarn test:live # Build and run integration test suite