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

rnfb-cli

v1.0.0

Published

React Native Firebase module mananger is an extensible CLI for React Native & Firebase developers.

Downloads

5

Readme

Introduction

Firstly lets start off by stating that this has not been released yet and is still very much a work in progress, but, that's where you as a potential contributor come in.

We're at the stage now where most of the core is stable and ready to be opened up for contributions.

We've built the CLI up with extensibility, performance and ease of development in mind and as such most of the common internal functionality such as reading files, working out directory paths, prompting for inputs, storing data between sessions and so on has been abstracted into high level apis onto the global node context of the CLI process.

Pro Tip: Enter the interactive debugger on the CLI by typing debug. Once there type Globals and press ENTER to inspect all available globals.

This README file documents the internals/setup of the CLI and is (for now) aimed at contributors.

Authenticate your Firebase account(s)

If you're a user of the official Firebase CLI you'll find yourself automatically signed in ✨ Just a little bit of magic from us to help you get started quickly ⚡️

We've built the CLI to support multiple Firebase accounts at it's core by default. Because of this it's dead easy to switch accounts on multiple levels e.g. the default account for all CLI sessions, the account to use for the current CLI session or the account to use just for the command you're running:

accounts

Adding a new account

Adding a new account is as simple as typing firebase add account or fb auth for short. Run this command and your browser will open with Google's OAuth consent authorisation flow. Quick and simple.

Interactivity

The CLI supports both an interactive CLI mode as well as directly running command outside the interactive mode.

Use Program.isREPL() === true to detect if in interactive mode.

Differences

Interactive

  • Auto completes args
  • Firebase account can be set for the session or it defaults to the default account
  • Prompts: choose from a list, input a value etc
  • Arguments should always be optional where possible, any missing args then interactivly prompted for.
  • Command history

Non Interactive

  • No autocomplete
  • Firebase account is the default account or the provided one if --account [email] option is provided
  • No prompts
  • Required args should always be required - no prompting for input - error and exit if missing
  • No command history except for what the users terminal provides

Command Definition

On top of the standard Vorpal command argument definition syntax we've also added {argName} syntax.

Command args defined using {argName} syntax become required in Command Mode (they will automatically error if not provided). However, in Interactive Mode these become optional - it's then up to the command run function to interactivly prompt for missing args.

You can still make an arg always required (<argName>) or always optional ([argName]) no matter the mode if required.

Examples

Interactive Mode: rnfb + enter - enters the interactive CLI mode. Then typing firebase projects will list the projects for the default or current session account.

Command Mode: rnfb firebase projects + enter will immediately list the projects for the default account and not enter interactive mode.

Setup for local development

(or just to have a play around with it - we won't judge)

  1. Clone the repo: git clone https://github.com/invertase/react-native-firebase-cli.git
  2. Install dependencies: npm i
  3. Link the project globally so you can run rnfb on any terminal session: npm link --local

Typing rnfb into your terminal should now run the CLI - any changes you make are automatically reflected. Type help to view all available commands.

cli

See /extensions/firebase/commands for examples of how current commands have been defined and how they function.

Debugging / Playground REPL

The CLI has a built in debugging shell which allows you to execute JS in the context of the CLI.

Type debug to enter the RNFB Debugging REPL.

Features

  • Code is executed inside an AsyncFunction therefore allowing the use of await syntax
  • If executed code returns a Promise it will automatically try fulfil the Promise
  • Exceptions are automatically caught and pretty printed

Example

debug-repl