2.0.3 • Published 4 months ago

lighthouse-scores v2.0.3

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

lighthouse-scores-to-email npm.io npm.io

Get Lighthouse scoring via Google PageSpeed Insights delivered to your email.

| npm.io | -

Configurations

Add email and general configurations to /configuration/config.js Add pages configurations to /configuration/pages.json

configuration/pages.json

{
  "Example": "https://example.net/",
  "Start Page" : "https://www.start.co.il"
}

configuration/config.json

{
  "email": {
   "to": "t-800@google.com",
   "authUser": "admin@skynet.net",
   "authPassword": "<INSERT_GOOGLE_APP_PASSWORD_HERE>"
 },
 "lightHouseApiKey": "<INSERT_PAGESPEED_API_KEY_HERE>"
}

To load configurations during run time from external file, use docker volume.

-v "$(pwd)"/pages.json:/usr/src/app/configuration/pages.json

getting-started with Docker

docker pull fiverr/lighthouse-scores-to-email:latest

Export your variables to the environment and pass them through alongside your pages.json file

docker run \
  -v "$(pwd)"/pages.json:/usr/src/app/configuration/pages.json \
  -e APIKEY \
  -e AUTH_USER \
  -e AUTH_PASSWORD \
  -e EMAIL_TO \
  -e STATSD_HOST \
  -e STATSD_PORT \
  fiverr/lighthouse-scores-to-email:latest

Or send as config file

docker run \
  -v "$(pwd)"/pages.json:/usr/src/app/configuration/pages.json \
  -v "$(pwd)"/config.json:/usr/src/app/configuration/config.json \
  fiverr/lighthouse-scores-to-email:latest

Get your credentials here

Get your PageSpeed API key.

Use Gmail with Google's app passwords.

Set up environment variables or configuration using config file

Env VariableConfig File pathValueDefault
APIKEYlightHouseApiKeySpeedTest API KeyMandatory
AUTH_USERemail.authUserEmail usernameNone
AUTH_PASSWORDemail.authPasswordApp passwordNone
EMAIL_TOemail.toRecipient Email addressNone
EMAIL_FROMemail.fromSender Email addressLighthouse Gazette <reporter@the-lighthouse-gazette.com>
EMAIL_SUBJECTemail.subjectSubject of the emailGoogle LightHouse Report ✔
EMAIL_HOSTemail.hostSMTP hostsmtp.gmail.com
EMAIL_PORTemail.portSMTP port465
STATSD_HOSTstatsd.hostStatsD hosnameNone
STATSD_PORTstatsd.portStatsD port8125
STATSD_PREFIXstatsd.prefixCustom prefix to metriclighthouse_scores_to_email
SECUREemail.secureShould use SSLtrue
-categoriesLighthouse categories['PERFORMANCE', 'SEO', 'ACCESSIBILITY', 'BEST_PRACTICES']
-strategiesLighthouse strategies['MOBILE', 'DESKTOP']

Add links to your email (for example, links for grafana)

configuration/config.json

{
    "email": {
        "list": [
            {
                "text": "Email provided by Fiverr SRE team",
                "url": "https://play.grafana.org/"
            },
            {
                "text": "View trends on Grafana dashborad",
                "url": "https://play.grafana.org/"
            }
        ]
    }
}