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

Align usage of gatsby-sharp #38618

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

benedictjohannes
Copy link

Description

This PR aligned all safe-sharp.js in official packages and move sharp from direct dependencies to peerDependencies.

Documentation

Moving sharp from direct dependency into gatsby-sharp in all packages would probably cause sharp to not be installed when Gatsby is being used without installing gatsby-sharp.
Yarn or other package managers would warn that a peerDependency is not fulfilled and/or installing them by default.
This might warrant a mention of installing gatsby-sharp in documentation pages pertaining to Gatsby image processing.

Tests

I did not run automated e2e tests that are in this repository. Instead I use the modified packages via yarn link. No problem occurred for my site that use gatsby-plugin-sharp. As the changes are identical with other packages, I think this change will do identically.

Related Issues

These commints carry forward #34339 and should be a way to move forward to allow for single sharp instance source for all Gatsby plugins.
The "friction" mentioned in safe-sharp.js files can be mitigated with documentation, and developers familiar with dependency updates should not face any issues.

All `safe-sharp.js` is now identical, where
all are calling `gatsby-sharp` in a try-catch
with fallback to directly requiring sharp
As `sharp` is already a dependency of `gatsby-sharp`,
it is not necessary to include `sharp` in dependencies.
Instead, peerDependencies should include
`gatsby-sharp` as per best pratices in
dependency management.
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer
1 participant