🕵️ Code PushUp plugin for detecting changes in file size using different compressions 📋
The plugin crawls the file base depending on your configuration and reports about their file size.
You can configure the plugin with the following options:
- directory to crawl
- file name pattern
- budget as number in bytes
-
If you haven't already, install @code-pushup/cli and create a configuration file.
-
Copy the plugin source as is into your project
-
Add this plugin to the
pluginsarray in your Code PushUp CLI config file (e.g.code-pushup.config.js).Pass in the path on the directory to crawl (relative to
process.cwd()), as well as patterns and a budget.import fileSizePlugin from './file-size.plugin'; export default { // ... plugins: [ // ... fileSizePlugin({ directory: 'dist', patterns: /.js$/, budget: 42000, }), ], };
-
(Optional) Reference audits (or groups) that you wish to include in custom categories (use
npx code-pushup print-configto list audits and groups).Assign weights based on what influence each audit and group should have on the overall category score (assign weight 0 to only include it for extra info, without influencing the category score).
import fileSizePlugin, { recommendedRefs as fileSizeRecommendedRefs } from './file-size.plugin'; export default { // ... categories: [ // ... { slug: 'performance', title: 'Performance', refs: [...fileSizeRecommendedRefs], }, ], };
-
Run the CLI with
npx code-pushup collectand view or upload report (refer to CLI docs).
Detailed information about the audits can be found in the docs folder of the plugin.
The following audits are present:
- [file-size-unmodified](@TODO - link to docs/file-size-unmodified.audit.md)