Repository navigation
feat: add @node-cli/bundlecheck package - #474
Merged
Merged
Conversation
Introduce a new CLI package to analyze npm package bundle sizes. Adds package metadata and README, TypeScript sources (CLI entry, bundler, parser, defaults), and build/test configs (.swcrc, tsconfig, vitest.config.ts). The tool uses esbuild to produce minified bundles and reports raw and gzip sizes, with support for selecting exports and marking externals.
There was a problem hiding this comment.
Pull request overview
Adds a new @node-cli/bundlecheck CLI package for measuring npm package bundle sizes (raw + gzip), including interactive version selection and multi-version “trend” output.
Changes:
- Introduces the new
packages/bundlecheckworkspace package (CLI entrypoint, bundling logic via esbuild, version fetching/prompting, trend rendering). - Adds Vitest configuration and a fairly comprehensive unit test suite for the bundler, versions, and trend logic.
- Updates
pnpm-lock.yamlto include the new package and its dependency graph.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds lockfile entries for the new bundlecheck package and updated dependency resolutions. |
| packages/bundlecheck/vitest.config.ts | Vitest + coverage configuration for the new package. |
| packages/bundlecheck/tsconfig.json | TypeScript build config for generating declarations. |
| packages/bundlecheck/src/versions.ts | Fetches package versions from npm and prompts for interactive selection. |
| packages/bundlecheck/src/trend.ts | Computes and renders multi-version bundle size trends. |
| packages/bundlecheck/src/parse.ts | CLI argument/flag parsing via @node-cli/parser. |
| packages/bundlecheck/src/defaults.ts | Defines default CLI flag values and constants. |
| packages/bundlecheck/src/bundler.ts | Core bundling logic (temp install, entry generation, esbuild bundle, gzip sizing). |
| packages/bundlecheck/src/bundlecheck.ts | CLI entrypoint wiring parsing → analysis → output. |
| packages/bundlecheck/src/tests/versions.test.ts | Tests for npm registry version fetching and interactive prompt behavior. |
| packages/bundlecheck/src/tests/trend.test.ts | Tests for trend selection, analysis, and rendering. |
| packages/bundlecheck/src/tests/bundler.test.ts | Tests for package spec parsing and bundling behavior with extensive mocking. |
| packages/bundlecheck/package.json | Package metadata, bin entry, scripts, and dependencies. |
| packages/bundlecheck/README.md | User-facing documentation for installing and using bundlecheck. |
| packages/bundlecheck/.swcrc | SWC build configuration for transpiling TS sources to dist. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Parse and preserve package subpaths from the package specifier. Construct a fullPackagePath (name[/subpath]) and use it for trend analysis and graph rendering so subpaths are not lost. Also rebuild the package specifier when a version is selected to keep any subpath (e.g. name/subpath@version).
Update packages/bundlecheck/package.json to require Node.js >=20 (previously >=18). This raises the minimum Node version for the bundlecheck package to align with updated runtime requirements and ensure compatibility with newer language/runtime features.
Set kleur.enabled = !flags?.boring so ANSI colors are disabled when the --boring flag is used. This change is applied before Logger is constructed to ensure color output is consistently turned off for subsequent logging and CLI output.
Ensure gzip and raw trend values always display an explicit sign. Change uses >= 0 to prefix a '+' for zero/positive values and formats negative values with '-' plus the absolute byte value to avoid double-negative output and keep sign presentation consistent for both gzip and raw sizes.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a new CLI package to analyze npm package bundle sizes. Adds package metadata and README, TypeScript sources (CLI entry, bundler, parser, defaults), and build/test configs (.swcrc, tsconfig, vitest.config.ts). The tool uses esbuild to produce minified bundles and reports raw and gzip sizes, with support for selecting exports and marking externals.