Problem
11 packages publish build artifacts to npm. Users downloading @typespec/spec-coverage-sdk get a 150 KB TypeScript incremental-build cache and nothing else new — 81% of the tarball is junk.
Measured from the tarballs currently on the npm registry (npm pack @typespec/<name>):
| Package |
Unpacked |
Build artifacts |
Waste |
@typespec/spec-coverage-sdk |
184.8 KB |
150.0 KB |
81.2% |
@typespec/spector |
585.9 KB |
232.3 KB |
39.6% |
@typespec/protobuf |
406.2 KB |
114.3 KB |
28.2% |
@typespec/spec-api |
214.6 KB |
53.1 KB |
24.7% |
@typespec/http-server-js |
1.32 MB |
118.8 KB |
9.0% |
@typespec/http-specs |
1.32 MB |
114.5 KB |
8.7% |
@typespec/http-client |
290.8 KB |
4.0 KB |
1.4% |
@typespec/http-canonicalization |
493.4 KB |
1.5 KB |
0.3% |
@typespec/mutator-framework |
476.2 KB |
1.3 KB |
0.3% |
@typespec/emitter-framework |
1.51 MB |
2.9 KB |
0.2% |
@typespec/http-client-js |
1.10 MB |
143 B |
0.0% |
The offending files:
$ npm pack @typespec/spector && tar tzf typespec-spector-*.tgz | grep -E 'temp/|\.turbo/'
package/temp/.tsbuildinfo 231704 # tsc incremental cache
package/.turbo/turbo-build.log 605 # captured build output
@typespec/emitter-framework additionally ships a package/package.json.bak, left behind by the release tooling.
Cause
These are exactly the 11 publishable packages whose package.json has no files field, so npm pack falls back to .gitignore-based filtering. .gitignore is only consulted for files npm doesn't already know about, and it does not stop .turbo/ or temp/ from being packed even though both are ignored:
$ grep -nE '^(temp|\.turbo)$' .gitignore
171:temp
252:.turbo
Every other publishable package in the repo declares files and is unaffected.
Side effect
.turbo/turbo-build.log captures stdout of the build, including the compiler version banner and CLI spinner frames:
$ tsp compile . --warn-as-error --import @typespec/library-linter --no-emit
TypeSpec compiler v1.14.0
⠙ Compiling...✔ Compiling
That makes tarball size non-deterministic across builds. It broke the package-size PR check in Azure/typespec-azure, where every core package showed a phantom few-byte delta on an unrelated PR: Azure/typespec-azure#5182 (comment)
Suggested fix
Add a files field to the 11 packages listed above, matching what the rest of the repo already does. A repo-level lint/test asserting that every publishable package declares files would keep it from regressing.
Problem
11 packages publish build artifacts to npm. Users downloading
@typespec/spec-coverage-sdkget a 150 KB TypeScript incremental-build cache and nothing else new — 81% of the tarball is junk.Measured from the tarballs currently on the npm registry (
npm pack @typespec/<name>):@typespec/spec-coverage-sdk@typespec/spector@typespec/protobuf@typespec/spec-api@typespec/http-server-js@typespec/http-specs@typespec/http-client@typespec/http-canonicalization@typespec/mutator-framework@typespec/emitter-framework@typespec/http-client-jsThe offending files:
@typespec/emitter-frameworkadditionally ships apackage/package.json.bak, left behind by the release tooling.Cause
These are exactly the 11 publishable packages whose
package.jsonhas nofilesfield, sonpm packfalls back to.gitignore-based filtering..gitignoreis only consulted for files npm doesn't already know about, and it does not stop.turbo/ortemp/from being packed even though both are ignored:Every other publishable package in the repo declares
filesand is unaffected.Side effect
.turbo/turbo-build.logcaptures stdout of the build, including the compiler version banner and CLI spinner frames:That makes tarball size non-deterministic across builds. It broke the package-size PR check in
Azure/typespec-azure, where every core package showed a phantom few-byte delta on an unrelated PR: Azure/typespec-azure#5182 (comment)Suggested fix
Add a
filesfield to the 11 packages listed above, matching what the rest of the repo already does. A repo-level lint/test asserting that every publishable package declaresfileswould keep it from regressing.