Make `ssh2` an optional peer dependency

Open
#64 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
docker, node.js, typescript
Domain
tooling

Research direction

Start by tracing DockerClient.fromDockerHost and the package dependency declarations to see how ssh2 enters consumer dependency trees. Check the bundling and installation behavior for consumers that do not use SSH, and verify that ssh:// paths fail clearly when ssh2 is absent.

Written by the indexing model from the issue text.

Description

Currently, DockerClient can't be used without ssh2 (a very large dependency) being in the dependency tree, despite it only being used in one branch of DockerClient.fromDockerHost. If consumers don't connect over ssh, they shouldn't need that dependency.

I'd recommend:

  • Moving the static members out of DockerClient and into their own modules. That should solve the dependency tree problem (via tree-shaking) for anybody bundling their app
  • For everyone else (and just to minimise node_modules impact), it'd be good to also make ssh2 an optional peer dependency and make the ssh://-specific code paths fail if it's not present
Dominant language
TypeScript
Stars
107
Forks
12
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docker/node-sdk

All issues in docker/node-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.