Closed zstix closed 2 years ago
instant-observability-website
:tada: Your build was successful! See the Deploy preview here.
:clock1: Build time: 4m
Metric | Score |
---|---|
Performance | :large_orange_diamond: 29 |
Accessibility | :green_heart: 100 |
Best Practices | :green_heart: 92 |
SEO | :large_orange_diamond: 85 |
:link: View full report
:tada: This PR is included in version 1.3.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Description
This PR changes how we source (load) the quickstarts into GraphQL so that we can "query" for them in Gatsby. Previously were using
gatsby-source-filesystem
andgatsby-transformer-json
to load thequickstarts.json
file directly into GraphQL. This was nice because we didn't need to specifically define all the types for each field in the JSON file (the plugins inferred all the types).Unfortunately, this came with the limitation that it was very hard to update certain fields to be different types. For example, we have
logoUrl
in the JSON file, but we actually want to download that image and turn it into a "File" node for use with sharp. Additionally, there are things that we create (such aslug
) that don't exist in the JSON file.This PR introduces a local plugin called
gatsby-source-quickstarts
. This is the recommended way of getting slightly more complex stuff into the GraphQL instance. We need to define the type(s) ourselves, but this now allows us to do the following:Reviewer Notes
Most of the work was done in
plugins/gatsby-source-quickstarts/gatsby-node.js
. This handles bootstrapping (loading the JSON), type definition, fetching images, and resolving extra properties. The rest of the code changes are adjustments to the files that worked with images to use<GatsbyImage>
(sharp).I took the time to refactor
<QuickstartImg>
a bit, since we're using it in a few places and the code needed a lot of work to utilize sharp.There are a few warnings that show up when running this locally about using
childImageSharp
with SVGs. I haven't found a way to suppress this, but it can be ignored, since we're only using that method on non-SVG images.Related Ticket(s)