-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Storybook] Fix styles in editor stories (#802)
## Summary: After upgrading to Storybook v7 (#790), Nicole noticed that some of our styles in Editor stories was missing/broken. This PR fixes it with the following changes (not all required, but the move for `main.ts` => `main.ts` seemed really easy and very useful!): * 🛠️ Add explicit deps for less-loader, css-loader, and style-loader. Previously, we depended on these modules indirectly and didn't have explicit control over which version of each we had. Turns out we had some really old versions and upgrading them fixed some of the issues. * ✨ Migrate Storybook config to TS. * ✨ Use Storybook config types and fix up framework ref * 🛠️ Make less-loader work as it used to (eager math evaluation) * 🛠️ Ensure perseus-editor.less is imported in Editor demo stories <img width="800" alt="image" src="https://github.com/Khan/perseus/assets/77138/16c35a72-faf6-4cca-a007-18910ea39444"> ## Dependency Details I've included `yarn why` output for both `style-loader` and `css-loader` modules, which are part of this PR (for historical purposes). Both of these were "anchored" to a super-old version because of the `size-limit` dependency in the `simple-markdown` package. We don't use or need that package anymore so I've removed it. I think it's safe to upgrade them as we don't use them to build our production bundles (we use Rollup for that and not Webpack!). <details> <summary> <code>style-loader</code> </summary> ```sh $ yarn why style-loader yarn why v1.22.19 [1/4] 🤔 Why do we have the module "style-loader"...? [2/4] 🚚 Initialising dependency graph... [3/4] 🔍 Finding dependency... [4/4] 🚡 Calculating file sizes... => Found "[email protected]" info Reasons this module exists - "_project_#@khanacademy#simple-markdown#size-limit" depends on it - Hoisted from "_project_#@khanacademy#simple-markdown#size-limit#style-loader" info Disk size without dependencies: "404KB" info Disk size with unique dependencies: "756KB" info Disk size with transitive dependencies: "3.39MB" info Number of shared dependencies: 12 => Found "@storybook/builder-webpack5#[email protected]" info This module exists because "_project_#@storybook#react-webpack5#@storybook#builder-webpack5" depends on it. info Disk size without dependencies: "132KB" info Disk size with unique dependencies: "132KB" info Disk size with transitive dependencies: "132KB" info Number of shared dependencies: 0 ✨ Done in 0.48s. ``` </details> <details> <summary> <code>css-loader</code> </summary> ```sh $ yarn why css-loader yarn why v1.22.19 [1/4] 🤔 Why do we have the module "css-loader"...? [2/4] 🚚 Initialising dependency graph... [3/4] 🔍 Finding dependency... [4/4] 🚡 Calculating file sizes... => Found "[email protected]" info Reasons this module exists - "_project_#@khanacademy#simple-markdown#size-limit" depends on it - Hoisted from "_project_#@khanacademy#simple-markdown#size-limit#css-loader" info Disk size without dependencies: "700KB" info Disk size with unique dependencies: "3.31MB" info Disk size with transitive dependencies: "7.15MB" info Number of shared dependencies: 26 => Found "@storybook/builder-webpack5#[email protected]" info This module exists because "_project_#@storybook#react-webpack5#@storybook#builder-webpack5" depends on it. ✨ Done in 0.51s. ``` </details> Issue: LC-1459 ## Test plan: Run `yarn; yarn start` Navigate to **Perseus** >> **Editor** >> **Demo** and compare to the Jira ticket's "Before" screenshot. It should match! Author: jeremywiebe Reviewers: jeremywiebe, nedredmond, handeyeco, SonicScrewdriver Required Reviewers: Approved By: nedredmond Checks: ⌛ gerald, ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage, ⏭ Publish npm snapshot, ✅ Publish Storybook to Chromatic (ubuntu-latest, 16.x), ✅ Extract i18n strings (ubuntu-latest, 16.x), ✅ Check builds for changes in size (ubuntu-latest, 16.x), ✅ Cypress (ubuntu-latest, 16.x), ✅ Jest Coverage (ubuntu-latest, 16.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 16.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 16.x), ✅ gerald Pull Request URL: #802
- Loading branch information
1 parent
9b28bbc
commit 57e0e18
Showing
11 changed files
with
236 additions
and
2,090 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/simple-markdown": minor | ||
--- | ||
|
||
Remove unused dependencies: size-limit and uglify-js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/simple-markdown": minor | ||
--- | ||
|
||
Remove unused dependencies: size-limit and uglify-js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"perseus-build-settings": minor | ||
--- | ||
|
||
Adjust builds so that less handles math the way it did in older versions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"changesets": [ | ||
{ | ||
"releases": [ | ||
{ | ||
"name": "@khanacademy/simple-markdown", | ||
"type": "minor" | ||
} | ||
], | ||
"summary": "Remove unused dependencies: size-limit and uglify-js", | ||
"id": "curvy-pumpkins-bow" | ||
}, | ||
{ | ||
"releases": [ | ||
{ | ||
"name": "@khanacademy/simple-markdown", | ||
"type": "minor" | ||
} | ||
], | ||
"summary": "Remove unused dependencies: size-limit and uglify-js", | ||
"id": "grumpy-cameras-fetch" | ||
} | ||
], | ||
"releases": [ | ||
{ | ||
"name": "@khanacademy/simple-markdown", | ||
"type": "minor", | ||
"oldVersion": "0.10.4", | ||
"changesets": [ | ||
"curvy-pumpkins-bow", | ||
"grumpy-cameras-fetch" | ||
], | ||
"newVersion": "0.11.0" | ||
}, | ||
{ | ||
"name": "@khanacademy/perseus", | ||
"type": "patch", | ||
"oldVersion": "13.1.0", | ||
"changesets": [], | ||
"newVersion": "13.1.1" | ||
}, | ||
{ | ||
"name": "@khanacademy/pure-markdown", | ||
"type": "patch", | ||
"oldVersion": "0.2.10", | ||
"changesets": [], | ||
"newVersion": "0.2.11" | ||
}, | ||
{ | ||
"name": "@khanacademy/perseus-editor", | ||
"type": "patch", | ||
"oldVersion": "2.9.1", | ||
"changesets": [], | ||
"newVersion": "2.9.2" | ||
}, | ||
{ | ||
"name": "@khanacademy/perseus-linter", | ||
"type": "none", | ||
"oldVersion": "0.3.8", | ||
"changesets": [], | ||
"newVersion": "0.3.8" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.