Chore: improve build speed; exclude unnecessary image processing#7476
Chore: improve build speed; exclude unnecessary image processing#7476leecalcote merged 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Gatsby schema and filesystem sourcing to reduce build work by explicitly typing new frontmatter image fields and excluding selected image paths from being sourced/processed.
Changes:
- Added GraphQL schema types/fields for additional frontmatter image references.
- Reformatted RSS/feed-related code for readability (no functional change intended).
- Expanded
gatsby-source-filesystemignoreglobs to skip SVGs and several image subdirectories.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| gatsby-node.js | Adds new frontmatter schema types/fields for image/file resolution. |
| gatsby-config.js | Refactors some formatting and expands image sourcing ignore globs to reduce build workload. |
| type FrontmatterMeshesYouLearn { | ||
| name: String | ||
| imagepath: File @fileByRelativePath | ||
| } |
There was a problem hiding this comment.
imagepath is inconsistent with nearby frontmatter naming patterns in this schema (e.g., image_path, executive_image, thumbnail_svg). If you can still change the frontmatter shape, consider renaming this field to match the prevailing convention (snake_case like image_path or a consistent camelCase) to keep the GraphQL API self-explanatory and reduce confusion for query authors.
| image_path: File @fileByRelativePath | ||
| thumbnail_svg: File @fileByRelativePath | ||
| darkthumbnail_svg: File @fileByRelativePath | ||
| meshesYouLearn: [FrontmatterMeshesYouLearn] |
There was a problem hiding this comment.
imagepath is inconsistent with nearby frontmatter naming patterns in this schema (e.g., image_path, executive_image, thumbnail_svg). If you can still change the frontmatter shape, consider renaming this field to match the prevailing convention (snake_case like image_path or a consistent camelCase) to keep the GraphQL API self-explanatory and reduce confusion for query authors.
| collectionIgnoreGlobs.length > 0 | ||
| ? console.info(`Build Scope excludes: "${process.env.BUILD_FULL_SITE}"`) | ||
| : console.info("Build Scope includes all collections"); |
There was a problem hiding this comment.
This uses a ternary for side effects as a standalone statement. In addition to being harder to read, it can trip no-unused-expressions-style lint rules in some ESLint configs. Prefer an explicit if/else (and keep statement terminators consistent) for clearer intent and more robust linting.
| collectionIgnoreGlobs.length > 0 | |
| ? console.info(`Build Scope excludes: "${process.env.BUILD_FULL_SITE}"`) | |
| : console.info("Build Scope includes all collections"); | |
| if (collectionIgnoreGlobs.length > 0) { | |
| console.info(`Build Scope excludes: "${process.env.BUILD_FULL_SITE}"`); | |
| } else { | |
| console.info("Build Scope includes all collections"); | |
| } |
| ignore: [ | ||
| "**/*.svg", | ||
| "**/learning-path/**", | ||
| "**/service-mesh-icons/**", | ||
| "**/app/**", | ||
| "**/learn-layer5/**", | ||
| "**/careers/**", | ||
| "**/callout/**", | ||
| "**/sistent/**", | ||
| "**/whiteboard/**", | ||
| ], |
There was a problem hiding this comment.
The ignore list is sizable and embedded inline, which makes it easier to accidentally add duplicates or lose track of the rationale for each entry. Consider extracting these patterns into a named constant (e.g., IMAGE_SOURCE_IGNORE_GLOBS) with a short comment explaining the criteria for exclusion (e.g., “excluded because not queried via GraphQL / not worth Sharp processing”) to keep future edits safer.
Description
This PR fixes #
Notes for Reviewers
Signed commits