Socket
Socket
Sign inDemoInstall

@ampproject/toolbox-cli

Package Overview
Dependencies
102
Maintainers
16
Versions
80
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ampproject/toolbox-cli

A Command Line Interface (CLI) for amp-toolbox


Version published
Weekly downloads
3
decreased by-25%
Maintainers
16
Install size
11.7 MB
Created
Weekly downloads
 

Changelog

Source

2.9.0 (2022-06-23)

:rocket: Enhancement
  • cloudflare-optimizer-scripts
    • #1318 Add support for Opaque redirects (@abdulhannanali)
  • optimizer
:bug: Bug Fix
  • optimizer
    • #1319 Fix i-amphtml-sizer responsive issue (@ediamin)
    • #1312 More robust auto extension import (@sebastianbenz)
    • #1303 Fix for issue #1302: "SSR: Duplicated ids in rendered markup, if there are nodes with attributes 'media', 'heights' or 'sizes'" (@DK-Stern)
    • #1305 Fix for issue #1304: "SSR: Transforming of nodes with attribute 'heights' fails, if value contains multiple media queries" (@DK-Stern)
:house: Internal
  • cache-url, cli, cloudflare-optimizer-scripts, linter, optimizer-docker, optimizer, page-experience, update-cache
  • cache-list, cache-url, cli, cloudflare-optimizer-scripts, core, cors, linter, optimizer-docker, optimizer-express, optimizer, page-experience, runtime-fetch, runtime-version, script-csp, update-cache, validator-rules
Committers: 6

Readme

Source

AMP-Toolbox CLI

npm version

The AMP Toolbox command line interface consists of a Node.js program called amp that can be run from a Windows, macOS, of UNIX-compatible command line environment. This way, AMP Toolbox can easily be integrated into a command line build process.

Supported commands:

  • curls: generate AMP cache URL(s)
  • download: download the AMP runtime
  • help: lists all commands
  • lint: checks document for errors
  • optimize: runs AMP Optimizer for a given URL or file
  • runtime-version: shows the current AMP runtime version [production]
  • update-cache removes documents from the AMP Caches
  • version: shows the current AMP Toolbox version

Installation

Install via:

$ npm install @ampproject/toolbox-cli -g

Commands

curls

Translate a URL to AMP Cache URLs:

$ amp curls https://amp.dev

download

Download a complete AMP runtime:

$ amp download

Supports options for specifying a custom host, version, and destination directory. See amp help download for the complete list.

help

Displays the help menu, listing all available commands:

$ amp help

Pass a command to get more information about this specific command

$ amp help [command]

Example:

$ amp help update-cache

lint

Runs the AMP Linter for the given URL:

$ amp lint https://amp.dev

optimize

Runs AMP Optimizer for the given file or URL:

$ amp optimize https://amp.dev

or

$ amp optimize file.html

runtime-version

Prints the current AMP version:

$ amp runtime-version
=> 011905291911450

Supports options for specifying a custom host or getting the canary version. See amp help runtime-version for the complete list.

update-cache

Uses the AMP update-cache API to update documents stored in AMP Caches.

It requires the public and private keys to be generated, as described on the documentation. Only the private key is required to generate the cache invalidation URLs, but the public key must be made available to the AMP Caches, as described in the guidelines.

By default, the application will look for the private key on a file called privateKey.pem, on the current working directory.

$ amp update-cache https://www.example.com/

Optionally, use the --privateKey parameter to specify the path for the private key.

$ amp update-cache https://www.example.com/ --privateKey /path/to/private-key.pem

version

Prints the current AMP Toolbox version:

$ amp version

=> v2.7.6

Keywords

FAQs

Last updated on 23 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc