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 zod peer dependency #109

Open
Siegrift opened this issue Oct 6, 2023 · 6 comments
Open

Make zod peer dependency #109

Siegrift opened this issue Oct 6, 2023 · 6 comments

Comments

@Siegrift
Copy link
Contributor

Siegrift commented Oct 6, 2023

It should resolve https://github.com/api3dao/ois#make-sure-only-one-zod-version-is-installed

Btw. (if this is not clear), zod can (and should) still be installed as a dev dependency in order for tests to run. But it will not end up in a prod bundle.

@dcroote
Copy link
Contributor

dcroote commented Oct 7, 2023

zod can (and should) still be installed as a dev dependency in order for tests to run

But wouldn't this result in the potential for two versions of zod being present?

@Siegrift
Copy link
Contributor Author

Siegrift commented Oct 7, 2023

Mhh, how?

@dcroote
Copy link
Contributor

dcroote commented Oct 7, 2023

If versions diverged and the peer dependency had say zod@^3.1 and the dev dependency had zod@^4.1, but I guess that's a low risk

@Siegrift
Copy link
Contributor Author

Siegrift commented Oct 8, 2023

It doesn't matter even if they diverge. The peer dependencies are not installed automatically (users need to install them manually) so you won't end up with two version used at the same time.

When publishing the package, all dev dependencies are ignored so what we effectively end up with is package without zod library and users need to install it themselves. There could be an issue, if their installed zod version has breaking changes with the one used in OIS but that should happen only if they install a different major version, for which they will get a warning during install (the famous "incorrect peer dependency").

@dcroote
Copy link
Contributor

dcroote commented Oct 8, 2023

I'm saying that zod version that this package gets tested against becomes uncoupled from the one installed and used, which would be bad.

@Siegrift
Copy link
Contributor Author

For reference, we are bundling zod (same way as in OIS currently) in all other repos and it works without issues.

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

No branches or pull requests

2 participants