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

nonono-pwa-firebase

v0.1.79

Published

## Get Up and Running

Downloads

34

Readme

xinjs app boilerplate

Get Up and Running

You will need nodejs and bun. Exactly version should not be important, but if you run into problems maybe upgrade?

You'll also need to install the firebase admin (globally).

  1. Create a folder (e.g. nonono)
  2. Create your secrets file and put it in a subfolder as secrets/firebase-secrets.json
    1. Firebase Console
    2. Project Overview (gear, top-leftish)
    3. Service Accounts (tab)
    4. Generate New Private Key (button at bottom)
    5. Find that file, rename it "firebase-secrets" and stick it in /secrets
    6. You'll need to run firebase login (and possibly preceded by firebase logout) see this question on Stack Overflow
  3. Clone the repo into the nonono folder (name doesn't matter, but nonono-pwa-firebase is the default) So, now you have a nonono directory with two subfolders, secrets and nonono-pwa-firebase (or whatever) And the secrets folder contains a json file named firebase-secrets.json and the other folder is a clone of the project repo which, notably, contains a ./functions subfolder. OK?
  4. inside the the project folder (nonono-pwa-firebase or whatever) npm install
  5. (inside ./functions) npm install // this is a separate project with its own dependencies
  6. bun install // bun stores its own highly optimized binary dependency tree
  7. in one terminal npm run emulators // ctrl-c then reset emulators to stop them later
  8. in a second terminal npm run dev // ctrl-c to kill this later

You may also need to run this command:

firebase functions:secrets:access --project <PROJECT_ID> <NAME_OF_SCECRET>

E.g.

firebase functions:secrets:access --project 171481538073 stripe-nonono-test

After doing this, be sure to restart your emulators.

Troubleshooting

  • If you can't do step 2, don't panic, you probably need to be added to the project by a project admin.
  • If you can't install bun, what can I say? stop using Windows or use the Linux subsystem or something.
  • If you have another problem then complain to someone and make sure it gets fixed and documented :D

The site should load on http://localhost:1234

By default, the app will use emulated services on localhost unless you add #prod to the url and reload (in which case it will use production). You can skip step 5 if you want to use prod

FireBase Emulators

To emulate services locally, in a separate terminal:

  1. npm run reset-emulators (if you've been runing them earlier)
  2. npm run emulators

If you're running locally and try to log in using a phone number, the confirmation code will be displayed in the terminal running the emulators.

Installing / Upgrading firebase-tools

Apparently the npm package is deprecated so to sort issues with zany bugs in firebase-tools you need to do this.

If necessary:

  npm uninstall -g firebase-tools

Then:

  curl -sL https://firebase.tools | bash

firebase-config.ts

../secrets/...admin

  1. Firebase > Project Settings > Sevice accounts
  2. Generate new private key
  3. Move resulting file to ../secrets directory outside the project root

Note that the project id in the deploy command must match that in the credentials JSON

You will need to go to the App Engine console to create an App Engine instance if you haven't already.

firebase emulator firestore.rules bug

It looks like the way to really fix this is:

  1. completely uninstall firebase-tools, e.g. sudo npm uninstall -g firebase-tools or curl -sL firebase.tools | uninstall=true bash
  2. reinstall it
  3. rm -rf ~/.cache/firebase (this forces new emulator binaries to be downloaded)

Also note, this may entail upgrading Java.

Useful Document Links

TODO

  • cloud function example
  • non-trivial service example
  • utility functions for saving and recovering binaries in storage
  • type-checking