Support for NPM aliases in dependencies #1568
Merged
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: Allow users to use NPM aliases in sushi-config.yaml so that they can load multiple versions of the same package. E.g.:
The only point of these aliases is to allow loading multiple versions of the same package -- so the aliases are not used or referenced in any actual FSH content.
Packages w/ multiple versions are loaded such that the latest version is loaded last. This way versionless resolution always goes to the latest version.
See: https://chat.fhir.org/#narrow/channel/179239-tooling/topic/NPM.20Aliases/near/517985527
NOTE: I originally thought we might need to update FHIR Package Loader to support NPM aliases, but I opted to keep its interface clean (since it already supports loading multiple versions of same package) and have SUSHI handle aliases before requesting packages from FHIR Package Loader.
Testing Instructions: Create a project that uses NPM aliases to declare dependencies on multiple versions of the same project. Ensure that SUSHI loads the dependencies without error and that you are able to reference definitions from any of those versions (note: there is a known issue w/ canonical versions declared as
Parent:
(#1553) orInstanceOf:
(#1559), so it's probably best to test referencing different versions by constraining references usingReference(a.b.c|1.2.3)
).To run the code from this branch:
npm install
to install the dependenciests-node src/app.ts build /path/to/fshproject
(may requirenpm install -g ts-node
)Related Issue: Fixes #1463