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: add peer dep alignment to constraints #3541

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

castastrophe
Copy link
Collaborator

@castastrophe castastrophe commented Feb 6, 2025

Description

Updated the constraints yarn.config.cjs:

  • Update the local package alignment to run on workspaces whether they have peerDependencies or not
  • Include peerDependencies, devDependencies, and dependencies in the package validation
  • Add logic to update any existing peerDependencies to reflect the local major version
  • Add a check that all local peerDependencies are listed as optional (reduce errors in downstream projects when packages installed or served separately)
  • Add logic to maintain consistent versions for external dependencies across workspaces

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 constraints, expect this to return warnings about misaligned shared dependencies, recommending update to the latest version required in the project
─ spectrum-css-monorepo@workspace:.
│  └─ ⚙ Invalid field devDependencies["postcss"]; expected '^8.5.0', found '^8.4.49'
  • yarn constraints, expect peerDependencies to match local major version, all local peerDependencies should be listed as optional in the peerDependenciesMeta
├─ @spectrum-css/tag@workspace:components/tag
│  ├─ ⚙ Invalid field peerDependencies["@spectrum-css/avatar"]; expected '>=9.0.0 <10.0.0', found '>=7'
│  ├─ ⚙ Invalid field peerDependencies["@spectrum-css/clearbutton"]; expected '>=7.0.0 <8.0.0', found '>=6'
│  ├─ ⚙ Invalid field peerDependencies["@spectrum-css/icon"]; expected '>=9.0.0 <10.0.0', found '>=7'
│  ├─ ⚙ Invalid field peerDependencies["@spectrum-css/tokens"]; expected '>=16.0.0 <17.0.0', found '>=14 || >=15'
│  └─ ⚙ Invalid field peerDependenciesMeta; expected { '@spectrum-css/avatar': { optional: true }, '@spectrum-css/clearbutton': { optional: true }, '@spectrum-css/icon': { optional: true }, '@spectrum-css/tokens': { optional: true } }, found { '@spectrum-css/avatar': { optional: true }, '@spectrum-css/icon': { optional: true } }

To-do list

  • I have read the contribution guidelines.
  • 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 Feb 6, 2025

🦋 Changeset detected

Latest commit: 7dbe129

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

This PR includes changesets to release 88 packages
Name Type
@spectrum-css/preview Patch
@spectrum-css/tokens Patch
@spectrum-css/accordion Patch
@spectrum-css/actionbar Patch
@spectrum-css/actionbutton Patch
@spectrum-css/actiongroup Patch
@spectrum-css/actionmenu Patch
@spectrum-css/alertbanner Patch
@spectrum-css/alertdialog Patch
@spectrum-css/asset Patch
@spectrum-css/assetcard Patch
@spectrum-css/assetlist Patch
@spectrum-css/avatar Patch
@spectrum-css/badge Patch
@spectrum-css/breadcrumb Patch
@spectrum-css/button Patch
@spectrum-css/buttongroup Patch
@spectrum-css/calendar Patch
@spectrum-css/card Patch
@spectrum-css/checkbox Patch
@spectrum-css/clearbutton Patch
@spectrum-css/closebutton Patch
@spectrum-css/coachindicator Patch
@spectrum-css/coachmark Patch
@spectrum-css/colorarea Patch
@spectrum-css/colorhandle Patch
@spectrum-css/colorloupe Patch
@spectrum-css/colorslider Patch
@spectrum-css/colorwheel Patch
@spectrum-css/combobox Patch
@spectrum-css/contextualhelp Patch
@spectrum-css/datepicker Patch
@spectrum-css/dial Patch
@spectrum-css/dialog Patch
@spectrum-css/divider Patch
@spectrum-css/dropindicator Patch
@spectrum-css/dropzone Patch
@spectrum-css/fieldgroup Patch
@spectrum-css/fieldlabel Patch
@spectrum-css/floatingactionbutton Patch
@spectrum-css/form Patch
@spectrum-css/helptext Patch
@spectrum-css/icon Patch
@spectrum-css/illustratedmessage Patch
@spectrum-css/infieldbutton Patch
@spectrum-css/inlinealert Patch
@spectrum-css/link Patch
@spectrum-css/logicbutton Patch
@spectrum-css/menu Patch
@spectrum-css/meter Patch
@spectrum-css/miller Patch
@spectrum-css/modal Patch
@spectrum-css/opacitycheckerboard Patch
@spectrum-css/page Patch
@spectrum-css/pagination Patch
@spectrum-css/picker Patch
@spectrum-css/pickerbutton Patch
@spectrum-css/popover Patch
@spectrum-css/progressbar Patch
@spectrum-css/progresscircle Patch
@spectrum-css/radio Patch
@spectrum-css/rating Patch
@spectrum-css/search Patch
@spectrum-css/sidenav Patch
@spectrum-css/slider Patch
@spectrum-css/splitview Patch
@spectrum-css/statuslight Patch
@spectrum-css/steplist Patch
@spectrum-css/stepper Patch
@spectrum-css/swatch Patch
@spectrum-css/swatchgroup Patch
@spectrum-css/switch Patch
@spectrum-css/table Patch
@spectrum-css/tabs Patch
@spectrum-css/tag Patch
@spectrum-css/taggroup Patch
@spectrum-css/textfield Patch
@spectrum-css/thumbnail Patch
@spectrum-css/toast Patch
@spectrum-css/tooltip Patch
@spectrum-css/tray Patch
@spectrum-css/treeview Patch
@spectrum-css/typography Patch
@spectrum-css/underlay Patch
@spectrum-css/well Patch
@spectrum-tools/stylelint-no-unused-custom-properties Patch
@spectrum-tools/postcss-add-theming-layer Patch
@spectrum-tools/postcss-property-rollup 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

@castastrophe castastrophe force-pushed the chore-align-peer-dependency-requirements branch 2 times, most recently from bb593b5 to 9cab2f6 Compare February 6, 2025 19:39
Copy link
Contributor

github-actions bot commented Feb 6, 2025

File metrics

Summary

Total size: 2.24 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.

@castastrophe castastrophe force-pushed the chore-align-peer-dependency-requirements branch 3 times, most recently from 59225b6 to e22d58a Compare February 6, 2025 20:06
@castastrophe castastrophe self-assigned this Feb 6, 2025
@castastrophe castastrophe added size-2 S ~6-18hrs; not hard or time consuming, one or two work days to complete. build Issues associated with the build process; often a refactor skip_vrt Add to a PR to skip running VRT (but still pass the action) ready-for-review labels Feb 6, 2025
Comment on lines +47 to +48
"@spectrum-css/tokens": {
"optional": true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"@spectrum-css/tokens": {
"optional": true
"@spectrum-css/tokens": {
"optional": true

Tokens shouldn't be appearing as optional should it? (appearing on multiple components)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So it's not optional to appear in the DOM with the component but it is optional whether downstream consumers choose to install it as a dependency in the same package. It's problematic for us to list it as a required peerDep because SWC ships those styles from different packages. I definitely don't want to loose the peerDependency information but thought this would be a good way to reduce errors in the install that just end up ignored.

Comment on lines +39 to +47
"@spectrum-css/icon": {
"optional": true
},
"@spectrum-css/menu": {
"optional": true
},
"@spectrum-css/popover": {
"optional": true
},
Copy link
Collaborator

@jawinn jawinn Feb 6, 2025

Choose a reason for hiding this comment

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

These aren't optional for a functioning Picker. I'm seeing a lot of components with peer dependencies added as optional that aren't really optional, or is there some other criteria here for what is optional that I'm not aware of?

Edit: I see the PR description mentions "all local peerDependencies should be listed as optional in the peerDependenciesMeta", could you explain that change?

"@spectrum-css/icon": ">=7",
"@spectrum-css/tokens": ">=14 || >=15"
"@spectrum-css/icon": ">=9.0.0 <10.0.0",
"@spectrum-css/tokens": ">=16.0.0 <17.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

For a lot of these semver range changes appearing with both >= and <, is there any reason not to use the caret range instead? For example, this line could just be "@spectrum-css/tokens": "^16.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.

They are equivalent, that's true. I just like the readability of this syntax in peerDeps; it's subtly more readable. Any reason to use caret instead?

@castastrophe castastrophe force-pushed the chore-align-peer-dependency-requirements branch 3 times, most recently from 803cbdd to a8faf4a Compare February 7, 2025 19:57
Copy link
Contributor

github-actions bot commented Feb 7, 2025

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

@castastrophe castastrophe force-pushed the chore-align-peer-dependency-requirements branch from a8faf4a to 7dbe129 Compare February 7, 2025 20:05
@castastrophe castastrophe merged commit 1a3245c into main Feb 7, 2025
12 checks passed
@castastrophe castastrophe deleted the chore-align-peer-dependency-requirements branch February 7, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues associated with the build process; often a refactor ready-for-review 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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants