npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lighthouse-score-for-ci

v0.6.0

Published

LightHouse CI - Module used to create a very simple step for continous integratraion

Readme

LightHouse score for CI

Build Status Coverage Status

The goal of this module is to enable the creation of a very simple step for continous integratraion and google lighthouse.(https://developers.google.com/web/tools/lighthouse/)

Scope

The flow is very simple:

  • Download the project from github or install via npm
  • build the project
  • define the web pages array (JSON Array)
  • define the file .env
  • starts the analysis

prerequiste: Chrome installed on the host machine.

Download from npm

npm install lighthouse-ci

Clone the project from github

git clone https://github.com/marco-genova-ntt/lighthouse-score-for-ci.git

Build project

npm install

npm run jest

npm run build

Define .env file

The file .env is managed by node_modules dotenv (https://www.npmjs.com/package/dotenv)

A template to start application follows

#Slack token for the slack client, An access token (from your Slack app or custom integration - xoxp, xoxb)
SLACK_TOKEN=xoxb-.....,

#Slack channel identifier, use Web API simulator to extract this value (https://api.slack.com/methods/conversations.list)
SLACK_CHANNEL_ID=C6H41XTRU

#SLACK MODE TYPE (WEB (Incoming webbook, default) or BOT)
SLACK_MODE=WEB

#Base api url, use this for the actual version of api (Only for BOT mode)
SLACK_BASE_API=https://slack.com/api/{method}?token={token}&pretty=1

#Slack Incoming Webhook (@see https://api.slack.com/incoming-webhooks)
SLACK_WEB_HOOK=https://hooks.slack.com/services/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

#Write on AWS (true enable/false disable), guide the usage of .local_storage.json on AWS
AWS_S3_WRITING_ENABLED=true

#AWS S3 Bucket name, to define on your AWS Console S3 (CHANGEIT!!!)
AWS_BUCKET_NAME=test.slackplugin

#AWS base url change the bucket name in the url but don't change the {processID}. from (0.5.1+) the processID is changed from pattern <env>-<processID>.html
AWS_S3_TEMPLATE_RESOURCE=https://s3.eu-north-2.amazonaws.com/test.slackplugin/{processID}

#manged by standard mechanism
#AWS_SECURITY (managed by environment variables)
#AWS SECURITY MANAGENT
AWS_ACCESS_KEY_ID=.....
AWS_SECRET_ACCESS_KEY=....

#RESULT SERIES MANAGEMNET
#Where database of the results will be saved during runs
#this configuartion is available for LOCAL and AWS store localtion
SERIES_SERVICE_DATABASE_FILE=./tmp/allseries-database.json

#If true enable the store of the database on AWS S3 using bucket informaton
SERIES_SERVICE_DATABASE_FILE_ON_AWS=true

#SERIES Report on result tred
SERIES_ENABLE_TREND_REPORT=true

#Default templates based on anychart (generated bu plauground of anychart)
SERIES_TEMAPLTE_TREND_FILE=./templates/series/anychart-template.txt

#Save reports in AWS S3 using bucket informaton
SERIES_ENABLE_TREND_REPORT_ON_AWS=true

#When report trend is enabled this properties reports the index template file
SERIES_TEMAPLTE_INDEX_FILE=./templates/series/index.txt

#Sets the env to select a sets of page
LIGHTHOUSE_CI_ENV=qa

#Thresholds definition, the thresholds are in a specific file in the roor of the project
THRESHOLDS_EVALUATION_ENABLED=true

Define pages.json

(V0.3.0+) The paegs are divided for environment, the default environment is "default"

{
    "env1" : ['https://www.sample.com',
            'https://www.sample.com/page2?param=1'],
    "env2" : ['https://www.sample2.com',
            'https://www.sample2.com/page2?param=1']
}

Local Storage

The local storage is based on json database to get and set some utilities values (e.g. process identifier to generate unique reports). Actually the file is fixed: .local_storage.json

(V0.5.0+) In order to support dockerization and idempotention of the execution the file can be saved on AWS. This mechanism is configured by prop:

AWS_S3_WRITING_ENABLED

Chrome Configuration

the file chrome_config.json contains the lighthouse configuration. There's a standard configuration, follows this guide to understando how to personalize: https://github.com/GoogleChrome/lighthouse/blob/master/docs/readme.md

Technological stack

  • NodeJS 8+
  • Babel 7
  • AWS-SDK
  • Jest
  • Dotenv
  • LightHouse score for slack: https://www.npmjs.com/package/lighthouse-score-for-slack

The project is ES6-based.

Enable a simple bot on slack

I have create a simple app not distributed (actually) to manage the connection between simple bot and slack workspace.

Slack App configured

Reference to slack guide: https://api.slack.com/slack-apps

Create a bucket on Amazon Web Services (AWS) S3

This guide can be very helpful to create a bucket specific for this scenario: https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html

Define thresholds

Compile the file lighthouse-thresholds.json in the root of the project. For every performance index, define the minimun value to pass the test. The value must be a double value between 0 and 100.

{   
    "thresholds": {
      "performance": 5.0,
      "pwa": 5.0,
      "bestpractices": 5.0,
      "seo": 5.0,
      "accessibility": 5.0
    }
}

Notes

CentsOS 7

Install Google Shrome Stable, follows this very simple guide: https://allmytechproblems.blogspot.com/2019/02/install-chrome-stable-version-on-centos.html

In the file chrome_config.json add some options, follows working example:

{
    "chromeFlags": [
        "--print-config",
        "--headless",
        "--no-sandbox",
        "--disable-gpu"
    ],
    "emulatedFormFactor": "mobile",
    "disableDeviceEmulation": false,
    "throttlingMethod": "simulate"
}

Default report directory

The application generates reports in a default directory

<project_dir>/_reports

Acutally can not be changed.

Series Report HTML Format and related Index

Actually the results series report are generated by a simple aproach using a template based on anychart.

In this case We've used a replace in a html page generated by https://playground.anychart.com/.

We've substituted to ready html a placeholder, during report generation the placeholder are substituted by real values.

Example the actual series report:

Series Report

When The series report is enabled an index.html file is generated in first instance on the file system and, optionally, on AWS S3 (if the report series is enabled to AWS S3 storage).

Example Series Reports Index:

Series Reports Index

This is the index of AWS S3 web reposistory. The default web page is based on a template with stack:

  • bootstrap
  • jquery

Docker launch and pages

My advice is to enable the choioce of oages set directly from docker un command forcing the environment variable:

LIGHTHOUSE_CI_ENV=qa

let me say to remove from .env file and force the values from docket command like this:

docker run -e "LIGHTHOUSE_CI_ENV=qa" lighthouse-slack-ci