Add PR check reporting npm package size changes - #4918
Draft
timotheeguerin wants to merge 1 commit into
Draft
Conversation
Adds a PR workflow that measures the published npm tarball size (packed and unpacked) of every publishable workspace package at the PR head and base, then posts a sticky comment with the per-package size delta. Purely informational; never fails the check.
Contributor
|
No changes needing a change description found. |
Contributor
|
You can try these changes here
|
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.
Summary
Adds a PR check that reports how a change affects the published npm package size of the workspace libraries and posts the result as a sticky comment. Purely informational — it never fails the check.
Since these TypeSpec libraries are not bundled (they build with
tscand publishdist/**), "size" here is the npm tarball thatnpm packproduces — both packed (gzipped.tgz) and unpacked sizes.How it works
Two workflows, following the secure two-stage pattern already used by
core/.github/workflows/commenter.yml(so it works for fork PRs without exposing a write token to untrusted code):package-size.yml(pull_request, read-only, scoped viapaths:) — builds + measures the PR head, checks out the base commit, builds + measures it, diffs the two, and uploads the rendered comment as an artifact.package-size-comment.yml(workflow_run,pull-requests: write) — downloads the artifact and posts/updates a single sticky comment (keyed by a hidden marker).New scripts under
eng/scripts/bundle-size/(run withtsx):measure.ts— enumerates publishable packages vialistPackages()(skipsprivate/unnamed), runsnpm pack --dry-run --json --ignore-scriptsper package.compare.ts— renders a markdown table of packed/unpacked deltas (%), flags 🆕 added / 🗑️ removed packages, and collapses unchanged packages into a<details>block.utils.ts— byte/delta/percent formatting helpers.Example comment
Notes
core/packages/*); in a normal Azure PR those stay in the collapsed "unchanged" section.paths:filter and a dedicated non-required workflow.Validation
tsc -p tsconfig.eng.jsonpasses, prettier clean,actionlintpasses on both workflows,chronus verifyconfirms no changelog entry is required (eng/CI-only change).