Comparing version 0.5.2 to 0.6.0-beta.0
@@ -247,3 +247,10 @@ class BundleSizeAnalyser { | ||
async analyseComponents(config) { | ||
const { exclude, compression, baselineFile, components, defaults } = config; | ||
const { exclude, compression = {}, baselineFile, components, defaults } = config; | ||
// Set default compression values to true if not provided | ||
const compressionOptions = { | ||
gzip: compression.gzip !== undefined ? compression.gzip : true, | ||
brotli: compression.brotli !== undefined ? compression.brotli : true, | ||
}; | ||
const baselineSizes = await this.loadBaseline(baselineFile); | ||
@@ -278,3 +285,3 @@ | ||
const indexJsSizeResults = await this.calculateSizes(indexJsFiles, compression); | ||
const indexJsSizeResults = await this.calculateSizes(indexJsFiles, compressionOptions); | ||
this.results[`${componentName}/index.js`] = this.compareSizes( | ||
@@ -316,3 +323,3 @@ indexJsSizeResults, | ||
const indexOtherFiles = [...indexJsFiles, ...otherJsFiles]; | ||
const indexOtherSizeResults = await this.calculateSizes(indexOtherFiles, compression); | ||
const indexOtherSizeResults = await this.calculateSizes(indexOtherFiles, compressionOptions); | ||
this.results[`${componentName}/index.js + other JS`] = this.compareSizes( | ||
@@ -319,0 +326,0 @@ indexOtherSizeResults, |
@@ -8,2 +8,8 @@ # Changelog | ||
## [0.6.0-beta.0] - 01-11-2024 | ||
### Changed | ||
- Make compression config options optional and default both gzip and brotli to true | ||
## [0.5.2] - 01-11-2024 | ||
@@ -10,0 +16,0 @@ |
{ | ||
"name": "compsizer", | ||
"version": "0.5.2", | ||
"version": "0.6.0-beta.0", | ||
"description": "A tool for analysing the size of component packages in your monorepo.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -87,3 +87,3 @@ | ||
], | ||
"compression": { | ||
"compression": { // Optional compression options | ||
"gzip": true, | ||
@@ -111,4 +111,4 @@ "brotli": true | ||
- **compression**: (object) Specify whether to calculate gzip and Brotli compressed sizes. | ||
- `gzip`: (boolean) Set to `true` to calculate gzip sizes. | ||
- `brotli`: (boolean) Set to `true` to calculate Brotli sizes. | ||
- `gzip`: (boolean) OPTIONAL: Set to `true` to calculate gzip sizes (defaults to true). | ||
- `brotli`: (boolean) OPTIONAL: Set to `true` to calculate Brotli sizes (defaults to true). | ||
- **baselineFile**: (string) Path to the JSON file where the baseline sizes are stored. | ||
@@ -115,0 +115,0 @@ - **components**: (object) Configuration for each component. Each key corresponds to a component name. |
@@ -5,6 +5,2 @@ { | ||
], | ||
"compression": { | ||
"gzip": true, | ||
"brotli": true | ||
}, | ||
"components": { | ||
@@ -11,0 +7,0 @@ "testComponent": { |
131391
4078