Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
compsizer is a tool designed to analyse the size of component bundles in your project. It helps you ensure your component sizes are within acceptable limits by comparing them against baselines and showing size increases across builds. You can also configure gzip and Brotli compression checks.
You can install compsizer
locally in your project.
npm install compsizer --save-dev
Once installed, you can use the command compsizer
in your project.
You can run the tool from the command line either with the default configuration file or by specifying a custom configuration file.
If you use the default configuration file name compsizer.config.json
, simply run:
npx compsizer
If your configuration file is located elsewhere or has a different name, use:
npx compsizer --config path/to/your-config-file.json
package.json
You can add a script in your package.json
for convenience:
{
"scripts": {
"analyse-component-bundles": "compsizer --config path/to/your-config-file.json"
}
}
Then run it via:
npm run analyse-component-bundles
You need to create a configuration file (default: compsizer.config.json
) that specifies the inclusion/exclusion patterns for files, size limits, and compression options.
compsizer.config.json
){
"exclude": ["src/**/*.test.js"],
"compression": {
"gzip": true,
"brotli": true
},
"baselineFile": "baseline.json",
"components": {
"Button": {
"maxSize": "20KB",
"warnOnIncrease": "5%",
"include": ["src/components/Button/dist/**/*.js"],
"exclude": []
},
"Modal": {
"maxSize": "50KB",
"warnOnIncrease": "10%",
"include": ["src/components/Modal/dist/**/*.js"],
"exclude": []
}
},
"defaults": {
"warnOnIncrease": "5%"
}
}
gzip
: (boolean) Set to true
to calculate gzip sizes.brotli
: (boolean) Set to true
to calculate Brotli sizes.maxSize
: (string) The maximum allowable size for the component (e.g., 20KB
, 500KB
).warnOnIncrease
: (string) Warn if the size increases by more than the specified percentage.include
: (array) Glob patterns specific to the component to include.exclude
: (array) Glob patterns specific to the component to exclude. (Overrides the base exclude)warnOnIncrease
: (string) Default warning threshold for size increases.The tool generates a report of the component sizes, whether they exceed limits, and how they compare to baseline sizes. It also updates the baseline file after each run.
Example output:
Component Bundle Sizes Report
Component: Button
Total Size: 19.45 KB
Gzip Size: 5.12 KB
Brotli Size: 4.01 KB
Within max size limit of 20KB
Size increase of 4.8% since last recorded size is within threshold of 5%
Component: Modal
Total Size: 48.78 KB
Gzip Size: 12.34 KB
Brotli Size: 10.24 KB
Within max size limit of 50KB
Size increase of 2.5% since last recorded size is within threshold of 10%
If any component exceeds its size threshold or size increase percentage, the tool will print a warning and exit with a non-zero status code.
This project is licensed under the MIT License.
[0.2.0] - 18-10-2024
compsizer.config.json
FAQs
A tool for analysing the size of component packages in your monorepo.
The npm package compsizer receives a total of 1 weekly downloads. As such, compsizer popularity was classified as not popular.
We found that compsizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.