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
[Feat] Simplified peerDependencies policy #8802
Comments
Just documenting the reasoning I followed in #8573: The peer dependencies used in v9.0:
Reflecting on the above:
|
|
|
#8726 highlights the fragile setup surrounding
|
Well, we could always take another look at the state in luma.gl master (targeting v9.1), which removed the non-essential exports (often by moving them into internal functions in non-core modules). |
The majority of the usages are in the following pattern: getAttachment(attachment: string | Texture | TextureView): TextureView {
if (typeof attachment === 'string') {
return createTexture(attachment).view;
} else if (attachment instanceof Texture) {
return attachment.view;
} else {
return attachment;
}
} Which can be converted to: getAttachment(attachment: string | Texture | TextureView): TextureView {
if (typeof attachment === 'string') {
return createTexture(attachment).view;
} else if ('view' in attachment) {
return attachment.view;
} else {
return attachment;
}
} TypeScript won't have a problem with this during type check. If in runtime the user passes in some JavaScript object that is neither Texture or TextureView - the current implementation wouldn't work either. With that said, we don't have an easy way to prevent these from being added back. |
That would be nice. I have never been able to get the Even so this will need custom approach in every place. |
Target Use Case
An idea for discussion.
Some modules now have a significant number of peer dependencies.
@deck.gl/carto
is one example, with seven peer dependencies, soon to be eight, which increases the complexity of setup for new users.As a maintainer, it's not always clear to me which modules belong in dependencies vs. peerDependencies, or whether there's an established policy. See the
@luma.gl/*
dependencies here:deck.gl/modules/aggregation-layers/package.json
Lines 40 to 51 in fa029dd
Each time a peer dependency is added, or its version incremented, that is technically a breaking change under semver. Whether it breaks users in practice would depend on whether the package in question was already somewhere in the dependency chain, which is hard to predict.
Proposal
Perhaps a way to simplify this — while avoiding the "mismatched dependencies" risk — would be to take a policy that the relevant
*/core
module is always a peer dependency, while any other visgl-related modules are production dependencies, unless there's some particular reason for an exception?Because everything else depends on the
*/core
modules, I think that could be a way to minimize what end-users need to install, while also ensuring that compatible versions are used.The text was updated successfully, but these errors were encountered: