ericcornelissen/webmangler

Improve reporters support for CLI

Closed this issue · 0 comments

Feature Request

packages/cli, v0.1.7

Description

The CLI currently has only one "reporter" that provides on overview of the optimizations per file, the overall optimization, and the duration, in a human-readable format.

If you have any suggestions or ideas regarding reporters for the WebMangler CLI, please leave a comment on this issue.

Proposal

The end-goals is to offer a couple of built-in reporters and support reporters as plugins as well. It should be possible to use multiple reporters at once (e.g. human-readable on the CLI and also a JSON file to disk).

Built-in Reporters

Status PRs
Done #270, #315

Offer a couple of built-in reporters. At least:

  • A human-readable reporter (#2, #270)
  • A JSON reporter (#315)

Reporter Plugins

Status PRs
Done #291

Add support for reporter plugins. These should be configurable in the configuration file like:

// .webmanglerrc.js

module.exports = {
  plugins: [ /* normal plugins */ ],
  languages: [ /* language plugins */ ],
  reporters: [
    /* one or more reporter plugins */
  ],
};

Import Built-in Reporter

Status PRs
Done #318

It should be possible to use the built-in reporters here as well, e.g.:

// .webmanglerrc.js

const { DefaultReporter } = require("webmangler-cli/reporters");

module.exports = {
  plugins: [ /* normal plugins */ ],
  languages: [ /* language plugins */ ],
  reporters: [
    new DefaultReporter(),
    /* (optional) other reporters */
  ],
};

Related Issues & Pull Requests