npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@e2fyi/firebase-admin

v1.0.4

Published

CLI for firebase admin sdk

Downloads

6

Readme

/firebase

code style: prettier dependencies Status Known Vulnerabilities

cli for firebase-admin.

Available Features

  • Select project credential (fb-admin project)
  • List users (fb-admin users)
  • Update custom claims for user (fb-admin claims)

Installation

# npm
npm install -g @e2fyi/firebase-admin
# yarn
yarn global add @e2fyi/firebase-admin

Project credentials

The cli connects to a firebase project by loading the environment variable FIREBASE_SERVICE_ACCOUNT from .env. The .env can be automatically generate with the fb-admin project <PATH_TO_PROJECT_CRED> command.

Creating a service account and getting the project credentials

  • Navigate to the Service Accounts tab in your project's settings page.
  • Click the Generate New Private Key button at the bottom of the Firebase Admin SDK section of the Service Accounts tab.
  • Download and keep the JSON file in a secure location.

Example

# setup current project to
# `~/.firebase/firebase_service_account.json`
fb-admin project ~/.firebase/firebase_service_account.json

Additional resources:

  • https://firebase.google.com/docs/admin/setup#add_firebase_to_your_app

CLI

# run cli and see help
fb-admin -h
usage: fb-admin [-h] [-v] {project,claims,users} ...

cli command to manage custom claims for firebase users.

Optional arguments:
  -h, --help            Show this help message and exit.
  -v, --version         Show program's version number and exit.

subcommands:
  {project,claims,users}
    project             Setup credential for a firebase project.
    claims              Update the custom claims of a firebase user.
    users               List firebase users.

SUBCOMMAND PROJECT

Select a project by providing the path to the service account credentials.

usage: fb-admin project [-h] cred

Positional arguments:
  cred        Path to the JSON credential for firebase project.

Optional arguments:
  -h, --help  Show this help message and exit.

Example

fb-admin project ~/.firebase/firebase_service_account.json

SUBCOMMAND CLAIMS

Update the customClaims of a user.

usage: fb-admin claims [-h] [-d DATA] [-f FLAGS] email

Positional arguments:
  email                 ptnet user email

Optional arguments:
  -h, --help            Show this help message and exit.
  -d DATA, --data DATA  Set the custom claims with the JSON string. e.g.
                        '{"admin":1}'
  -f FLAGS, --flags FLAGS
                        Set a flag in custom claims with semicolon-delimited
                        <field=value> pairs. e.g. -f admin=1;scope=all;

Examples

# equivalent to -d {"admin": 1, "scope": "all"}
fb-admin claims [email protected] -f admin=1;scope=all;
# equivalent to -f admin=1
fb-admin claims [email protected] -d '{"admin":1}';

SUBCOMMAND USERS

List or search users based on email.

usage: fb-admin users [-h] [-m MATCH]

Optional arguments:
  -h, --help            Show this help message and exit.
  -m MATCH, --match MATCH
                        List only users with email matching the provided
                        minimatch pattern. e.g. *@email.com

Examples

# list all users
fb-admin users
# list all users with email domain "email.com"
fb-admin users -m *@email.com;