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

multisite-lighthouse-gcp

v0.0.1

Published

Run Lighthouse audits on URLs, and write the results daily into a BigQuery table.

Downloads

2

Readme

multisite-lighthouse-gcp

Run Lighthouse audits on URLs, and write the results daily into a BigQuery table.

Steps (needs rewrite)

  1. Clone repo.
  2. Run npm install in directory.
  3. Install Google Cloud SDK.
  4. Authenticate with gcloud auth login.
  5. Create a new GCP project.
  6. Enable Cloud Functions API and BigQuery API.
  7. Create a new dataset in BigQuery.
  8. Run gcloud config set project <projectId> in command line.
  9. Edit config.json, update list of source URLs and IDs, edit projectId to your GCP project ID, edit datasetId to the BigQuery dataset ID.
  10. Run gcloud functions deploy launchLighthouse --trigger-topic launch-lighthouse --memory 2048 --timeout 540 --runtime=nodejs8.
  11. Run gcloud pubsub topics publish launch-lighthouse --message all to audit all URLs in source list.
  12. Run gcloud pubsub topics publish launch-lighthouse --message <source.id> to audit just the URL with the given ID.
  13. Verify with Cloud Functions logs and a BigQuery query that the performance data ended up in BQ. Might take some time, especially the first run when the BQ table needs to be created.

How it works

When you deploy the Cloud Function to GCP, it waits for specific messages to be pushed into the launch-lighthouse Pub/Sub topic queue (this topic is automatically generated by the function).

When a message corresponding with a URL defined in config.json is registered, the function fires up a lighthouse instance and performs the basic audit on the URL.

This audit is then parsed into a BigQuery schema, and written into a BigQuery table named report under the dataset you created.

The BigQuery schema currently only includes items that have a "weight", i.e. those that impact the scores also provided in the audit.

You can also send the message all to the Pub/Sub topic, in which case the Cloud Function self-executes a new function for every URL in the list, starting the lighthouse processes in parallel.

Problems

The main problem is with the Performance audit. The lighthouse instances aren't meant for heavy lifting with default settings, so they don't necessarily reflect actual performance costs of the site. Some configuration for network conditions needs to be done in the future.

Cost

This is extremely low-cost. You should basically be able to work with the free tier for a long while, assuming you don't fire the functions dozens of times per day.

Todo

See ISSUES.