$ npm install @ampproject/toolbox-cli $ amp help
$ npx @ampproject/toolbox-cli help
$ amp lint https://amp.dev PASS 1x1 images are specified by <amp-pixel> WARN All <amp-img> have reasonable width and height > [https://blog.amp.dev/wp-content/uploads/2019/06/cf_hero.png]: actual ratio [1999/1140 = 1.75] does not match specified [16/9 = 1.77] > [https://blog.amp.dev/wp-content/uploads/2018/10/img_20180926_163001-01.jpeg]: actual ratio [3680/2314 = 1.59] does not match specified [16/9 = 1.77] PASS Videos are under 4MB PASS <amp-video><source/></amp-video> syntax is used for video PASS Endpoints are accessible from cache PASS Endpoints are accessible from origin FAIL <meta charset> is the first <meta> tag > <meta charset> not the first <meta> tag PASS Runtime is preloaded
$ npx @ampproject/toolbox-cli lint https://amp.dev
$ amp lint -f sxg https://amp.dev PASS /amppkg/ is forwarded correctly PASS application/signed-exchange content negotiation is correct PASS dump-signedexchange -verify does not report errors PASS vary header is correct
$ amp optimize https://amp.dev $ amp optimize file.html
$ amp curls https://amp.dev https://amp-dev.cdn.ampproject.org/c/s/amp.dev https://amp-dev.amp.cloudflare.com/c/s/amp.dev https://amp-dev.bing-amp.com/c/s/amp.dev
$ amp curls --cache=google https://amp.dev https://amp-dev.cdn.ampproject.org/c/s/amp.dev
const Caches = require('@ampproject/toolbox-cache-list'); Caches.list().then(console.log);
$ amp update-cache https://www.example.com/ --privateKey /path/to/private-key.pem
const express = require('express'); const ampCors = require('@ampproject/toolbox-cors'); const app = express(); // That's it! app.use(ampCors())
import validatorRules from '@ampproject/toolbox-validator-rules'; validatorRules.fetch().then(rules => { // Get all website specific tag rules ... const tags = rules.getTagsForFormat('AMP'); // ...find the definition of the amp-img tag... const ampImg = tags.find(e => e.tagName === 'AMP-IMG'); const ampImgAttrs = ampImg.attrs // ...filter global, layout and amp-bind attributes... .filter(e => !e.name.startsWith('[') && !e.global && !e.layout) // ...extract the name... .map(e => e.name) // ...sort alphabetically... .sort(); // ...and display result in the console. console.log(ampImgAttrs); });