{"id":16528296,"url":"https://github.com/adrieankhisbe/bundle-phobia-cli","last_synced_at":"2025-04-05T12:09:15.914Z","repository":{"id":39707311,"uuid":"103224473","full_name":"AdrieanKhisbe/bundle-phobia-cli","owner":"AdrieanKhisbe","description":"📦 Cli for the node BundlePhobia Service 😱","archived":false,"fork":false,"pushed_at":"2024-06-16T09:53:44.000Z","size":1115,"stargazers_count":183,"open_issues_count":5,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T11:11:21.614Z","etag":null,"topics":["bundlephobia","cli","hacktoberfest","npm"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdrieanKhisbe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-12T05:02:22.000Z","updated_at":"2025-03-09T03:00:10.000Z","dependencies_parsed_at":"2024-06-18T15:45:02.514Z","dependency_job_id":null,"html_url":"https://github.com/AdrieanKhisbe/bundle-phobia-cli","commit_stats":{"total_commits":237,"total_committers":9,"mean_commits":"26.333333333333332","dds":0.05063291139240511,"last_synced_commit":"12122e2fec3a2b64b06ee0214c9698b32d54432b"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrieanKhisbe%2Fbundle-phobia-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrieanKhisbe%2Fbundle-phobia-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrieanKhisbe%2Fbundle-phobia-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrieanKhisbe%2Fbundle-phobia-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdrieanKhisbe","download_url":"https://codeload.github.com/AdrieanKhisbe/bundle-phobia-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332612,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundlephobia","cli","hacktoberfest","npm"],"created_at":"2024-10-11T17:39:03.685Z","updated_at":"2025-04-05T12:09:15.891Z","avatar_url":"https://github.com/AdrieanKhisbe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bundle-phobia-cli\n\n[![npm](https://img.shields.io/npm/v/bundle-phobia-cli.svg)](https://www.npmjs.com/package/bundle-phobia-cli)\n[![Build Status](https://travis-ci.com/AdrieanKhisbe/bundle-phobia-cli.svg?branch=master)](https://travis-ci.com/AdrieanKhisbe/bundle-phobia-cli)\n[![codecov](https://codecov.io/gh/AdrieanKhisbe/bundle-phobia-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/AdrieanKhisbe/bundle-phobia-cli)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n\u003e Cli for the node [BundlePhobia](https://bundlephobia.com/) Service\n\n## About\n\n[BundlePhobia](https://bundlephobia.com/) is a tool to help you _find the cost of adding a npm package to your bundle_.\nIt enables you to query package sizes.\n\n## Installation\n\nJust use `npm install -g bundle-phobia-cli` and you're good to go!\n\n## Usage\n\nOnce installed you will have access to different executables:\n- `bundle-phobia`: to query package size.\n   Just invoke it with a list of package names and some options.\n- `bundle-phobia-install`: to conditionally install package if weight constraint are respected. This is a wrapper on `npm install`\n\nNote that you can specify a version along with the package range such as an\ninstance exact version `lodash@4.12.0` or range version `ora@^3.0.0`.\n\n### Examples\n```bash\n# Query package size of lodash and react\n$ bundle-phobia lodash react\nℹ lodash (4.17.11) has 0 dependencies for a weight of 68.51KB (24.05KB gzipped)\nℹ react (16.6.0) has 4 dependencies for a weight of 5.86KB (2.48KB gzipped)\n\n# Perform conditional install of lodash\n$ bundle-phobia-install lodash\nℹ Applying a size limit of 100KB\nℹ Proceed to installation of package lodash\n+ lodash@4.17.11\nadded 1 package from 2 contributors and audited 1 package in 1.377s\nfound 0 vulnerabilities\n```\n\n\n### Detailed Usage\n#### `bundle-phobia`\n\nSome option are available to control what stats are outputed by `bundle-phobia`.\n\nBy default an humain friendly output is provided, otherwise you can have a json output\nwith the `--json` flag. In case you need just the size (or gzip) in a script, you can\nuse the `--[gzip]-size` flag.\n\nTo control the packages to be queried, you can either provide them as an argument list,\nor you can refer a `package.json` file with the `--package` option. This would read the\npackages as `dependencies`.\nYou can also provide a folder to `-p` (including `.`). This would look for `package.json` in that folder.\n\n##### Options Summary\n```\nUsage: bundle-phobia \u003cpackage-name\u003e [other-package-names...]\n\nOptions:\n  --version           Show version number                              [boolean]\n  --package, -p       Provide a package.json to read dependencies       [string]\n  --range, -r         Get a range of version (0 for all, 8 by default)  [number]\n  --json, -j          Output json rather than a formater string        [boolean]\n  --size, -s          Output just the module size                      [boolean]\n  --gzip-size, -g     Output just the module gzip size                 [boolean]\n  --dependencies, -d  Output just the number of dependencies           [boolean]\n  --self              Output bundle-phobia stats                       [boolean]\n  -h, --help          Show help                                        [boolean]\n```\n#### `bundle-phobia-install`\n\n`bundle-phobia-install` offer three kind of flags:\n- flags to specify the size constraints\n- flags to specify behavior when constraints are not respected\n- npm install flags to control it's behavior\n\nTo control the size constraint of a single package: `--max-size` and `--max-gzip-size` aliases to `-m` and `-M`.\nTo control the overall size of dependencies: `--max-overall-size` and `--max-overall-gzip-size` aliases to `-o` and `-O`.\nThey expect a size argument that can be either a number or a number followed by a `kB`, `mB` unit.\n\nBy default if constraint is not respected, install with failed.\nIf you want to perform anyway with just a warning use the `--warn`/`-w` flag.\nIf you want to be asked what to do, use the `--interactive`/`-i`.\n\nAll other options will be conveyed to `npm`.\n\nLimits can also be configured in the `package.json` by adding a `bundle-phobia` section with a `max-[gzip-]size` key.\n```json\n{\n  \"name\": \"bundle-phobia-install-test\",\n  \"dependencies\": {},\n  \"bundle-phobia\": {\n    \"max-size\": \"12kB\",\n    \"max-overall-size\": \"1MB\"\n  }\n}\n```\n\n##### Options Summary\n\n```\nUsage: bundle-phobia-install \u003cpackage-name\u003e [other-package-names...]\n\nOptions:\n  --version            Show version number                             [boolean]\n  --warn, -w           Install despite of negative check but warn about\n                       predicate violation                             [boolean]\n  --interactive, -i    Ask for override in case of predicate violation [boolean]\n  --max-size, -m       Size threeshold of individual library to install [string]\n  --max-gzip-size, -M  Gzip Size threeshold of individual library to install\n                                                                        [string]\n  -h, --help           Show help                                       [boolean]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrieankhisbe%2Fbundle-phobia-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrieankhisbe%2Fbundle-phobia-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrieankhisbe%2Fbundle-phobia-cli/lists"}