feat(mongodb-runner): add programmatic api for mongodb-runner #186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I've been tinkering around with a vscode extension wrapper for mongodb-runner. The package currently only exports the cluster helpers but does not provide a programmatic interface to the functionality contained in
cli.ts
.I pulled logic for
ls
,start
andstop
into standalone, exported functions so that I can consume them in my vscode extension without running bash commands using the runner's CLI. I understand if there's a desire to keep the API of this package slim and if we don't want to export the standalone helpers. If that's the case, I would be okay with keeping them as standalone functions but not exporting them from the index. I'm happy to import from therunner-helpers.ts
file directly, this is just a toy project.Along the way, I discovered that if I restarted my computer,
mongodb-runner ls
displays clusters that have been terminated. I also added aprune
command, both to the programmatic exports and the runner's CLI, that attempts to connect to every instance in the runner'srunnerDir
and removes all entries for clusters that cannot be connected to.Open Questions
Checklist