Skip to content

Update deps and tooling to reduce installation footprint - #218

Open
achou11 wants to merge 4 commits into
openzim:mainfrom
achou11:ac/reduce-publish-footprint
Open

Update deps and tooling to reduce installation footprint#218
achou11 wants to merge 4 commits into
openzim:mainfrom
achou11:ac/reduce-publish-footprint

Conversation

@achou11

@achou11 achou11 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This PR brings in quite a few changes and I fully acknowledge that there may be some reversions or adjustments based on maintainers' preferences.

  • Moves some of the still-necessary dependencies as dev-only, which prevents unnecessary installation from consuming projects. Basically @types/* modules and things used only in the tests.

  • Leans into Node's support for TypeScript files via type-stripping, which is primarily relevant for the tests that are written in TypeScript. This removes the need for something like ts-node.

  • Updates the TypeScript configuration to align with Node-based projects, most notably related to the native TS support and a stricter adherence to Node-oriented ESM module syntax (e.g. requiring file extension names in imports).

  • Replaces Jest with Node's built-in test runner. This means updates to the npm scripts that run the tests as well as minor updates to the tests themselves. Note that as of now, I have not made use of the built-in assertions module. Instead, I installed expect, which is Jest's standalone module for its assertions API. This avoids needing to completely rewrite the tests for now.

Some open questions:

  • Is there any interest in moving away from Jest's expect API and instead using Node's built-in assertions for the tests? This would further reduce the dependency usage for this project (although it doesn't affect consuming projects). Porting the tests would be pretty straightforward from what I can tell.

  • Is @faker-js/faker still actually used in practice? I noticed that there's some commented-out lines in the memory-leak tests that would make use of it. Not sure if those are still relevant or not but if not, could remove that dependency as well.


Deps graph before and after this PR (when installing as consumer):

Comment thread dev/hackPackageVersion.js

@achou11 achou11 Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Feels like this file is an artifact of some no-longer relevant setup (references to Travis CI based on where it's used). Maybe could be removable?

Comment thread .vscode/launch.json

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed this file since it seemed kind of outdated. Doing so allows removing ts-node and tsconfig-paths as deps.

Could be very mistaken about whether it's used or not though!

Comment thread package.json
"@types/bindings": "^1.5.5",
"@types/jest": "^30.0.0",
"@types/node": "^26.1.1",
"@types/node": "22 || 24 || 26",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe this is still needed as direct dependency because the exported types for the module reference types that are provided by it. Always kind of uncertain about the requirements between @types/node and published modules tbh 😅

I updated the versions to make it more flexible for consuming projects, as I don't think the types used by this module have changed drastically between these LTS versions.

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.

1 participant