Skip to content

Ship only what consumers need in the published packages - #13

Merged
antstanley merged 1 commit into
mainfrom
chore/slim-published-packages
Jul 25, 2026
Merged

Ship only what consumers need in the published packages#13
antstanley merged 1 commit into
mainfrom
chore/slim-published-packages

Conversation

@antstanley

Copy link
Copy Markdown
Owner

Two kinds of dead weight were reaching npm. Three lines of config; no runtime code changed.

Sourcemaps. sourceMap: true sat in tsconfig.base.json, so every package emitted .js.map next to its output and files: ["dist"] shipped the lot — 206 kB of maps across the three published packages, for artifacts nobody debugs from the registry. Removed from the base config.

test-support.ts. Scaffolding imported only by *.test.ts, but because it is not itself a .test.ts file the build's exclude never caught it and it compiled into dist (11.9 kB in blogwright, 6.6 kB in blogwright-pds). Now excluded from both build configs. It stays fully typechecked — the tsconfig.typecheck.json files override exclude to [], which is what makes this safe.

Package Packed Unpacked Files
blogwright 133.0 → 112.5 kB 540.4 → 438.1 kB 62 → 41
blogwright-core 50.9 → 35.7 kB 205.1 → 127.8 kB 86 → 58
blogwright-pds 28.6 → 18.3 kB 99.9 → 59.1 kB 35 → 22

Together: 845.4 → 625.0 kB unpacked (−26%), 183 → 121 files.

Already correct and left alone: the files fields were properly restrictive, blogwright-build-agent is private and never publishes, and agent/Dockerfile + agent-manifest.json are needed to build the MicroVM image.

Verified: clean rebuild leaves zero .map files, zero test-support* in any dist, no dangling imports and no orphaned sourceMappingURL comments; node dist/bin.js --help runs; build, lint, typecheck, knip, --frozen-lockfile and 331 tests all pass.

Ships with a patch changeset — this changes published artifacts, so it is not internal-only.

Not included: agent/server.js is 297.7 kB of the CLI's remaining 438 kB and ships unminified. A minified rolldown build measures 140.9 kB, a further 52.7% cut. Left out deliberately: that bundle is the build server running inside the MicroVM, so minifying turns build-failure stack traces into mangled names, and the AWS SDK's inlined dynamic imports are the shape that tends to break under minification. It needs a real deploy to verify, not just the build-agent unit tests, which cover source rather than the bundle.

🤖 Generated with Claude Code

Two kinds of dead weight were reaching npm.

sourceMap was set in tsconfig.base.json, so every package emitted .js.map
alongside its output and files: ["dist"] shipped the lot — 206 kB of maps
across the three published packages, for artifacts nobody debugs from the
registry. Removed from the base config; it is off by default everywhere now.

test-support.ts is scaffolding imported only by *.test.ts, but it is not
itself a .test.ts file, so the build exclude never caught it and it compiled
into dist. Added to the build exclude for blogwright and blogwright-pds. It
stays fully typechecked: the tsconfig.typecheck.json files override exclude
to [], so they still see it and its tests.

Unpacked: blogwright 540.4 -> 437.9 kB, blogwright-core 205.1 -> 127.8 kB,
blogwright-pds 99.9 -> 58.9 kB; 183 files down to 121. No runtime code
changed, and the built CLI still runs.

blogwright-build-agent is private and never published; its bundle ships
inside the CLI as agent/server.js and is untouched here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@antstanley
antstanley merged commit b760320 into main Jul 25, 2026
1 check passed
@antstanley
antstanley deleted the chore/slim-published-packages branch July 25, 2026 08:42
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.

1 participant