Skip to content

chore: harden recently updated scripts #3680

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

castastrophe
Copy link
Collaborator

@castastrophe castastrophe commented Apr 18, 2025

Description

Hind-sight is 20:20! I found a couple super minor updates to the scripts I recently worked on for the style-dictionary and Windows compatibility effort. I added notes inline to the code to help clarify these updates. It should just ensure we get more predictable results.

How and where has this been tested?

Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.

Validation steps

  • yarn builder tokens

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:
  • The pages render correctly, are accessible, and are responsive.
  1. If components have been modified, VRTs have been run on this branch:
  • VRTs have been run and looked at.
  • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • I have tested these changes in Windows High Contrast mode.
  • If my change impacts other components, I have tested to make sure they don't break.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

Copy link

changeset-bot bot commented Apr 18, 2025

⚠️ No Changeset found

Latest commit: f4571b3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@castastrophe castastrophe force-pushed the chore-harden-scripts branch from 6805649 to f4571b3 Compare April 18, 2025 19:26
Copy link
Contributor

github-actions bot commented Apr 18, 2025

File metrics

Summary

Total size: 2.25 MB*

🎉 No changes detected in any packages

* Size is the sum of all main files for packages in the library.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

Copy link
Contributor

github-actions bot commented Apr 18, 2025

🚀 Deployed on https://pr-3680--spectrum-css.netlify.app

@@ -137,6 +137,8 @@ jobs:
styles_modified_files: ${{ needs.changed_files.outputs.styles_modified_files }}
eslint_added_files: ${{ needs.changed_files.outputs.eslint_added_files }}
eslint_modified_files: ${{ needs.changed_files.outputs.eslint_modified_files }}
mdlint_added_files: ${{ needs.changed_files.outputs.mdlint_added_files }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These exports don't seem to be working so we're linking just all the files!

@@ -29,16 +29,31 @@ body {
}

.spectrum {
/* Gradient that changes with the color theme. */
--spectrum-examples-gradient: linear-gradient(45deg, var(--spectrum-magenta-1500), var(--spectrum-blue-1500));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These variables are specific to the Storybook so I think it makes sense to move their definitions here instead of inside the tokens package. I didn't remove them though in case downstream customers are leveraging them as well.

color: var(--spectrum-neutral-content-color-default);
background-color: var(--spectrum-background-base-color);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0%);
-webkit-tap-highlight-color: rgb(0, 0, 0, 0%);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was just an auto-fix ala VSCode stylelinting

# Legacy tools folder (included storybook & generator)
# test -d "tools" && rm -rf tools

test -d "tools" && rm -rf tools
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure why this is still here - we like and need the tools folder!!

@@ -9,7 +9,7 @@ export const format = ({ dictionary, platform, file, options }) => {
);

const convertRef = (ref) => {
return ref.replace(/\{(.*?)\}/g, `var(--${prefix}-$1)`);
return ref?.toString()?.replace(/\{(.*?)\}/g, `var(--${prefix}-$1)`);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sometimes ref is a number so this converts it to a string so we can tidy it up first

@@ -23,11 +23,11 @@ export const format = ({ dictionary, platform, file, options }) => {
if (data.ref) {
data.ref = convertRef(data.ref);

if (data.ref === data.value) {
if (data.ref?.toString() === data.value?.toString()) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This just ensures that the ref is converted to the same type before comparing (sometimes they're numbers).

@castastrophe castastrophe self-assigned this Apr 22, 2025
@castastrophe castastrophe marked this pull request as ready for review April 22, 2025 15:06
@castastrophe castastrophe added size-2 S ~6-18hrs; not hard or time consuming, one or two work days to complete. ready-for-review labels Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-review size-2 S ~6-18hrs; not hard or time consuming, one or two work days to complete.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant