Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

anta

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anta

CLI tool and lib to gather app audits via [Lighthouse](https://github.com/GoogleChrome/lighthouse/).

  • 0.0.4
  • npm
  • Socket score

Version published
Weekly downloads
66
increased by842.86%
Maintainers
1
Weekly downloads
 
Created
Source

ant audits

CLI tool and lib to gather app audits via Lighthouse. IN BETA.

函数开发见文档

$ npm i

CLI Usage

$ anta <url> <flags>
$ anta --help

anta https://mobile.ant.design/kitchen-sink/

# --runs=n     Does n runs (eg. 3, 5), and reports the median run's numbers.
#              Median run selected by run with the median TTI.
anta https://mobile.ant.design/kitchen-sink/ --runs=3

# --json       Reports json details to stdout.
anta https://mobile.ant.design/kitchen-sink/ --json

# --output-path       File path to save results.
anta https://mobile.ant.design/kitchen-sink/ --json --output-path='./lh-report.json'

# --config        Provide configuration (defaults to `package.json`). See _Defining config_ below.
anta --config=anta-config.js

# --expectations  Assert metrics results against provides values.
# run anta with config in package.json
anta --expectations

All available configuration options

# run anta with config in package.json
anta --config

package.json

...
  "anta": {
    "url": "http://example.com/",
    // other configuration options
    "expectations": {
      ...
    }
  }
...

anta-config.js

module.exports = {
  url: 'http://example.com/',
  flags: { // AKA feature flags
    runs: '3', // number or runs
    // submit: true, // turn on submitting to Google Sheets
    // upload: true, // turn on uploading to Google Drive
    // view: true, // open uploaded traces to Google Drive in DevTools
    expectations: true // turn on assertation metrics results against provides values
    chromePath: '/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary' //optional path to specific Chrome location
    chromeFlags: [] // custom flags to pass to Chrome. For a full list of flags, see http://peter.sh/experiments/chromium-command-line-switches/.
    // Note: supports all flags from Lighthouse
  },
  expectations: {
    // these expectations values are examples, for your cases set your own
    // it's not required to use all metrics, you can use just a few of them
    // Read _Available metrics_ where all keys are defined
    ttfcp: {
      warn: '>=1500',
      error: '>=2000'
    },
    ttfmp: {
      warn: '>=2000',
      error: '>=3000'
    },
    fv: {
      ...
    },
    psi: {
      ...
    },
    vc85: {
      ...
    },
    vs100: {
      ...
    },
    ttfi: {
      ...
    },
    ttci: {
      ...
    }
  }
}
# run anta with config in anta-config.js
anta --expectations --config=anta-config.js
Available metrics:
  • ttfcp - First Contentful Paint

  • ttfmp - First Meaningful Paint

  • psi - Perceptual Speed Index

  • fv - First Visual Change

  • vc - Visually Complete 100%

  • ttfi - First Interactive (vBeta)

  • ttci - Time to Consistently Interactive (vBeta)

  • vc85 - Visually Complete 85%

  • dom-size - dom size

Read article Performance metrics. What’s this all about? or 前端感官性能的衡量和优化实践 which is decoding this metrics.

API

const Metrics = require('anta');

const options = {
  flags: {
    runs: '3', // number or runs
    // submit: true, // turn on submitting to Google Sheets
    // upload: true, // turn on uploading to Google Drive
    // view: true, // open uploaded traces to Google Drive in DevTools
    expectations: true // turn on assertation metrics results against provides values
    chromeFlags: [
      '--headless' // run in headless Chrome
    ]
  }
};

const pwMetrics = new Metrics('http://example.com/', options); // _All available configuration options_ can be used as `options`
pwMetrics.start(); // returns Promise

Recipes

Keywords

FAQs

Package last updated on 02 Feb 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc