Skip to content

Commit

Permalink
build: reduce installation size with npmignore
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
mlaursen committed Jul 30, 2024
1 parent 84e99b9 commit c13d1cc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/code/.npmignore
Original file line number Diff line number Diff line change
@@ -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__/**
6 changes: 6 additions & 0 deletions packages/core/.npmignore
Original file line number Diff line number Diff line change
@@ -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__/**
4 changes: 4 additions & 0 deletions packages/material-icons/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# I only want the README.md, CHANGELOG.md, LICENSE, package.json, and compiled to be published
/*
!/*.d.ts
!/*Icon.js
6 changes: 6 additions & 0 deletions packages/react-md/.npmignore
Original file line number Diff line number Diff line change
@@ -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__/**

0 comments on commit c13d1cc

Please sign in to comment.