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

psi-profiler-tool

v0.2.7

Published

Profile your url with lighthouse

Downloads

34

Readme

Table of Contents

  1. Basic Usage
  2. Api
  3. Cli

Running in node

const profiler = require('psi-profiler-tool')

profiler({
  runs: 1,
  wait: 2000,
  view: 'mobile',
  verbose: true, // Console logs individual test runs
}, [
  'https://facebook.com',
  'https://google.com'
])

Saving the report object

import profiler from 'psi-profiler-tool'

async function getReport() {
  const options = { runs: 1, wait: 2000, view: 'mobile' }
  const urls = [ 'https://facebook.com', 'https://google.com' ]

  const result = await profiler(options, urls)
  // do something with result
}

profiler([options], urls)

Returns a Promise for the response data

options

runs

Type: number

How many times to run profiler on each url

wait

Type: number

How much time in ms. to wait before running again. Recommended: 0
Important: get a Google API key to run with no stoppage

view

Type: 'mobile' | 'desktop' | 'both'
Default: 'both'

Which view you want to test on. It defaults to both.

api

Type: string

Google API key. You can register for one in the Google Dev Console. Make sure you limit the key to PSI metrics only.

verbose

Type: boolean

Output the console every time a test is complete. Useful if you're not testing on node.

url

Type: string | string[]

Single string, parameters of string, or array of strings to test on.

Available commands:

Usage: profiler [options] [command]

Options:
  -V, --version       output the version number
  -a --api <key>      Google API key
  -v --view [view]    Which view to test (default: "both")
  -r --runs <number>  How many times to run profiler on URL
  -h, --help          output usage information

Commands:
  <url>               URL to benchmark on
  help [cmd]          display help for [cmd]

Example:

yarn psi-profiler https://facebook.com --view desktop --runs 2