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

[Feature] Better documentation for yarn constraints command #6235

Open
1 of 8 tasks
broofa opened this issue Apr 16, 2024 · 0 comments
Open
1 of 8 tasks

[Feature] Better documentation for yarn constraints command #6235

broofa opened this issue Apr 16, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@broofa
Copy link

broofa commented Apr 16, 2024

  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

Long-time yarn user, but first time diving into the yarn constraints command (JS-based version in yarn@4, not the old Prolog version). My first impression of the docs (https://yarnpkg.com/features/constraints) is that they're enough to just barely get started, but are missing the key information to allow a developer to actually do anything useful.

Specifically, it'd be nice to have answers to the following questions ...

  • What is the API of the Yarn object passed to the constraints() method?
  • What is the "shape" of the arguments passed to the various Yarn.* methods? ("The examples show you can pass an object with an ident string property. What are the allowed patterns / values for that property? What other properties can be provided?)
  • What is the API of the various sub-objects w/in the Yarn API? What are the return values for methods like dependencies and workspaces? What is the API for those things?
  • What is the recommended way of surfacing a constraint violation? (E.g. "Should I throw an Error? If so, what type?")

After a big of digging, I found the following resources that I suspect developers would find helpful. These aren't really documentation per-se, but they at least provide some information that answers some of the above questions:

Adding examples for the following would be helpful:

  • Handling a dependency constraint violation (call dependency.error()?)
  • Handling a workspace constraint violation (call workspace.error()?)
@broofa broofa added the enhancement New feature or request label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant