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

Exposes packages to constraints #5555

Merged
merged 2 commits into from
Jul 2, 2023
Merged

Exposes packages to constraints #5555

merged 2 commits into from
Jul 2, 2023

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Jul 2, 2023

What's the problem this PR addresses?

Constraints can only operate on the workspaces' listed dependencies, but have no idea about the shape of the global dependency tree. In general it's enough, but I wanted to write a constraint autofixing missing peer dependencies, and this wasn't possible without knowing the dependencies of our dependencies.

How did you fix it?

I added a concept of "package" to the constraint API. Some of their characteristics:

  • They are based on the resolved dependency tree; as a result, there is no direct concept of devDependency / dependency (just like in the core Package type).

  • They somewhat look like the Package type, but with fewer information (just the dependencies & peer dependencies, at the moment), and with a slightly different format (no need for serialization, so it directly references other data structure rather than go through string hashes).

  • They don't provide any autofix (or even reporting) capability at the moment. Perhaps later I'll add an error API, like regular dependencies, but that'll probably require to enhance them so they are able to access the packages' filesystems, so it'll have to be a follow-up.

Testing is currently lacking ... like the rest of the JS constraints engine 😶‍🌫️

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis arcanis merged commit 634daae into master Jul 2, 2023
@arcanis arcanis deleted the mael/constraints-packages branch July 2, 2023 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant