Upgrade Gatsby from 5.13.3 to 5.16.0 with React 18.3.1#3184
Upgrade Gatsby from 5.13.3 to 5.16.0 with React 18.3.1#3184kennethkalmer wants to merge 3 commits intomainfrom
Conversation
WalkthroughThe pull request modernizes the Gatsby build and development environment by refactoring asset compression to use an external worker file, introducing webpack configuration support via a new Gatsby Node API, updating core dependencies (Gatsby, React, and related ecosystem packages), adding MSW 2.x polyfills for testing, adjusting Jest configuration, and removing an unused CSS import. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
| /** | ||
| * From here on down is the worker code that is executed by the worker threads | ||
| * in Piscina to perform the actual compression. | ||
| * | ||
| * The number of iterations is set to 15 by default, but can be overridden by | ||
| * setting the ASSET_COMPRESSION_ITERATIONS environment variable. Lower number of | ||
| * iterations means faster compression but lower compression ratio (good for CI | ||
| * and review apps) | ||
| * | ||
| */ | ||
| const options = { | ||
| numiterations: parseInt(process.env.ASSET_COMPRESSION_ITERATIONS || '15', 10), | ||
| }; | ||
| const compress = async ({ from, to }) => { | ||
| const fileContent = await promises_1.default.readFile(from, 'utf8'); | ||
| const compressedContent = await (0, zopfli_1.gzipAsync)(fileContent, options); | ||
| await promises_1.default.writeFile(to, compressedContent); | ||
| }; | ||
| // This strange bit of code is to ensure we export a default function | ||
| // when we're being called by the Piscina worker | ||
| if (!worker_threads_1.isMainThread) { | ||
| module.exports = async ({ from, to }) => { | ||
| await compress({ from, to }); | ||
| }; | ||
| } |
There was a problem hiding this comment.
This bit of cleanup has no effect on the compression, the .gz versions are still being created during the build
The newer version of @ably/ui resolves the nested React dependency issues that previously required resolutions in package.json. This upgrade eliminates the need for React version forcing across nested Radix UI dependencies. Changes: - @ably/ui: 17.11.4 → 17.13.2 - Remove obsolete CookieMessage CSS import (component no longer exists) - es-toolkit@1.44.0 added as new dependency Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
This upgrades all Gatsby ecosystem packages to 5.16.0 to ensure compatibility and avoid webpack bundling conflicts. The upgrade includes security fixes for the qs vulnerability in body-parser. Package updates: - gatsby: 5.13.3 → 5.16.0 - All 19 gatsby-* plugins: → 5.16.0 - babel-preset-gatsby: 3.3.0 → 3.16.0 - react & react-dom: 18.2.0 → 18.3.1 - react-test-renderer: 18.2.0 → 18.3.1 - react-refresh: 0.14.0 → 0.14.2 - webpack@5.105.0 (added as dev dependency) Script changes: - build:compress: Added --skipLibCheck flag for TypeScript 4.6.3 compatibility with newer @types/node Resolutions: - Force single React version (18.3.1) across all packages to prevent duplicate React copies from Radix UI nested dependencies Reference: Gatsby 5.16.0 includes security updates and React 19 support (optional). This follows the same upgrade pattern as ably/voltaire PR #1437. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
These configuration changes enable the upgraded dependencies to work correctly with the build pipeline and test environment. Webpack configuration (gatsby-node.ts): - Add onCreateWebpackConfig hook with NormalModuleReplacementPlugin - Strip node: protocol prefix from imports to handle built-in modules - Add sqlite: false fallback to prevent webpack from trying to bundle - Borrowed from ably/voltaire gatsby-node.ts implementation Jest configuration (jest.config.js): - Add until-async to transformIgnorePatterns for MSW 2.x ESM support Jest polyfills (jest.polyfills.js): - Add BroadcastChannel from node:worker_threads for MSW 2.x - Add Web Streams API (ReadableStream, WritableStream, TransformStream) - These polyfills enable MSW 2.x to work in the Node.js test environment Build artifacts (data/onPostBuild/compressAssets.js): - Recompiled with --skipLibCheck flag Test results: 184 tests passing, 23 suites Build time: ~155 seconds All build artifacts generated successfully Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
baccd95 to
b698388
Compare
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Summary
This PR upgrades the Ably documentation site from Gatsby 5.13.3 to 5.16.0, including all related ecosystem packages and React 18.3.1. The upgrade brings security fixes, bug improvements, and maintains compatibility with the latest plugin ecosystem.
Key changes:
Commits
Upgrade @ably/ui from 17.11.4 to 17.13.2
Upgrade Gatsby from 5.13.3 to 5.16.0 with React 18.3.1
Add configuration for Gatsby 5.16.0 and MSW 2.x compatibility
Why This Upgrade
Test Results
✅ 23 test suites passed (1 skipped)
✅ 184 tests passed (1 skipped)
✅ 4 snapshots passed
✅ Build time: ~155 seconds
✅ All artifacts generated: 272 pages, 318 redirects, 582 compressed files
Test Plan
🤖 Generated with Claude Code
Summary by CodeRabbit