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

feat: implement modules and compatibility check #327

Merged
merged 5 commits into from
Jul 29, 2024
Merged

feat: implement modules and compatibility check #327

merged 5 commits into from
Jul 29, 2024

Conversation

Yogu
Copy link
Member

@Yogu Yogu commented Jul 17, 2024

A project created with the withModuleDefinitions option enabled can now use the @modules directive to assign types and fields to modules. Calling withModuleSelection() on the resulting project then creates a new project where only types and fields of some of the modules are present.

Project.checkCompatibility() can be used to check if the project can be used in place of an other project, i.e. if it declares all types and fields in a compatbile manner.

Both features can be combined to check whether a project is compatible with a set of modules.

This PR introduces the basic features. More validation logic and improvements will follow.

Yogu added 2 commits July 23, 2024 13:30
This is an option that is discouraged in most scenarios. If it is present, the language service used by e.g. vs code suggests the wrong URLs for imports.
Since a recent update chai, "includes" errors are truncated, so they sometimes to not show the relevant part.

Also, using an includes check is risky, as shown in one of the tests that actually passed an empty string as the expected substring, so it did not test the message at all.
@Yogu Yogu changed the title WIP: Modules feat: implement modules and compatibility check Jul 23, 2024
@Yogu Yogu requested a review from Etienne-Buschong July 23, 2024 14:30
Copy link
Contributor

@Etienne-Buschong Etienne-Buschong left a comment

Choose a reason for hiding this comment

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

Code looks really good 🚀

@Yogu Yogu force-pushed the modules branch 3 times, most recently from 4997a21 to bd48d4b Compare July 25, 2024 16:14
A project created with the withModuleDefinitions option enabled can now use the @modules directive to assign types and fields to modules. Calling withModuleSelection() on the resulting project then creates a new project where only types and fields of some of the modules are present.

Project.checkCompatibility() can be used to check if the project can be used in place of an other project, i.e. if it declares all types and fields in a compatbile manner.

Both features can be combined to check whether a project is compatible with a set of modules.

This commit introduces the basic features. More validation logic and improvements will follow.
@Yogu
Copy link
Member Author

Yogu commented Jul 25, 2024

depdendency-check started to fail with an error that does not even include
a stack trace.

knip does a little bit more than dependency-check did. We disable some of
the rules because they just generate noise for now.

A note about the knip.json: every file suffixed by "!" is one that is used
in prod mode (npm run knip:prod).

knip found that some dependencies are not used - removed them.
@Etienne-Buschong
Copy link
Contributor

I think this MR is ready 👍

@Yogu
Copy link
Member Author

Yogu commented Jul 29, 2024

there will be some changes to the behavior in a follow-up commit.

@Yogu Yogu merged commit 7511d36 into main Jul 29, 2024
22 checks passed
@Yogu Yogu deleted the modules branch July 29, 2024 19:01
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.

2 participants