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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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!

mdlint_modified_files: ${{ needs.changed_files.outputs.mdlint_modified_files }}
secrets: inherit

# -------------------------------------------------------------
Expand Down
19 changes: 17 additions & 2 deletions .storybook/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -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.


/* Gradients that do not change with the color theme, for use in static color backgrounds. */
--spectrum-examples-gradient-static-black: linear-gradient(45deg, rgb(255 241 246), rgb(238 245 255));
--spectrum-examples-gradient-static-white: linear-gradient(45deg, rgb(64 0 22), rgb(14 24 67));

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

}

.spectrum.spectrum--legacy {
color: var(--spectrum-neutral-content-color-default);
background-color: var(--spectrum-background-layer-1-color);
}

.spectrum .spectrum-examples-static-black {
background: var(--spectrum-examples-gradient-static-black);
}

.spectrum .spectrum-examples-static-white {
background: var(--spectrum-examples-gradient-static-white);
}

/* Hide the SVG elements that only include references */
svg:has(symbol):not(:has(use)) {
display: none;
Expand All @@ -58,7 +73,7 @@ svg:has(symbol):not(:has(use)) {
line-height: normal;
letter-spacing: normal;
text-transform: none;
border-block-end: 1px solid hsla(203deg, 50%, 30%, 15%);
border-block-end: 1px solid hsl(203deg, 50%, 30%, 15%);
}

/* Force the modal wrapper to be contained by the frame not the viewport */
Expand Down
5 changes: 0 additions & 5 deletions tasks/clean-up-after-migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
# After migrating from our old build system, there are a lot of empty folders hanging out still
# This script aims to clean up those folders

# 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!!


# Remove deprecated files
for folder in components/*; do
# Only processing nested folders, not top-level files
Expand Down
6 changes: 3 additions & 3 deletions tokens/utilities/data-json-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

};

const deconstructSets = (obj, scope = undefined) => {
Expand All @@ -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).

delete data.ref;
}
}

if (data.sets) {
data = deconstructSets(data, context);

Expand Down
Loading