Skip to content
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

chore: compare compiled output fixes #3616

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

castastrophe
Copy link
Collaborator

@castastrophe castastrophe commented Mar 12, 2025

Description

This cleans up a bit of the rendering for the compiled compare tool that lets us see any changes to the compiled output so that changes caused by updates to tooling do not get missed during review.

Why does this update remove the netlify.toml?

To build this view for PRs separately from our storybook deploy, we need to maintain different base directories and commands in netlify. This is done more easily in the Netlify UI than it is handled in our local *.toml asset. It also adds an additional layer of security to ensure updates made to these configs are handled by authenticated users.

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 compare Expect this command to build all CSS components and open an HTML preview listing file sizes with a badge identifying components with changes. Components will be listed on the side navigation for easier navigation through all the data.

To-do list

  • I have read the contribution guidelines.
  • [n/a] I have updated relevant storybook stories and templates.
  • [n/a] I have tested these changes in Windows High Contrast mode.
  • [n/a] 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 Mar 12, 2025

🦋 Changeset detected

Latest commit: 87df661

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@spectrum-tools/gh-action-file-diff Major
@spectrum-css/search Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

github-actions bot commented Mar 12, 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 Mar 12, 2025

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

@castastrophe castastrophe force-pushed the chore-compare-compiled-output branch 6 times, most recently from 809c192 to 05bfea3 Compare March 12, 2025 15:07
@@ -331,22 +331,16 @@ async function run() {
0
);
core.setOutput("total-size", headMainSize);

if (hasBase) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We want to output the has-changed value whether there's a base or not - this ensures has-changed is reflected every time this script is run and the logic matches that used above to report in the comment if changes occurred.

@@ -10,6 +10,12 @@ name: Compare
on:
workflow_call:
inputs:
deploy-message:
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 new variables are passed to Netlify just like the publish-site script does.

@@ -78,7 +78,6 @@ jobs:
publish-dir: dist
production-branch: main
production-deploy: false
netlify-config-path: ./netlify.toml
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removing this local configuration because it is more securely managed in the Netlify UI than as a locally committed asset.

@@ -7,6 +7,13 @@
"options": {
"printWidth": 500
}
},
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Standardizing the Github Action spacing to mimic more what we have in use today and to align with a lot of the examples for GitHub Actions that exist.

@@ -102,7 +102,7 @@
},
"compare": {
"cache": true,
"dependsOn": ["build"],
"dependsOn": ["build", { "projects": ["bundle"], "target": "build" }],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The compare tool uses the bundle to style the interface.

@@ -306,7 +300,6 @@ async function processComponent(
}

async function processFile(filename, localPath, comparePath) {
const componentName = localPath.split("/")[localPath.split("/").length - 2];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unused variable

@@ -371,13 +363,34 @@ async function main(

cleanAndMkdir(pathing.latest);

const promises = [];
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 moves the rendering assets to the .diff-output folder so it can be hosted together on Netlify.

@@ -480,11 +493,11 @@ async function main(

if (!hasAnyChange) {
log.write(`\n${"✓".green} No changes detected.\n`);
return Promise.resolve();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removing this lets the build continue with the web view whether changes are detected or not.

@castastrophe castastrophe force-pushed the chore-compare-compiled-output branch 4 times, most recently from 99448c8 to 9afcbe6 Compare March 12, 2025 20:06
@castastrophe castastrophe force-pushed the chore-compare-compiled-output branch from 9afcbe6 to dafd056 Compare March 12, 2025 20:44
@castastrophe castastrophe force-pushed the main branch 10 times, most recently from c68f4e3 to d2272ea Compare March 12, 2025 21:56
@castastrophe castastrophe force-pushed the chore-compare-compiled-output branch 2 times, most recently from 92504d4 to 489c55a Compare March 12, 2025 23:07
@castastrophe castastrophe self-assigned this Mar 12, 2025
@castastrophe castastrophe added the size-2 S ~6-18hrs; not hard or time consuming, one or two work days to complete. label Mar 12, 2025
@castastrophe castastrophe added wip This is a work in progress, don't judge. skip_vrt Add to a PR to skip running VRT (but still pass the action) low priority Not a critical update or fix; can be deprioritized if necessary labels Mar 12, 2025
@castastrophe castastrophe force-pushed the chore-compare-compiled-output branch 7 times, most recently from e42e913 to d1b088b Compare March 13, 2025 19:57
@castastrophe castastrophe force-pushed the chore-compare-compiled-output branch from d1b088b to 87df661 Compare March 18, 2025 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low priority Not a critical update or fix; can be deprioritized if necessary size-2 S ~6-18hrs; not hard or time consuming, one or two work days to complete. skip_vrt Add to a PR to skip running VRT (but still pass the action) wip This is a work in progress, don't judge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants