nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Feature] Stop publishing .d.ts and .d.ts.map files for the CLI package (1,166 files, 1.2 MB)

Open addyCooks opened this issue 1 month ago • 4 comments

Summary

tsconfig.json has declaration and declarationMap turned on, so every compiled file also ships a .d.ts and a .d.ts.map. The package is a CLI (bin plus main: dist/cli.js), has no types or exports field, and nothing in the repo reads these files. They only add files to install and unpack.

Steps to reproduce

  1. pnpm run build
  2. npm pack --dry-run --json --ignore-scripts and count entries ending in .d.ts and .d.ts.map.

Expected behaviour

The tarball contains only files the CLI needs at runtime.

Actual behaviour

tarball: 1.77 MB packed, 7.40 MB unpacked, 2,380 files
.js: 588 files 3.55 MB | .js.map: 578 files 2.59 MB
.d.ts: 588 files 0.75 MB | .d.ts.map: 578 files 0.42 MB

That is 1,166 declaration files, about half of all files in the package. A test build with tsc --declaration false --declarationMap false compiled without errors in 8 s and produced 0 declaration files.

Environment

  • OS: Windows 11 (10.0.26300)
  • Node: 22.22.3
  • Nanocoder: 1.31.0 (main at be428fc7)

Suggested fix

  • tsconfig.json:15-16: set declaration and declarationMap to false.
  • package.json build script: drop plugins/voice/dist/*.d.ts from the cp step, since nothing reads it at runtime (type checks use source/types/nanocoder-voice.d.ts).
  • Check that pnpm run test:types, test:types:voice, test:types:vscode and knip still pass. Whether to keep the 578 .js.map files (2.6 MB) is a separate decision.

addyCooks avatar Oct 18 '26 06:10 addyCooks

seems a intersting one assign this to me @addyCooks

Vishesh-Verma-07 avatar Oct 18 '26 06:10 Vishesh-Verma-07

Hii @addyCooks , I'd like to work on this issue. Could you please assign it to me?

DarshanCodes09 avatar Oct 18 '26 06:10 DarshanCodes09

Hey @Vishesh-Verma-07! I see you've already got a few issues assigned to you. Let's focus on getting PRs up for those first before taking on new ones.

@DarshanCodes09 Assigning this to you. This is a good first issue - should be straightforward config changes in tsconfig.json and package.json. Make sure to verify the tests still pass after your changes!

addyCooks avatar Oct 18 '26 07:10 addyCooks

Thanks for assigning me issue #1828, @addyCooks !!! Could you please review PR #1841?

DarshanCodes09 avatar Oct 18 '26 15:10 DarshanCodes09