Skip to content

feat: support shared content #269

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

Merged
merged 19 commits into from
Oct 17, 2023
Merged

feat: support shared content #269

merged 19 commits into from
Oct 17, 2023

Conversation

runeb
Copy link
Member

@runeb runeb commented Oct 17, 2023

This PR introduces a pre-processing step scanning the gql schemas from Sanity for directives that indicate a field or type as a cross dataset reference. When these directives are found, the corresponding fields are manipulated to be treated as normal references with the expectation that the user will add another source config for the target dataset in the Gatsby app configuration. Through Gatsby schema composition the types should then match up, and the node resolution should also pick out the target documents.

The main implementation to review is found in

packages/gatsby-source-sanity/src/util/mapCrossDatasetReferences.ts

End to end tests de-referencing both normal and cross dataset references from actual Sanity datasets are included in the cdrs Gatsby app in examples.

To run tests, first make sure the test app is running

cd examples/cdrs && rm -rf .cache public && npm run develop

Then run the test suite in that folder

cd examples/cdrs && npm test

@runeb runeb requested a review from stipsan October 17, 2023 01:58
@vercel
Copy link

vercel bot commented Oct 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
gatsby-source-sanity ❌ Failed (Inspect) Oct 17, 2023 1:59am

@socket-security
Copy link

@socket-security
Copy link

socket-security bot commented Oct 17, 2023

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: styled-components@5.3.11

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore foo@1.0.0 bar@* or ignore all packages with @SocketSecurity ignore-all

@runeb
Copy link
Member Author

runeb commented Oct 17, 2023

Cherry picked the approved PR #259 into here

Copy link
Member

@stipsan stipsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 🚀 🚀

@stipsan
Copy link
Member

stipsan commented Oct 17, 2023

@SocketSecurity ignore styled-components@5.3.11

@runeb runeb merged commit b77309f into main Oct 17, 2023
@runeb runeb deleted the shared-content branch October 17, 2023 20:18
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

Successfully merging this pull request may close these issues.

3 participants