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

pgrita

v1.1.2

Published

pgRITA.com client

Downloads

1,728

Readme

Node client for pgRITA.com

Usage:

npx pgrita
  [--token <token>]
  [--project <project>]
  [--connection <database>]
  [--gitBranch <branch>]
  [--gitHash <hash>]

The following CLI arguments are required unless the relevant environmental variable is supplied:

  • --token <token>: your authentication token from pgRITA.com; alternatively supply via the PGRITA_TOKEN environmental variable.
  • --project <project>: the name of your project on pgRITA.com; alternatively supply via the PGRITA_PROJECT environmental variable.
  • --connection <database>: connection string to your PostgreSQL database (see below); alternatively supply via the DATABASE_URL environmental variable.

The command will exit with success (0 exit code) if introspection is successful, the upload is successful, the results from your database analysis are retrieved within the allotted timeout (30 seconds, normally much faster), and the analysis results show no errors. In all other cases the command will exit with a non-zero status code indicating failure.

This command is suitable for use in your CI workflow.

Determining git branch and hash

If you don't supply git branch/hash via the --gitBranch and --gitHash flags, we will attempt to determine your git branch and git hash by using these continuous integration environmental variables:

  • GitHub Actions:
    • branch: GITHUB_REF
    • hash: GITHUB_SHA
  • Circle CI
    • branch: CIRCLE_BRANCH
    • hash: CIRCLE_SHA1
  • Travis CI
    • branch: TRAVIS_PULL_REQUEST_BRANCH or TRAVIS_BRANCH
    • hash: TRAVIS_COMMIT

Failing that, we'll try and extract them from the local git repository by running the following commands:

  • git branch: git rev-parse --abbrev-ref HEAD
  • git hash: git rev-parse --verify HEAD

If this fails, we'll progress without branch/hash.

PostgreSQL connection string

If you have PostgreSQL installed locally using trust authentication, your database name may suffice. Otherwise a standard PostgreSQL connection URI (e.g. postgres://user:password@host:port/dbname) should be supplied. If your PostgreSQL connection requires SSL (e.g. error such as ERROR: no pg_hba.conf entry for host "xxx.xxx.xxx.xxx", user "***, database "***", SSL off), you may need to add ?ssl=true to the connection string. If you get an error such as ERROR: self signed certificate then the quickest fix is to add ?ssl=no-verify; there are other more proper fixes but they're somewhat complex - we use the pg module (https://node-postgres.com/) as our PostgreSQL client, so more instructions can be found there (or ask on the Graphile Discord).

You can read more about connection strings here:

  • https://www.npmjs.com/package/pg-connection-string
  • https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING