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

site-validator-cli

v1.3.5

Published

A command line tool that takes a URL or a file, then uses html-validator (a wrapper for https://validator.w3.org/nu/) to validate each page.

Downloads

3,620

Readme

Build Status Coverage Status js-standard-style

site-validator-cli

A command line tool that takes in a URL or a file, then uses html-validator (a wrapper for https://validator.w3.org/nu/) to validate each page.

Installation

Get Node.js, then

$ npm i site-validator-cli -g

Usage

$ site-validator <url> [options]

This takes in the URL and will generate the entire sitemap, then tries to validate each page in the sitemap

$ site-validator <path-to-file> [options]

This takes in a file accepting one of the following formats: .json/.xml/.txt, then tries to validate each page from the file. supports both local and online files. (File Content Guidelines)

$ site-validator [options] --url <url>
                           --path <path-to-file>

If it's more convenient, you can also put the url/path at the end, but you have to prepend with --url or --path.

Options

| Flag | Description | | --- | --- | | --verbose | This flag will pretty-print out the errors/warnings.Without it, it'll only say whether page validated. | | --quiet | This flag will ignore warnings or informational messages. | | --local | This expects the url to be a localhost url(e.g. http://localhost), if the site is not served on port 80, you have to specify the port number (e.g. http://localhost:3000). localhost sites served over HTTPS is not currently supported. | | --cache <min> | By default, the sitemap generated will be cached for 60 minutes. Use this flag to change how long you want to cache the sitemap for. | | --clear-cache | $ site-validator --clear-cache clears all cached sitemaps.If you want to refetch and recache sitemap for a url:$ site-validator <url> --clear-cache | | --output <filename> | Outputs a json file in the current directory.Filename optional, defaults to ISO format current timeOutput Schema | | --view <filename> | Prints report from output json file (without .json) to console.$ site-validator <filename> --view$ site-validator --view <filename>both works. | | --page | This validates the URL passed in without crawling. | | --ff | (Fail Fast) This flag will stop the checking at the first error.(Note: does not work with --output) |

Other Commands

Help

$ site-validator -h, help, --help

Version

$ site-validator -v, version, --version

File Content Guidelines

File - json

$ site-validator <path-to-json-file>

Expects a json-file with an array of URLs and tries to validate each page found in the array

[
  "https://example.com/",
  "https://example.com/about",
  "https://example.com/projects"
]

File - txt

$ site-validator <path-to-txt-file>

Expects a txt-file with 1 URL on each line and tries to validate each page found in the file

https://example.com/
https://example.com/about
https://example.com/projects

File - xml

$ site-validator <path-to-xml-file>

Expects a xml-file with the following format

<?xml version="1.0" encoding="UTF-8"?>
<urlset>
  <url>
    <loc>https://example.com/</loc>
  </url>
  <url>
    <loc>https://example.com/about</loc>
  </url>
  <url>
    <loc>https://example.com/projects</loc>
  </url>
</urlset>

Output Schema

{
  url: "url-entered",
  pages: [
    "crawled-page-1",
    "crawled-page-2",
    "crawled-page-3",
    //...
  ],
  quiet: "boolean",
  singlePage: "boolean",
  passed: "boolean",
  results: {
    passed: [
      {
        url: "crawled-page-pass",
        status: "pass",
        errors: []
      },
      //...
    ],
    failed: [
      // may contain the following types
      {
        url: "crawled-page-fail",
        status: "fail",
        errors: [
          {
            type: "error-type",
            message: "error-message",
            location: "error-location"  
          },
          //...
        ]
      },
      {
        url: "crawled-page-not-found",
        status: "not found",
        errors: []
      },
      {
        url: "crawled-page-error",
        status: "error",
        errors: [
          "error message"
        ]
      },
      //...
    ]
  }
}

Contributors

||| |---|---| |p1ho|zrrrzzt|

Acknowledgement

Inspired by w3c-vadlidator-cli (outdated)