GithubHelp home page GithubHelp logo

zaletskyi / amp-site-validator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wjsc/amp-site-validator

0.0 3.0 0.0 13 KB

Full site AMP validator

Home Page: https://www.npmjs.com/package/amp-site-validator

License: MIT License

JavaScript 100.00%

amp-site-validator's Introduction

Current Version NPM Minified size Github Code Size Downloads/Year Issues License Contributors

NPM

amp-site-validator

Full site AMP validator

If you publish your pages in AMP, you want to be sure any change does not affect your AMP performance. How? Setup a function generator that returns all URLS you want to validate and test them with the official Google's validator.

Usage

// 1. Import module
const validator = require('amp-site-validator');

// 2. Create your own url generator
const urlGenerator = function* (){
  for(let i=1; i < 200; i++){
    yield 'https://yourSite.com/page/'+i;
  }
}

// 3. Set the number of parallel jobs and validate!
async function run(){
  // This will fetch and validate 10 pages at the same time
  const results = await validator(urlGenerator, 10);
  console.log(results);
}
run();

Another way to create a generator?

const urlGenerator = function* (){
  yield 'https://yourSite.com/page/1';
  yield 'https://yourSite.com/page/2';
  yield 'https://yourSite.com/page/3';
  yield 'https://yourSite.com/page/4';
  yield 'https://yourSite.com/page/5';
  yield 'https://yourSite.com/page/6';
}

How to count correct and failed pages ?

console.log('Valid pages : '+ results.filter( result => result.status === 'PASS').length)
console.log('Invalid pages : '+ results.filter( result => result.status !== 'PASS').length)

FAQs

amp-site-validator's People

Contributors

walterscarano avatar wjsc avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.