1.1.0 • Published 6 years ago

@dreipol/lighthouse-audits v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

@dreipol/lighthouse-audits

CircleCI

Collection of useful lighthouse audits

Install

npm i @dreipol/lighthouse-audits --save

Setup

This module provides some audits for deeper inspections and better quality of your website/project.

Config

To add an audit to your lighthouse configuration you simply import this module. This module exports a couple of object (See API below). Those modules contain audits and gatherers. Those can be simply be added to your already existent lighthouse configuration.

Example

const {
    PSI,
} = require('@dreipol/lighthouse-audits');

...
passes: [
        {
            passName: 'defaultPass',
            recordTrace: true,
            pauseAfterLoadMs: 10000,
            networkQuietThresholdMs: 10000,
            cpuQuietThresholdMs: 10000,
            gatherers: [
            
                PSI.PSIGatherer,
                
                'url',
                'scripts',
                'css-usage',
                'viewport',
                'viewport-dimensions',
                ...
...
audits: [
    PSI.PSISpeedScoreAudit,
    
    'service-worker',
    'viewport',
    'without-javascript',
    

Now we've added the gatherer and the audit. But if we run the audits now, we wont see the result of the audit in the report, since we didn't added the category where the audit should be added at. There are two options.

First is to add all the categories and assign the audits by your own (recommended when not using the default)

categories: {
    dreipol: {
        name: 'Dreipol Audits',
        description: 'Dreipol audits',
        audits: [
            { id: '<AUDIT_NAME>', weight: 5 },
        ],
    },
    psi: {
        name: 'PSI',
        description: 'Page Speed Insight audits',
        audits: [
            { id: 'psi-speed-score', weight: 5 },
            ...
        ],
    }

Or you can use the default categories exported by this module. Those default categories are available under Categories

Exmaple in your lighthouse config:

const {
    Categories,
} = require('@dreipol/lighthouse-audits');

...
categories: {
    psi: Categories.PSI, 
    dreipol: Categories.Dreipol, 
}

Usage

API

Structure of exported module. You can use these to add them as audits/gatherers

Plain Email Addresses

ClassDescriptionAudit Name
PlainEmail.PlainEmailGathererGahters email adresses from a webpage
PlainEmail.PlainEmailAuditCalculates the score for emails found on the pageplain-email-audit

Broken Links

ClassDescriptionAudit Name
BrokenLink.BrokenLinkGathererGathers all links from a page
BrokenLink.BrokenLinkAuditCheck if any link resolves to a 404 pagebrokenlink-audit

Page Meta Tags

ClassDescriptionAudit Name
Meta.MetaGathererGather all META tags with the name='robots' on a page
Meta.MetaAuditCheck if any tag has a no-index or no-follow valuemeta-audit

Page Speed Insights

ClassDescriptionAudit Name
PSI.PSIGathererRuns a PSI report for the page
PSI.PSISpeedScoreAuditCalculate score based on the speed scorepsi-speed-score
PSI.PSIUsabilityScoreAuditCalculate score based on the usability scorepsi-usability-score
PSI.PSIHTMLSizeAuditCalculate score based on the HTML sizepsi-html
PSI.PSICssSizeAuditCalculate score based on the CSS sizepsi-css
PSI.PSIImgSizeAuditCalculate score based on the IMG sizepsi-img
PSI.PSIJsSizeAuditCalculate score based on the JS sizepsi-js
PSI.PSIJsResourcesAuditCalculate score based on the amount of JS resourcespsi-js-resources
PSI.PSICssResourcesAuditCalculate score based on the amount of CSS resourcespsi-CSS-resources

Example usage see above

Test

To test the config in the /example folder run

dreihouse report https://dreipol.ch -f ./example/lh.desktop.js -vvv
1.1.0

6 years ago

1.0.0

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago