Skip to content

Commit

Permalink
perf(bundle): remove unneeded type declarations
Browse files Browse the repository at this point in the history
remove type declarations from files that are a not a part of the output
target's entrypoint. this is accomplished in `package.json` by updating
the files included in the bundle.

update the `tsconfig.json` to strip comments out, as that further
reduces the size of the library.

After:
npm notice Tarball Contents
npm notice 1.0kB LICENSE.md
npm notice 4.9kB README.md
npm notice 3.3kB dist/contributions/html-contributions.js
npm notice 838B dist/contributions/js-contributions.js
npm notice 1.4kB dist/generate-web-types.js
npm notice 1.1kB dist/index.d.ts
npm notice 2.3kB dist/index.js
npm notice 1.2kB package.json
npm notice Tarball Details
npm notice package size: 5.8 kB
npm notice unpacked size: 16.2 kB

Before:
npm notice Tarball Contents
npm notice 1.0kB LICENSE.md
npm notice 4.9kB README.md
npm notice 1.8kB dist/contributions/html-contributions.d.ts
npm notice 6.7kB dist/contributions/html-contributions.js
npm notice 419B dist/contributions/js-contributions.d.ts
npm notice 1.0kB dist/contributions/js-contributions.js
npm notice 1.2kB dist/generate-web-types.d.ts
npm notice 2.7kB dist/generate-web-types.js
npm notice 3.2kB dist/index.d.ts
npm notice 3.7kB dist/index.js
npm notice 1.2kB package.json
npm notice package size: 8.5 kB
npm notice unpacked size: 27.9 kB
  • Loading branch information
rwaskiewicz committed May 19, 2024
1 parent 313878b commit 78f7fee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"main": "dist/index.js",
"files": [
"dist/",
"dist/index.d.ts",
"!dist/**/*.d.ts",
"!dist/**/*.test.*"
],
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
"removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
Expand Down

0 comments on commit 78f7fee

Please sign in to comment.