Skip to content

feat(stats-generator): count transitive first-party dependencies - #1003

Merged
AlexanderKaran merged 4 commits into
e18e:mainfrom
maksimgm:feat/first-party-transitive
Dec 4, 2026
Merged

AlexanderKaran merged 4 commits into
e18e:mainfrom
maksimgm:feat/first-party-transitive

Conversation

@maksimgm

@maksimgm maksimgm commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

part of #997, the first-party one. core (#1004) and starter (#1005) are their own prs on top of this

adds countTransitiveDependencies(lockfile, roots?) in utils/pnpm-lockfile.ts: walks the starter lockfile from the given direct deps (all of them by default) and counts every package version they pull in, not counting the roots. first-party passes its manifest's deps and stores it as firstPartyTransitive

the field is required, and every saved result is backfilled. versions that match the current starter use the committed lockfile; older ones use a lockfile regenerated from the saved starter package.json with pnpm install --lockfile-only

z.number().int().nonnegative(),
),
// Optional because older results were recorded before it existed.
firstPartyTransitive: createValueWithUnit(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't need to be optional; you can backfill in this PR by running the benchmark.

We keep snapshots of the deps in each result version.

@AlexanderKaran

Copy link
Copy Markdown
Collaborator

@maksimgm Could we have one function in pnpm-lockfile.ts that counts transitive deps? Starter could pass just the lockfile, and core and first-party could pass a second argument to pick which packages to start from. That keeps the counting logic and its tests in one place.

@maksimgm
maksimgm force-pushed the feat/first-party-transitive branch from 118b40e to 21a8923 Compare December 3, 2026 17:33
@maksimgm

maksimgm commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

done, it's one countTransitiveDependencies(lockfile, roots?) in pnpm-lockfile.ts now with the tests next to it. starter passes just the lockfile, core and first-party pass their roots

the fields are required and backfilled in each pr. the result versions keep the starter package.json but not the lockfile, so for older versions i regenerated one with pnpm install --lockfile-only and counted from that. transitive ranges resolve to today's versions there, so older counts can be a little off. versions that match the current starter use the committed lockfile

#1004 and #1005 are rebuilt on top of this and the new core-dependencies layout

AlexanderKaran
AlexanderKaran previously approved these changes Dec 3, 2026
@maksimgm
maksimgm force-pushed the feat/first-party-transitive branch 2 times, most recently from ab54090 to ec22bcd Compare December 3, 2026 23:37
@maksimgm
maksimgm force-pushed the feat/first-party-transitive branch from ec22bcd to 87caf22 Compare December 4, 2026 21:39
@AlexanderKaran
AlexanderKaran merged commit 8ea9c5e into e18e:main Dec 4, 2026
121 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants