arjan-audit
v0.5.2
Published
audit the SEO of your website during development using lighthouse 6
Downloads
10
Maintainers
Readme
Arjan Audit
Arjan audit is a simple node module that helps automate the auditing process of static sites during the dev process using Google’s lighthouse 6. Often times when building a site, the page speed test is one of the last things we do. To avoid any surprise surprise, you can use arjan audit in your dev process or even integrate it into your tests.
How it works
Arjan audit uses express to serve your site and google chrome-launcher to make a headless launch of google chrome and retrieve the audits from lighthouse 6. Arjan then parses the results returned by lighthouse and return an organized subset of the results. When used from the CLI, arjan returns a neatly formatted report.
Getting Started
- install the arjan CLI globally.
npm i -g arjan-cli
- inside your proejct direcotry, initialize arja
arjan init
- run an audit
arjan audit
CLI Command
USAGE
$ arjan audit
OPTIONS
-d, --dir=dir Directory path to serve. default is root (relative to the path in which you run the command)
-f, --file=file Path of the page you want to audit. default is index.html
-p, --port=port Port used for the test server. Default is 8080.
-t, --threshold=threshold Integer value from 0 to 1 that represents what you consider to be an acceptable lighthouse score for your site. Its very similar to what you would consider an acceptable school test grade.
Programmatic use example
const Audit = require('arjan-audit')
Audit('./', 'index.html', 8080, .7)
.then(data=> console.log(data))
.catch(err=>console.log(err))
API
main
description: params: (dir, index, port, threshhold)
**dir**: string
**index**: string
**port**: int
**treshhold**: float: number between 0 and 1
returns: Promise(resolve, reject)
**resolve**: string: formatted
**reject**: error
The Audit Report
the audit report is a subset of data from the JSON response of lighthouse 6. for more information on the parameters of lighthouse 6 see this link
{
"lh5_score":float,
"lh6_score":float,
"main_metrics":{
"metric":{
"title":"string",
"score":float,
"description":"string"
}
},
"improvements":{
"improvement":{
"title":"title",
"score":float,
"description":"description",
"details":{}
}
}
}
Lighthouse 6 score
Google recently recalculated the score of what they consdier a healthy fast site. The new LCP metric was introduced and the score weights and metrics were changed. for more information check out Google’s Web Vitals
| Audit | Weight | | ---------------------------------------------------------------------- | ------ | | First Contentful Paint | 15% | | Speed Index | 15% | | Largest Contentful Paint | 25% | | Time to Interactive | 15% | | Total Blocking Time | 25% | | Cumulative Layout Shift | 5% |