feat(core-types): Create @rnx-kit/core-types package and consume types from that package #3961
+835
−336
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This change creates a new
@rnx-kit/core-typespackage for core configuration types, manifest types, lint types, and so on. This avoids pulling in implementations when not needed and generally cleans up the dependency graph.There are also several places where using rnx-kit packages via an API from outside rnx-kit weren't exposing types correctly because the types came from a devDependency package (because the implementation wasn't needed) but as a result the types weren't being exported correctly. Having a lightweight types package allows for these to be correctly marked as dependencies causing the types to resolve correctly from outside the repo.
KitConfig and Supporting Types
The
KitConfigwas coming out of the@rnx-kit/configpackage which was pulling in several metro plugin packages for the types. Some plugin types were defined in the config package, some were defined locally, regardless it created a bit of a dependency snarl. These were the primary types moved into the new package.Package Manifest Types
The
PackageManifesttype has been moved from tools-node into core-types. It has also been greatly improved by:I also added a
PackageDatatype which is designed as a parameter type for functions that want to take a folder and manifest pairing which can be fulfilled byPackageInfoor by other implementations. This will be used in subsequent changes.AllPlatforms
I also moved the
AllPlatformstype here, and changed it to be based on an array definition ensuring those stay in sync.Test plan
This is almost 100% type only (with the exception of the
ALL_PLATFORM_VALUESarray so automated tests + pipelines should be sufficient.