0.0.10 • Published 8 months ago

web-app-perf-lighthouse v0.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

node-web-app-perf-lighthouse

A script to run your local web app and yield developer experience and user performance data

This script is a drop in to perform the following in most Node.js based-web apps:

  • count the vulnerabilities
  • count the number of production node_modules
  • count the number of total node_modules
  • measure the installation time of npm ci (no node_modules)
  • run lighthouse programmatically, using npm run serve, gathering standard web vitals data
  • reports diagnostic data like the number of request, total bytes, etc
  • measures the build time of the app using npm run build

There seem to be a lot of tools that ALMOST do this, but a use case here is to run this vs different SHAs of your own site to compare results over time. No one metric tells the complete story, so be aware of the tradeoffs you make.

Installation

  1. Drop audit.mjs into your web app.

Usage

  1. Configure an .env file :
    HOST = 'http://localhost'
    PORT = ':3000'
    PATH = '/en'
    VERBOSE = true
    INSTALL = true
    FILESIZE = true
    WRITE = true
    MS_WAIT_BEFORE_LIGHTHOUSE = 10000
  2. Run node audit.mjs
  3. Review ./audit-report.json

Sample Output:

{
  "vulnerabilities": 22,
  "prodNodeModulesCount": 233,
  "prodNodeModulesSize": "40M",
  "allNodeModulesCount": 728,
  "allNodeModulesSize": "130M",
  "installTimeResult": "7s",
  "lightHouseTestResults": {
    "first-contentful-paint": "2.3 s",
    "largest-contentful-paint": "2.3 s",
    "first-meaningful-paint": "2.3 s",
    "speed-index": "2.3 s",
    "total-blocking-time": "0 ms",
    "max-potential-fid": "20 ms",
    "cumulative-layout-shift": "0.041",
    "interactive": "2.3 s",
    "server-response-time": "Root document took 10 ms",
    "bootup-time": "0.1 s"
  },
  "diagnosticPropertyResults": {
    "numRequests": 12,
    "numScripts": 3,
    "numStylesheets": 3,
    "numFonts": 1,
    "totalByteWeight": 75421
  },
  "elapsedBuildTime": "9.873"
}
0.0.10

8 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago