{"_id":"@berkinduz/bundle-sheriff","name":"@berkinduz/bundle-sheriff","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@berkinduz/bundle-sheriff","version":"0.0.1","description":"Analyze build artifacts (JS/CSS), calculate sizes (Raw, Gzip, Brotli), and enforce performance budgets.","type":"module","license":"MIT","author":{"name":"Berkin Duz"},"repository":{"type":"git","url":"git+https://github.com/berkinduz/bundle-sheriff.git"},"main":"dist/index.js","exports":{".":"./dist/index.js"},"keywords":["bundle","size","gzip","brotli","budget","ci","cli"],"bin":{"bundle-sheriff":"dist/index.js"},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest","typecheck":"tsc --noEmit","start":"node dist/index.js","check":"node dist/index.js check","postbuild":"chmod +x dist/index.js || true","prepare":"npm run build","prepublishOnly":"npm run build"},"engines":{"node":">=18"},"dependencies":{"brotli-size":"4.0.0","bytes":"3.1.2","cac":"6.7.14","cli-table3":"0.6.5","fast-glob":"3.3.3","gzip-size":"7.0.0","picocolors":"1.1.1","unconfig":"7.4.2"},"devDependencies":{"@types/node":"25.0.2","tsup":"8.5.1","typescript":"5.9.3","vitest":"4.0.15"},"gitHead":"715850ce5a86ac99ca6dcfd8f353886fcd810b44","_id":"@berkinduz/bundle-sheriff@0.0.1","bugs":{"url":"https://github.com/berkinduz/bundle-sheriff/issues"},"homepage":"https://github.com/berkinduz/bundle-sheriff#readme","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-1MZP73oK2orOxDBQVXhqM0PPXf8Rs8MJ92dE1xubJc9ZaNcwJK8fMH3Mq8mkxAzqabOwgKWSvy2jVon1DIpJrA==","shasum":"31bcd33e2cee622940d8409443aa2b94e6cf00b4","tarball":"https://registry.npmjs.org/@berkinduz/bundle-sheriff/-/bundle-sheriff-0.0.1.tgz","fileCount":5,"unpackedSize":18051,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGKsKrAD5ecJ2rqhHbB3kbywstex7vi2t5700fc8Ta8TAiBN3jKJ0NwrnwwvnO3ni9g2i8/MFo5MWpvbl7VmRmKsWw=="}]},"_npmUser":{"name":"berkinduz","email":"mberkinduz@gmail.com"},"directories":{},"maintainers":[{"name":"berkinduz","email":"mberkinduz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bundle-sheriff_0.0.1_1765867598434_0.21079447283235053"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-16T06:46:38.351Z","0.0.1":"2025-12-16T06:46:38.580Z","modified":"2025-12-16T06:46:38.830Z"},"maintainers":[{"name":"berkinduz","email":"mberkinduz@gmail.com"}],"description":"Analyze build artifacts (JS/CSS), calculate sizes (Raw, Gzip, Brotli), and enforce performance budgets.","homepage":"https://github.com/berkinduz/bundle-sheriff#readme","keywords":["bundle","size","gzip","brotli","budget","ci","cli"],"repository":{"type":"git","url":"git+https://github.com/berkinduz/bundle-sheriff.git"},"author":{"name":"Berkin Duz"},"bugs":{"url":"https://github.com/berkinduz/bundle-sheriff/issues"},"license":"MIT","readme":"# bundle-sheriff · Stop shipping bloat.\n\n![License](https://img.shields.io/badge/License-MIT-blue.svg)\n![npm](https://img.shields.io/npm/v/bundle-sheriff.svg)\n![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178c6?logo=typescript)\n\n`bundle-sheriff` is a zero-config-needed CLI that keeps your bundles lean. It scans your built JS/CSS, measures Raw/Gzip/Brotli sizes, and fails CI when budgets are exceeded—preventing regressions before they hit production.\n\n## Why bundle-sheriff?\n\n- Performance budgets catch bloat before customers do.\n- Automated, repeatable checks in CI stop silent regressions.\n- Works with any bundler—just point it at your build output.\n\n## Features\n\n- Compression support: Raw, Gzip, and Brotli measurements\n- CI/CD ready: non-zero exit on failures\n- Zero config by default, fully configurable via `sheriff.config.*`\n- TypeScript-first codebase and typings\n\n## Installation\n\n```bash\nnpm install -D bundle-sheriff\n```\n\n## Usage\n\nRun directly (no global install required):\n\n```bash\nnpx bundle-sheriff check\n```\n\nWhat you’ll see (example):\n\n```\n┌──────────────────────┬─────────────┬────────┬────────┬────────┐\n│ File                 │ Compression │ Actual │ Limit  │ Passed │\n├──────────────────────┼─────────────┼────────┼────────┼────────┤\n│ dist/app.js          │ gzip        │ 12.3 kB│ 20 kB  │ yes    │\n│ dist/styles.css      │ brotli      │ 9.1 kB │ 8 kB   │ no     │\n└──────────────────────┴─────────────┴────────┴────────┴────────┘\n```\n\nExit codes: 0 when all budgets pass; 1 when any rule fails or no rules are defined (to keep CI strict).\n\n## Configuration (important)\n\nCreate `sheriff.config.ts` (or `.js`/`.json`) in your project root:\n\n```ts\n// sheriff.config.ts\nexport default {\n  rules: [\n    {\n      // Glob(s) of files to check\n      path: \"dist/**/*.js\",\n      // Human-friendly budget (parsed with bytes)\n      maxSize: \"150kb\",\n      // Which size to compare: raw | gzip | brotli (default: gzip)\n      compression: \"gzip\",\n    },\n    {\n      path: \"dist/**/*.css\",\n      maxSize: \"120kb\",\n      compression: \"brotli\",\n    },\n  ],\n};\n```\n\n`BundleRule` interface:\n\n```ts\ninterface BundleRule {\n  path: string; // Glob pattern for files to check\n  maxSize: string; // e.g., \"150kb\", \"1.2mb\"\n  compression?: \"raw\" | \"gzip\" | \"brotli\"; // default: 'gzip'\n}\n```\n\n## CI/CD Integration\n\nAdd a GitHub Actions workflow (runs after your build):\n\n```yaml\nname: bundle-sheriff\n\non:\n  pull_request:\n  push:\n\njobs:\n  check-budgets:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 18\n          cache: npm\n      - run: npm ci\n      - run: npm run build # your app build that emits dist/\n      - run: npx bundle-sheriff check\n```\n\nCI will fail fast if any bundle exceeds its budget.\n\n## Roadmap\n\n- Framework adapters (Next.js, Vite, Remix) for zero-setup defaults\n- Historical tracking to detect regressions over time\n- Machine-readable reports (JSON) for custom dashboards\n\n---\n\nStop shipping bloat. Keep your budgets honest with `bundle-sheriff`.\n","readmeFilename":"README.md","_rev":"1-58f635235c63c4a66ece4463e4ff166e"}