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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@foo-software/binoculars

v1.0.5

Published

A tool to measure web page SEO friendliness

Downloads

45

Readme

@foo-software/binoculars

A tool to measure web page SEO friendliness. Binoculars extends Google's Lighthouse to provide a more opinionated, SEO specific audit.

  • Choice of programmatic usage or CLI.
  • Run a single audit or multiple audits at once.
  • Upload reports to S3 via simple configuration.
  • Automatically post results as comments in GitHub via commits or pull requests (see options).
  • Automatically post results in Slack (see options).

Meaningful Content

Binoculars extends Lighthouse by adding the following audits in a custom group named "Meaningful Content".

  • Title Length: Title should be between 50 - 70 characters.
  • Description Length: Descriptions should be between 100 - 160 characters.
  • Keywords: Keyword phrases of at least 2 words should exist in the title, description and at least twice in the content of the page.
  • Headings: Has at least 1 <h1> tag and 1 <h2> tag.
  • Meaningful Text: Has sufficient textual content (300 characters).
  • Meaningful Tag Structure: Has at least 2 different informational HTML tags of the following types: <p>, <li>, <img>, <table>.

Metrics

Binoculars accounts for metrics from Lighthouse SEO and accessibility categories and weights them accordingly. It combines metrics from these categories with the "Meaningful Content" group detailed above. See the complete list of audits and weighting here.

Usage

Use programmatically or via CLI.

npm i @foo-software/binoculars

or

yarn @foo-software/binoculars

Programmatic Usage

const path = require('path');
const binoculars = require('@foo-software/binoculars').default;

(async () => {
  const results = await binoculars({
    url: 'https://www.foo.software',
 
    // example if you have an "artifacts" directory in your root directory
    outputDirectory: path.resolve('./artifacts'),
 
    // any other options go here
  });
 
  console.log('local report', results[0].localReport);
  // local report ./reports/report-1602194942162.html

  console.log('score', results[0].result.categories.binocularsSeo.score);
  // score 0.96
})();

CLI Usage

Arguments are represented in the options section. Any array type relies on the pipe symbol as shown with urls in the second example below.

binoculars --url https://www.foo.software --outputDirectory ./artifacts

Use a | when auditing multiple URLs like so:

binoculars --urls "https://www.foo.software|https://www.foo.software/register"

Options

Return Payload

binoculars is a promise that resolves an array. The reason it resolves with an array is because options allow url or urls. Because a consistent return is ideal, we return an array regardless if there is only one result or more. Each array item is an object with the below payload.

Environment Variables

You can optionally provide environment variables as detailed below.

Credits

This package was brought to you by Foo - a website quality monitoring tool. Automatically test and monitor website performance, SEO and accessibility with Lighthouse. Analyze historical records of Lighthouse tests with automated monitoring. Report with confidence about SEO and performance improvements to stay on top of changes when they happen!