shakify
Version:
π Smart Tree-shaking Analyzer for npm packages
92 lines (83 loc) β’ 3.46 kB
Markdown
# πͺ© shakify [](https://www.npmjs.com/package/shakify) [](https://npmjs.org/package/shakify)
> π A CLI tool to shake the truth out of your npm packages
## π‘ What is this?
**`shakify`** is your bundleβs personal trainer.
It inspects npm packages and tells you:
- πͺΆ Is it tree-shakeable?
- π Is it ESM or just CommonJS in disguise?
- π¦ How heavy are each of its exports?
In other words β it **helps you avoid bloated bundles** by letting you pick smarter, leaner dependencies.
> Think of it as a lie detector for npm modules that *claim* to be lightweight.
## β¨ Features
- β
Detects tree-shaking support
- π Shows ESM vs CommonJS support
- π¦ Analyzes per-export size (raw + gzipped)
- β‘ Caches results (with manual clearing via `--clear-cache`)
- π¦ Downloads and inspects real published packages (not guesswork)
- π CLI spinner magic for extra drama
## π οΈ Install
```bash
npm install -g shakify
```
## π Usage
```bash
npx shakify-cli <package-name>
```
### Example:
```bash
npx shakify-cli lodash-es
```
### To clear cached results:
```bash
npx shakify-cli react --clear-cache
```
## πΌ Sample Output
```
=== Package Analysis: lodash-es@4.17.21 ===
ESM Support: true
CommonJS Support: false
Side Effects Flag: false
Tree-shakeable: true
Cached Result: false
Export sizes:
. | Size: 6248 bytes | Gzipped: 1931 bytes
/debounce | Size: 882 bytes | Gzipped: 410 bytes
/throttle | Size: 768 bytes | Gzipped: 390 bytes
```
## π¦ Real Benefits
shakify helps you:
- β
Avoid packages that canβt be tree-shaken
- β
Spot fat exports before they hit your bundle
- β
Replace bloated deps with slimmer alternatives
- β
Make smarter decisions during package selection
- β
Sleep better knowing your JS is lean and mean π€
## π§ Ideal for...
- Frontend devs who care about performance
- Framework authors and lib maintainers
- CI/CD optimization nerds
- You (yes, you reading this π)
## π Caching
Shakify caches results in your systemβs temp directory.
### Want to refresh the results?
```bash
npx shakify-cli <package-name> --clear-cache
```
Shakify doesnβt judge β it just snitches π¦βοΈ
This is a tool for the devs who check bundle sizes like others check calories.
If thatβs you β welcome, friend. Let's keep those kilobytes lean and those load times snappy.
If you enjoy it, share it. If it breaks, yell at your terminal (or open an issue, whichever works).
Stay lightweight. Stay skeptical. Stay shakified πͺ©
## βοΈ Note from the Author
This all started with a simple question:
**"Why is my bundle bigger than my app?"**
Turns out, not all npm packages are what they seem. Some are lean, modular marvels. Others are⦠well, more like vending machines that give you the entire aisle.
So I built **shakify** β a tool to sniff out the truth behind the `node_modules` curtain.
Whether you're optimizing your Next.js app, squeezing bytes out of a landing page, or just enjoy yelling at JavaScript in different ways, `shakify` is here to help.
It won't fix all your problems, but it might make you think twice before importing `moment.js` π
β *[cinfinit](https://github.com/cinfinit)*
π¦ Built with curiosity, and you know more curiosity.