JSPM

@percy/cli-command

1.0.0-beta.48
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 455080
  • Score
    100M100P100Q245939F
  • License MIT

Package Exports

  • @percy/cli-command

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@percy/cli-command) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@percy/cli-command

The base command class that Percy CLI commands should extend from. Adds commonly used configuration options to Percy config files, a #percyrc() method for parsing config files, and other shared methods. Also provides common CLI flags along with oclif flag functions.

Usage

import PercyCommand, { flags } from '@percy/cli-command'

export class PercyPlugin extends PercyCommand {
  static flags = {
    ...flags.logging,
    ...flags.discovery,
    ...flags.config
  }

  run() {
    let { args, flags } = this
    let { snapshot, discovery } = this.percyrc()
    // ...
  }

  finally() {
    // called after #run() and also on process termination events
  }
}

Mapping CLI Flags

The #percyrc() method will parse command flags for Percy configuration mappings as determined by a percyrc flag configuration option.

'allowed-hostnames': flags.string({
  // maps the --allowed-hostnames flag to the corresponding config option
  percyrc: 'discovery.allowedHostnames'
})