-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRAFT: Make process-spectrum more robust #4999
base: main
Are you sure you want to change the base?
Conversation
|
Branch previewReview the following VRT differencesWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
If the changes are expected, update the |
Pull Request Test Coverage Report for Build 12419886032Details
💛 - Coveralls |
Tachometer resultsChromeaccordion permalinkbasic-test
action-bar permalinkbasic-test
action-button permalinkbasic-test
action-group permalinkbasic-test
action-menu permalinktest-basic
test-directive permalink
test-lazy permalink
test-open-close-directive permalink
test-open-close permalink
alert-banner permalinkbasic-test
alert-dialog permalinkbasic-test
asset permalinkbasic-test
avatar permalinktest-basic
badge permalinkbasic-test
breadcrumbs permalinkbasic-test
button-group permalinkbasic-test
button permalinktest-basic
card permalinktest-basic
checkbox permalinktest-basic
coachmark permalinkbasic-test
color-area permalinkbasic-test
color-field permalinkbasic-test
color-handle permalinkbasic-test
color-loupe permalinkbasic-test
color-slider permalinkbasic-test
color-wheel permalinkbasic-test
combobox permalinkbasic-test
light-dom-test permalink
contextual-help permalinkbasic-test
dialog permalinkbasic-test
divider permalinkbasic-test
dropzone permalinktest-basic
field-group permalinkbasic-test
field-label permalinkbasic-test
grid permalinkbasic-test
help-text permalinkbasic-test
icon permalinktest-basic
illustrated-message permalinktest-basic
infield-button permalinkbasic-test
link permalinktest-basic
menu permalinktest-basic
meter permalinkbasic-test
number-field permalinkbasic-test
overlay permalinkbasic-test
directive-test permalink
element-test permalink
lazy-test permalink
picker-button permalinkbasic-test
picker permalinkbasic-test
popover permalinktest-basic
progress-bar permalinkbasic-test
progress-circle permalinkbasic-test
radio permalinktest-basic
search permalinktest-basic
sidenav permalinktest-basic
slider permalinktest-basic
split-view permalinkbasic-test
swatch permalinkbasic-test
switch permalinktest-basic
table permalinkbasic-test
tabs permalinkbasic-test
tags permalinkbasic-test
textfield permalinktest-basic
thumbnail permalinkbasic-test
toast permalinktest-basic
tooltip permalinktest-basic
test-directive permalink
test-element permalink
test-lazy permalink
top-nav permalinkbasic-test
tray permalinkbasic-test
truncated permalinkbasic-test
underlay permalinkbasic-test
Firefoxaccordion permalinkbasic-test
action-bar permalinkbasic-test
action-button permalinkbasic-test
action-group permalinkbasic-test
action-menu permalinktest-basic
test-directive permalink
test-lazy permalink
test-open-close-directive permalink
test-open-close permalink
alert-banner permalinkbasic-test
alert-dialog permalinkbasic-test
asset permalinkbasic-test
avatar permalinktest-basic
badge permalinkbasic-test
breadcrumbs permalinkbasic-test
button-group permalinkbasic-test
button permalinktest-basic
card permalinktest-basic
checkbox permalinktest-basic
coachmark permalinkbasic-test
color-area permalinkbasic-test
color-field permalinkbasic-test
color-handle permalinkbasic-test
color-loupe permalinkbasic-test
color-slider permalinkbasic-test
color-wheel permalinkbasic-test
combobox permalinkbasic-test
light-dom-test permalink
contextual-help permalinkbasic-test
dialog permalinkbasic-test
divider permalinkbasic-test
dropzone permalinktest-basic
field-group permalinkbasic-test
field-label permalinkbasic-test
grid permalinkbasic-test
help-text permalinkbasic-test
icon permalinktest-basic
illustrated-message permalinktest-basic
infield-button permalinkbasic-test
link permalinktest-basic
menu permalinktest-basic
meter permalinkbasic-test
number-field permalinkbasic-test
overlay permalinkbasic-test
directive-test permalink
element-test permalink
lazy-test permalink
picker-button permalinkbasic-test
picker permalinkbasic-test
popover permalinktest-basic
progress-bar permalinkbasic-test
progress-circle permalinkbasic-test
radio permalinktest-basic
search permalinktest-basic
sidenav permalinktest-basic
slider permalinktest-basic
split-view permalinkbasic-test
swatch permalinkbasic-test
switch permalinktest-basic
table permalinkbasic-test
tabs permalinkbasic-test
tags permalinkbasic-test
textfield permalinktest-basic
thumbnail permalinkbasic-test
toast permalinktest-basic
tooltip permalinktest-basic
test-directive permalink
test-element permalink
test-lazy permalink
top-nav permalinkbasic-test
tray permalinkbasic-test
truncated permalinkbasic-test
underlay permalinkbasic-test
|
} else { | ||
// For the same reason, we write an empty file if the bridge file | ||
// doesn't exist (in case it previously did). | ||
writeMachineGeneratedSourceFile(overridesPath, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we delete the file entirely if it’s empty instead of writing an empty file? 💭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! That was my first instinct as well, but then I recalled that these generated foo-overrides.css
files are imported by manually maintained foo.css
files.
If we allow the override files to be routinely created / deleted, we would either need to start having the script modify the otherwise-manually-maintained files to update the imports, OR depend on ourselves to notice the deletions and make the corresponding edits.
Neither of those solutions seemed great, and since most of the components do in fact have overrides files, it seemed like unconditionally creating the overrides was the least-bad option, since it allows the manually maintained files to remain stable. I'm open to being convinced otherwise, though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, I'm hoping that all of this stuff can be made to go away in our post-1.x setup!
function writeMachineGeneratedSourceFile(outputPath, code) { | ||
fs.writeFileSync( | ||
outputPath, | ||
`/* | ||
Copyright 2023 Adobe. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We can bump this to 2025 😄 🥳
Description
Make
tasks/process-spectrum
more robust to changes in CSS theme overrides.Making this a draft for now, as it may need discussion.
Related issue(s)
Motivation and context
When I first got the SWC CSS files in my combined monorepo proof-of-concept building directly from the CSS workspaces, I found that a bunch of the styling was visibly broken in Storybook. After poking around a bit, I determined that this was because bunch of the components were referencing
--system-foo-bar-baz
custom properties that weren't actually defined. Looking further, it seemed like:The CSS at the tip of s2-foundations-redux (which was where I'd pulled from) no longer defined a bunch of theme-specific variables that previously been present in the released versions of the CSS components that SWC had been referencing (presumably because they were no longer necessary—yay!)
The logic in SWC's
tasks/process-spectrum script
wasn't well equipped to deal with the case where previously existing CSS theme files were removed. Specifically,process-spectrum
avoided writing*-overrides.css
files for non-existent or empty theme files. This seems logical enough, but causes problems because it means that "stale"*-overrides.css
files are left behind when the corresponding theme files go away.I tweaked the logic in
process-spectrum
to unconditionally write*-overrides.css files
, and that seemed to take care of the problem.How has this been tested?
Test case 1
Test case 2
Did it pass in Desktop?
Did it pass in Mobile?
Did it pass in iPad?
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.