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

refactor: reduce installation size by replacing pacote #108

Merged
merged 3 commits into from
Apr 13, 2024

Conversation

SukkaW
Copy link
Contributor

@SukkaW SukkaW commented Apr 13, 2024

Description

Currently, the installation size of taze is 14 MiB, twice the size of npm-check-updated which is 7.3 MiB.

It turns out that the pacote could be the culprit. pacote introduces tons of npm core functionality while taze only utilize its package metadata fetching.

Linked Issues

N/A

Additional context

See also antfu-collective/unconfig#27

@SukkaW
Copy link
Contributor Author

SukkaW commented Apr 13, 2024

The tests are failing, converting the PR to draft now.

@SukkaW SukkaW marked this pull request as draft April 13, 2024 15:39
@SukkaW
Copy link
Contributor Author

SukkaW commented Apr 13, 2024

All tests pass on my machine, the PR is ready for review now @antfu

image

Comment on lines +28 to +30
// @types/pacote uses "import = require()" syntax which is not supported by unbuild
// So instead of using @types/pacote, we declare the type definition with only fields we need
export interface Packument {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, pacote was a direct dependency.

If pacote is removed, @types/pacote can not live alone, and import = require() would cause the build to fail, hence the manual declaration.

@SukkaW SukkaW marked this pull request as ready for review April 13, 2024 16:29
@SukkaW SukkaW changed the title refactor: reduce installation size by replace pacote refactor: reduce installation size by replacing pacote Apr 13, 2024
@antfu antfu merged commit 5f966da into antfu-collective:main Apr 13, 2024
5 checks passed
@SukkaW
Copy link
Contributor Author

SukkaW commented Apr 13, 2024

image

We did it! We reduce the installation size of taze by 35%!

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

Successfully merging this pull request may close these issues.

2 participants