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 portal-client dependency optional #474

Closed
3 tasks
matejchalk opened this issue Feb 6, 2024 · 2 comments · Fixed by #837
Closed
3 tasks

Make portal-client dependency optional #474

matejchalk opened this issue Feb 6, 2024 · 2 comments · Fixed by #837
Assignees

Comments

@matejchalk
Copy link
Collaborator

matejchalk commented Feb 6, 2024

User story

In order to streamline approval process in enterprises which vet every NPM package, it helps if the Code PushUp CLI has as few external dependencies as possible.

The @code-pushup/portal-client (which also pulls in graphql, graphql-request and graphql-tag) is only needed for uploading to portal. That means its installation could be optional.

Acceptance criteria

  • change @code-pushup/portal-client imports from static to dynamic
  • move @code-pushup/portal-client from dependencies to optionalDependencies
  • add additional portal setup instructions to documentation
@hanna-skryl
Copy link
Collaborator

I want to confirm my understanding of how optionalDependencies would work here. When a user installs our package, npm will still attempt to install @code-pushup/portal-client even if it's marked as optional. If the installation fails (e.g., due to network problems), the main package would still install successfully.

My concern is that, under normal circumstances, it's unlikely for the installation to actually fail, meaning @code-pushup/portal-client would still get installed in most cases. Given that, does making it optional actually help reduce the number of dependencies for enterprise approval, or am I missing something about how optionalDependencies work?

@matejchalk
Copy link
Collaborator Author

Good point about optional dependencies being installed by default, I hadn't considered that. But I think it's for the best actually 🤔

It's not that we think the installation could fail. It's about having a convenient way for the user to opt out of installing @code-pushup/portal-client if they're not using the portal, which they can't really do if it's a regular dependency. (This is actually something @BioPhoton was pushing for, I just wrote the issue, BTW. He was concerned that for enterprises who want to try out Code PushUp without paying for the portal, these dependencies could present an extra hurdle.)

Originally, I thought this means that portal users would have an extra setup step to get the portal running, but this way it's actually better. By default @code-pushup/portal-client will be installed, so no extra setup needed for portal users. But if some enterprise really cares about every dev dependency and they want to try out Code PushUp without paying for it, then we can instruct them to use --omit=dev --omit=optional (default is --omit=dev according to npm docs) when installing @code-pushup/cli. This way, most users (incl. paying customers) will have a simpler setup, but these "picky" enterprises can also be satisfied with an alternative setup. That's a good balance, IMHO 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants