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

Make project class-based #76

Open
jodyheavener opened this issue Sep 6, 2022 · 0 comments
Open

Make project class-based #76

jodyheavener opened this issue Sep 6, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@jodyheavener
Copy link
Member

Summary

Currently op-js uses a singleton approach, where every family of commands is exported. This is nice and handy for quick importing, but we've had requests to make the project class-based so you can have multiple instances going at the same time.

Use cases

There are handful of benefits:

  • Requiring different versions of the CLI
  • Supplying a specific path to the op binary
  • Supporting Service Account and Connect environment variables

Proposed solution

Convert all the exported command functions/objects into methods on an OPJS class that can be instantiated with options:

new OPJS({
  binaryPath: string;
  requiredVersion: string | SemVer;
  ...etc
});

Is there a workaround to accomplish this today?

All of this is technically possible with our current setup, but it's a little messy and obviously only supports a single instance of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant