Skip to content

A Node.js command-line tool that runs muliple Google Lighthouse performance tests on a given URL, calculates the median from the results, and displays it on the command line. I created this CLI as a learning project to delve into building command-line interfaces using Node.js.

totti-rdz/node-cli-lighthouse-runner

Repository files navigation

lighthouse-runner-cli

This is a Node.js command-line tool that runs muliple Google Lighthouse performance tests on a given URL, calculates the median from the results, and displays it on the command line.

I created this CLI as a learning project to delve into building command-line interfaces using Node.js.

Usage

To run the project it has to be cloned as it is not published to npm.

  1. Clone this repository:

    git clone https://github.com/totti-rdz/node-cli-lighthouse-runner.git
  2. Install and build project:

    npm install && npm run build
  3. Enable execution of the built output:

    npm run chmod
  4. Run:

    ./bin/index.js https://www.google.de --iteration 5

    The --iteration flag is optional. If not specified, the lighthouse test will be run 5 times by default.

  5. Or create symlink (optionally):

    To use this project from anywhere create a symlink

    npm link

    and run with

    lighthouse-runner https://www.google.de --iteration 5

    The --iteration flag is optional. If not specified, the lighthouse test will be run 5 times by default.

    To remove the symlink run

    npm unlink -g

    from the project root folder.

    Confirm removal by trying to run lighthouse-runner again. If not removed look for the installation path with the "which" command and remove it manually.

Credits

This project was inspired by the tutorial Writing Your Own TypeScript CLI by Daw-Chih Liou. I made certain adjustments to the code to structure the project and ensure it works correctly in my environment and with current package versions.

Feel free to use, modify, and expand upon this project as you like. Happy coding!

About

A Node.js command-line tool that runs muliple Google Lighthouse performance tests on a given URL, calculates the median from the results, and displays it on the command line. I created this CLI as a learning project to delve into building command-line interfaces using Node.js.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published