A command-line tool built with Bun to analyze the size of your GitHub packages. This tool helps you track the size of your npm packages hosted on GitHub Package Registry, including their dependencies and historical versions.
This tool was created to help developers manage their GitHub Package Registry storage more effectively, especially considering GitHub Pro's 2GB storage limit. By analyzing package sizes and their dependencies, you can:
- Monitor your storage usage to avoid hitting the 2GB limit
- Identify which packages and versions consume the most space
- Make informed decisions about package retention and cleanup
- Optimize package sizes before publishing
- Lists all npm packages from your GitHub Package Registry
- Analyzes multiple versions of each package
- Shows package size, dependencies size, and total size
- Displays download count for each version
- Presents data in an easy-to-read table format
- Bun installed on your system
- GitHub Personal Access Token with
read:packages
scope - Access to GitHub Package Registry
- Clone this repository:
git clone <repository-url>
cd <repository-name>
- Install dependencies:
bun install
Set your GitHub token as an environment variable:
export GITHUB_TOKEN='your-github-token'
Note: Make sure your token has the
read:packages
scope enabled.
Run the analyzer:
bun run start
The tool will:
- Fetch all your npm packages from GitHub Package Registry
- Download and analyze each version
- Display a table with the following information:
- Package name
- Version number
- Package size
- Dependencies size
- Total size
- Download count
- Creation date
========================================================================================================================
Package Name Version Package Size Deps Size Total Size Downloads Created At
========================================================================================================================
@username/package-name 1.2.0 123 kB 456 kB 579 kB 42 1/1/2024
1.1.0 120 kB 450 kB 570 kB 35 12/1/2023
------------------------------------------------------------------------------------------------------------------------
@username/another-package 2.0.0 234 kB 567 kB 801 kB 56 1/2/2024
------------------------------------------------------------------------------------------------------------------------
- If
GITHUB_TOKEN
is not set, the tool will exit with an error message - If a package or version fails to analyze, the error will be logged, but the tool will continue with remaining packages
- Temporary files are automatically cleaned up, even if errors occur
Feel free to open issues or submit pull requests for improvements.
MIT License - feel free to use and modify as needed.