Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.7 KB

File metadata and controls

37 lines (25 loc) · 1.7 KB

webpack-bundle-delta Data Sources

Data sources provide a uniform way of consuming the webpack compilation statistics, as well as reporting back to them (todo).

As not all teams/organisations will have the same approach, having a uniform way allows for greatly flexibility for this plugin to be used.

Implementing and extending

Every data source should do the following:

  • Create a class extending the BaseDataSource:
    • implement getCompilationStats() in the extending base class
      • Failure to do so will cause an error to be thrown
      • Use this.validateCompilationStats to validate the data (ensuring the correct webpack stats properties are there)
      • Return the stats
    • make this the default export in the folder's index.ts file
  • Implement a cli.ts which follows the CliProgram interface:

If a data source requires extending, or a new data source is needed please feel free to raise a PR (more the merrier).

Present data sources:

Usage

All data sources are accessible via the root import, as <name>DataSource (i.e. TeamCity is available as TeamCityDataSource):

import { TeamCityDataSource } from 'webpack-bundle-delta';

Create an instance of the data source passing it the necessary options, and pass it to the danger command.