Skip to content

Conversation

@billhimmelsbach
Copy link
Contributor

@billhimmelsbach billhimmelsbach commented Mar 20, 2025

Changes

  • updates storybook to v8 to fix a number of vite/rollup conflicts during security vulnerability resolution
  • separates out just the Storybook parts from this PR to limit fixes to only security vulnerabilities / avoid forcing metro2 to update react in order to get these updates: Upgrade to React v19 and Storybook v8 #396

How to test this PR

  1. Does the site still load and does storybook appear to still work? Take a look at the deployed preview here.

Screenshots

Screenshot 2025-03-19 at 10 51 23 PM

Closes: #339

@netlify
Copy link

netlify bot commented Mar 20, 2025

Deploy Preview for cfpb-design-system-react ready!

Name Link
🔨 Latest commit a69cae1
🔍 Latest deploy log https://app.netlify.com/sites/cfpb-design-system-react/deploys/67f9703a47481e0008724302
😎 Deploy Preview https://deploy-preview-400--cfpb-design-system-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor Author

@billhimmelsbach billhimmelsbach left a comment

Choose a reason for hiding this comment

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

Added some comments here to make these storybook update changes a little easier to review.

options: {}
},
features: {
storyStoreV7: true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

storyStoreV7 not supported by v8 of storybook, and is no longer needed.

@@ -1,26 +1,30 @@
import turbosnap from 'vite-plugin-turbosnap';

module.exports = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of the changes in this file were done by the migration script.

@@ -0,0 +1 @@
!.storybook No newline at end of file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added for the eslint storybook configuration.

]
}
},
actions: { argTypesRegex: '^on[A-Z].*' },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We didn't use the ability to implicitly add jest spies and its no longer supported in v8, and I ran our stories through the suggested script yarn dlx storybook migrate find-implicit-spies against the codebase to make sure.

@@ -6,7 +6,7 @@ enableHardenedMode: true

enableMirror: true

enableOfflineMode: true
enableOfflineMode: false
Copy link
Contributor Author

@billhimmelsbach billhimmelsbach Mar 20, 2025

Choose a reason for hiding this comment

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

This yarn feature caused me all kinds of problems when trying to get this working, so I don't think it's worth it. A real footgun here.

@@ -1,4 +1,4 @@
import { useArgs } from '@storybook/client-api';
import { useArgs } from '@storybook/preview-api';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@storybook/client-api has changed to @storybook/preview-api, so went through and changed these after the calls failed.

@@ -1,6 +1,6 @@
import { expect } from '@storybook/jest';
import { expect } from '@storybook/test';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@storybook/jest has been removed and replaced by @storybook/test, so went through and changed these after the calls failed.

render: (arguments_) => <div style={{ minHeight: '200px' }}>
<Select {...arguments_} />
</div>
render: arguments_ => (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linting.

@@ -53,7 +53,7 @@ describe('<SelectMulti />', () => {
const label = 'MultiLabel';
const maxSelections = 2;
const user = userEvent.setup();
const onChange = jest.fn();
const onChange = fn();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replacing these with the @storybook/test method of mocking out these functions.

@billhimmelsbach
Copy link
Contributor Author

We'll have to wait to review or merge this @ojbravo until this Netlify contract issue is renewed / resolved on April 15th.

Copy link
Collaborator

@ojbravo ojbravo left a comment

Choose a reason for hiding this comment

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

It's working!

@billhimmelsbach billhimmelsbach merged commit 7d0c411 into main Apr 14, 2025
7 checks passed
@billhimmelsbach billhimmelsbach deleted the 339-update-storybook-for-security-2 branch April 14, 2025 15:43
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.

[Security] Update Storybook to v8 to fix a number of vulnerabilities

3 participants