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

create-firekit-app

v0.1.0

Published

First thing you need to do: create a `config.js` file in `src/firebase`, you can copy the `config.example.js` file and fill in values per your project. This information can be found on Firebase under Project Settings > General. Scroll down to the bottom t

Downloads

5

Readme

Welcome to FireKit

First thing you need to do: create a config.js file in src/firebase, you can copy the config.example.js file and fill in values per your project. This information can be found on Firebase under Project Settings > General. Scroll down to the bottom to the Your Apps section, if there is no app, click Add App and create a web app. This will give you the config information you need for the config.js file. Simply copy the firebaseConfig object contents to the export default object at the bottom of the config.js file.

User and Admin Setup

The baseline app has a sign-in page that requires and Admin user. To create a user:

  • Go to https://firebase.console.google.com
  • Go to the Authentication > Users tab
  • Click Add User
  • Add user email and password
  • Once the user is created you can copy the UUID generated, you will need this to make the user an admin.

To make the user an Admin you will need to generate a Service Account Key and run the makeAdmin script. To generate a Service Account key:

  • Go to https://firebase.console.google.com
  • Go to Project Settings > Service accounts
  • Under Firebase Admin SDK, select Node.js and click Generate new private key
  • Save the file as serviceAccountKey.json inside the secrets directory.

To promote a user to Admin:

  • Open a terminal window in the root directory of this project.
  • Copy the UUID of the user you want to promote from Firebase console
  • Open a terminal in the root directory of this project.
  • Run node makeAdmin.local.cjs --uid {UUID}

Now you should be able to sign-in to the newly created app.

Developing

Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:

npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open

Add --host flag to allow testing with other devices on the network:

npm run dev --host

Firebase

By default, the app will use the production firebase config. If you wish to use the firebase emulators (e.g for offline development), do the following:

  1. Setup firebase locally (required for firebase deploy as well)
  2. cd functions and npm i to install packages required by firebase functions
  3. npm run fb:emu to start the emulators with seed data
  4. In a separate terminal, npm run dev:emu --host
  • NOTE: You must specify an IP address to access the emulators from. You can do this either by creating an .env.local file at the project root and adding VITE_FIREBASE_EMU_HOST=<YOUR IP> or by setting it when running the dev server, e.g: VITE_FIREBASE_EMU_HOST=127.0.0.1 npm run dev:emu --host

Editing Emulator Seed Data

Current flow for updating seed data requires one of the following approaches:

  1. Edit the export files located in src/firebase/seed (not recommended(?))
  2. Run the emulators with --export-on-exit src/firebase/seed. Ideally this will only be used very intentionally to keep unwanted noise out of the seed data + out of git

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

To deploy your app, you may need to install an adapter for your target environment.

Deployment / CORS

  • npm run deploy to firebase
  • To update CORS configuration, modify cors.json and run gsutil cors set cors.json gs://<FIREBASE APP NAME> (may require gcloud login)

Use Firebase Hosting

Add following block to firebase.json:

  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/200.html"
      }
    ]
  },

May require static adapter in svelte.config.js:

import adapter from '@sveltejs/adapter-static';

const config = {
  ...
  kit: {
    adapter: adapter({ fallback: '200.html' }),
    ...
  }
}