e2b-dev / E2B

Secure open source cloud runtime for AI apps & AI agents
https://e2b.dev/docs
Apache License 2.0
7.02k stars 458 forks source link

Docker SDK Usage #432

Closed danstarns closed 2 months ago

danstarns commented 2 months ago

What?

Why

Using child_process can be brittle and there are already tested tools that allow us to interact with Docker programmatically, we should use those for better readability and maintainability.

The CLI had few tests, so to make assertive changes here, I first added coverage for the CLI and then returned to make the dockerode / SDK changes.

How

Usage of npm package https://github.com/apocas/dockerode replaces child_process calls.

Vitest is added under pnpm test:unit in the CLI package, mocks are used to interact with and assert the CLI.

Refactors have been made for readability and to enable the mocking of modules in tests.

changeset-bot[bot] commented 2 months ago

⚠️ No Changeset found

Latest commit: 78f491af9623fd172abbcdd53fb4e1ca07658d79

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR