https://github.com/verydanny/lighthouse
Lighthouse profiler
https://github.com/verydanny/lighthouse
Last synced: 3 months ago
JSON representation
Lighthouse profiler
- Host: GitHub
- URL: https://github.com/verydanny/lighthouse
- Owner: verydanny
- Created: 2019-02-15T18:16:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-25T17:31:42.000Z (about 6 years ago)
- Last Synced: 2025-02-01T07:17:05.020Z (4 months ago)
- Language: TypeScript
- Size: 202 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PSI Profile Tool
Profiles list of sites according to Google PSI (lighthouse)
## Table of Contents
1. [Basic Usage](#basic-usage)
2. [Api](#api)
3. [Cli](#cli)Basic Usage
#### Running in node
```js
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
```js
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
}```
API
#### 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.
CLI
Available commands:
```bash
Usage: profiler [options] [command]Options:
-V, --version output the version number
-a --api Google API key
-v --view [view] Which view to test (default: "both")
-r --runs How many times to run profiler on URL
-h, --help output usage informationCommands:
URL to benchmark on
help [cmd] display help for [cmd]
```Example:
`yarn psi-profiler https://facebook.com --view desktop --runs 2`