2.0.1 • Published 1 year ago

pagespeeder v2.0.1

Weekly downloads
11
License
ISC
Repository
-
Last release
1 year ago

pagespeeder

Measure pagespeed with a simple configuration.

Install

Requirements

  • Chrome / Chromium needs to be installed first

npm i -g pagespeeder

CLI Usage

Options

OptionValues DefaultDescription
-u--urlhttps://github.comnone (required)URL to check the pagespeed for
-d--devicemobile, desktopallWhich device you want the check. Default is both. If you select a value only this value will be checked
-o--outputcli, jsonclicli will only be displayed in console window while json output will create a json file with the results
-p--outputPath./results/result.jsonworking directoryThe output path which is used to save the result json for every device. Device names are added to the filename automatically. If you just enter a path a default filename is added.
-r--runs31How many runs you want to do against an url. This is used to get precise results instead of an single test. Pagespeed tests can differ between 2 runs. The result will be the average of all runs.

Examples

To get desktop and mobile results with 1 run pagespeeder -u https://github.com

Node Module Usage

API

new PageSpeeder(url, device, runs, options);

Options

url = string - "https://google.com";
device = string - "mobile" || "desktop" || null; // null means "mobile && desktop"
runs = number - 1; // Number of runs for one result (average score)
options = {
    // Options for the chrome-launcher and chrome flags itselt
    launcherOptions: {
      port: null,
      ignoreHTTPSErrors: true,
      headless: true,
      args: [
        "--no-zygote",
        "--no-sandbox",
        "--disable-setuid-sandbox",
        "--disable-gpu",
      ],
    },
    // Config to give to lighthouse. Default Config 'lighthouse.conf.js' is used.
    lighthouseConfig: lighthouseConfig,
    // Just supress some output things. Leave it to false for better usage
    silent: false,
    // Simple function that will be called before or after the named actions
    hooks: {
      beforeRunDevice: (device, options) => {},
      afterRunDevice: (device, options) => {},
      beforeRunIteration: (run, runCount, options) => {},
      afterRunInteration: (run, runCount, options) => {},
    },

Examples

const PageSpeeder = require("pagespeeder");
const ps = new PageSpeeder("https://github.com", "mobile", 3);

const scores = await ps.run();

// Use the scores array to your needs
2.0.1

1 year ago

2.0.0

1 year ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.8

3 years ago

1.1.7

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago