Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce package installation size #712

Closed
3 tasks
GaelGirodon opened this issue Jan 7, 2024 · 3 comments
Closed
3 tasks

Reduce package installation size #712

GaelGirodon opened this issue Jan 7, 2024 · 3 comments

Comments

@GaelGirodon
Copy link

The current installation size of the package may discourage its integration into other projects or packages that want to keep their size as low as possible (as mentioned in #687).

The installation size has increased significantly over releases, especially on 2.x, 5.x and 7.x:

1.15.2 2.1.0 3.1.0 4.3.0 5.3.0 6.2.5 7.2.3
1.38 MB 3.01 MB 3.01 MB 3.89 MB 10.5 MB 10.7 MB 16.3 MB

https://packagephobia.com/result?p=zx%401.15.2%2Czx%402.1.0%2Czx%403.1.0%2Czx%404.3.0%2Czx%405.3.0%2Czx%406.2.5%2Czx%407.2.3

98% of the installation size comes from 5 dependencies:

Dependency Install %
node-fetch 7.45 MB 47 %
@types/node 3.50 MB 22 %
@types/fs-extra 3.45 MB 22 %
yaml 636 kB 4 %
globby 577 kB 4 %
ps-tree 131 kB 1 %
fs-extra 114 kB 1 %
minimist 53.2 kB 0 %
chalk 42.5 kB 0 %
fx 19.5 kB 0 %
which 17.7 kB 0 %
@types/minimist 7.17 kB 0 %
@types/which 5.26 kB 0 %
@types/ps-tree 4.45 kB 0 %
webpod 357 B 0 %

https://packagephobia.com/result?p=@types/[email protected],@types/[email protected],@types/[email protected],@types/[email protected],@types/[email protected],[email protected],[email protected],fx,[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]

The package size could be drastically reduced (-90%) by:

  1. Removing node-fetch (Drop Node.js v16 and node-fetch dependency #687, Plan for v8 #589): -47%
  2. Moving @types/* to dev (and optional?) dependencies: -44%
    • These types can still be installed if needed by TypeScript users
  3. Removing fs-extra and @types/fs-extra (Plan for v8 #589): -22%

Tasks 1 and 3 are already planned for v8, could you consider the 2nd one as well? Thanks 🙂

@antonmedv
Copy link
Collaborator

Moving @types/* to dev (and optional?) dependencies: -44%
These types can still be installed if needed by TypeScript users

Yeap. We are going to build zx with esbuild and we can build .d.ts as well.

antongolub added a commit to antongolub/zx that referenced this issue Feb 24, 2024
@antongolub
Copy link
Collaborator

antongolub commented Feb 24, 2024

Good news. We have a proposal, that reaches the 414Kb point (4.33MB with optional @types/fs-extra and @types/node)
https://packagephobia.com/result?p=%40antongolub%2Fzx%2C+zx

antongolub added a commit to antongolub/zx that referenced this issue Feb 24, 2024
antongolub added a commit to antongolub/zx that referenced this issue Feb 24, 2024
antonmedv pushed a commit that referenced this issue Feb 24, 2024
* ci: enable autotests for all pushes

* build: bundle with esbuild

* test: ignore vendor.js coverage

* fix: use vendor chunk for repl

* build(dts): rm redundant triple slashes

* build: move external typings to optional deps

relates #712

* chore(core): relax Options type

* perf: replace node-fetch with node-fetch-native

* build: turn off minify
@antonmedv
Copy link
Collaborator

🎉 Awesome work @antongolub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants