8000 Support for NPM aliases in dependencies by cmoesel · Pull Request #1568 · FHIR/sushi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support for NPM aliases in dependencies #1568

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

Merged
merged 1 commit into from
May 19, 2025
Merged

Support for NPM aliases in dependencies #1568

merged 1 commit into from
May 19, 2025

Conversation

cmoesel
Copy link
Member
@cmoesel cmoesel commented May 19, 2025

Description: Allow users to use NPM aliases in sushi-config.yaml so that they can load multiple versions of the same package. E.g.:

dependencies:
  hl7.fhir.us.core: 7.0.0
  v610@npm:hl7.fhir.us.core: 6.1.0
  v311@npm:hl7.fhir.us.core: 3.1.1

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) or InstanceOf: (#1559), so it's probably best to test referencing different versions by constraining references using Reference(a.b.c|1.2.3)).

To run the code from this branch:

  1. Check out the branch in git
  2. Run npm install to install the dependencies
  3. Run the following command: ts-node src/app.ts build /path/to/fshproject (may require npm install -g ts-node)

Related Issue: Fixes #1463

Allow users to use NPM aliases in sushi-config.yaml so that they can load multiple versions of the same package. E.g.:
```
dependencies:
  hl7.fhir.us.core: 7.0.0
  v610@npm:hl7.fhir.us.core: 6.1.0
  v311@npm:hl7.fhir.us.core: 3.1.1
```
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
@cmoesel cmoesel requested a review from jduteau May 19, 2025 14:01
@jduteau jduteau merged commit f79e562 into master May 19, 2025
14 checks passed
@cmoesel cmoesel deleted the npm-alias branch May 20, 2025 12:17
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.

Support New Syntax to Declare Multiple Versions of the Same Dependency
2 participants
0