From c13d1cca2d0725154d24bc1538efeace36935911 Mon Sep 17 00:00:00 2001 From: Mikkel Laursen Date: Tue, 30 Jul 2024 17:38:57 -0400 Subject: [PATCH] build: reduce installation size with npmignore This reduced the package size from 1.7 MB to 1.3 MB and the total unpacked size from 9.0 MB to 6.0 MB. If I don't need source maps, it could be reduced even more, but I think those are helpful if stuff goes bork. Removing the sourcemaps (src directory and .map files) would result int 499.0 KB package size and 2.3 MB total unpacked size. The material-icons package size was reduced from 1.9 MB to 1.0 MB and the total unpacked size from 18.4 MB to 11.1 MB Before: ```sh npm notice === Tarball Details === npm notice name: @react-md/core npm notice version: 1.0.0-next.15 npm notice filename: react-md-core-1.0.0-next.15.tgz npm notice package size: 1.7 MB npm notice unpacked size: 9.0 MB npm notice shasum: 55de6fbe7540df7ff5dbfd4581def6d19ceaa005 npm notice integrity: sha512-3m8aV/22Sf6+l[...]4pGq4mtgahmaA== npm notice total files: 2113 npm notice ``` After: ```sh npm notice === Tarball Details === npm notice name: @react-md/core npm notice version: 1.0.0-next.15 npm notice filename: react-md-core-1.0.0-next.15.tgz npm notice package size: 1.3 MB npm notice unpacked size: 6.0 MB npm notice shasum: 5e6306383122596b677e9e557e125fbd95b53e89 npm notice integrity: sha512-ocqZMHzdgg36J[...]RZyXNA96OwE1w== npm notice total files: 1688 npm notice ``` If I remove the source map ability: ```sh npm notice === Tarball Details === npm notice name: @react-md/core npm notice version: 1.0.0-next.15 npm notice filename: react-md-core-1.0.0-next.15.tgz npm notice package size: 499.0 kB npm notice unpacked size: 2.3 MB npm notice shasum: 1e0f3c82766a4f7295a3c914896888e0ebaf414f npm notice integrity: sha512-O5dWXrpk75MYp[...]pAHu2H60tPNjQ== npm notice total files: 865 npm notice ``` Material Icons Before: ```sh npm notice === Tarball Details === npm notice name: @react-md/material-icons npm notice version: 6.0.0-next.16 npm notice filename: react-md-material-icons-6.0.0-next.16.tgz npm notice package size: 1.9 MB npm notice unpacked size: 18.4 MB npm notice shasum: 43aec95a6dd8cb5af6812e3aea15ab379a5ed660 npm notice integrity: sha512-uhlmJLlhqVTiL[...]IEtt9LIa431Zg== npm notice total files: 32125 npm notice ``` Material Icons After: ```sh npm notice === Tarball Details === npm notice name: @react-md/material-icons npm notice version: 6.0.0-next.16 npm notice filename: react-md-material-icons-6.0.0-next.16.tgz npm notice package size: 1.0 MB npm notice unpacked size: 11.1 MB npm notice shasum: 150d4dbc4e425d024b3a245a1d3940f3eac04c6b npm notice integrity: sha512-JyLJDjLEwv9CT[...]chXzjQ8N31TXg== npm notice total files: 21406 npm notice ``` --- packages/code/.npmignore | 6 ++++++ packages/core/.npmignore | 6 ++++++ packages/material-icons/.npmignore | 4 ++++ packages/react-md/.npmignore | 6 ++++++ 4 files changed, 22 insertions(+) create mode 100644 packages/code/.npmignore create mode 100644 packages/core/.npmignore create mode 100644 packages/material-icons/.npmignore create mode 100644 packages/react-md/.npmignore diff --git a/packages/code/.npmignore b/packages/code/.npmignore new file mode 100644 index 0000000000..35a5b20fb1 --- /dev/null +++ b/packages/code/.npmignore @@ -0,0 +1,6 @@ +# I only want the src, dist, README.md, CHANGELOG.md, LICENSE and, package.json to be published +/* +!/src/** +src/**/*.scss +!/dist/** +**/__tests__/** diff --git a/packages/core/.npmignore b/packages/core/.npmignore new file mode 100644 index 0000000000..35a5b20fb1 --- /dev/null +++ b/packages/core/.npmignore @@ -0,0 +1,6 @@ +# I only want the src, dist, README.md, CHANGELOG.md, LICENSE and, package.json to be published +/* +!/src/** +src/**/*.scss +!/dist/** +**/__tests__/** diff --git a/packages/material-icons/.npmignore b/packages/material-icons/.npmignore new file mode 100644 index 0000000000..14e0791e67 --- /dev/null +++ b/packages/material-icons/.npmignore @@ -0,0 +1,4 @@ +# I only want the README.md, CHANGELOG.md, LICENSE, package.json, and compiled to be published +/* +!/*.d.ts +!/*Icon.js diff --git a/packages/react-md/.npmignore b/packages/react-md/.npmignore new file mode 100644 index 0000000000..35a5b20fb1 --- /dev/null +++ b/packages/react-md/.npmignore @@ -0,0 +1,6 @@ +# I only want the src, dist, README.md, CHANGELOG.md, LICENSE and, package.json to be published +/* +!/src/** +src/**/*.scss +!/dist/** +**/__tests__/**