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

Handle scoped packages when removing version #1181

Merged
merged 4 commits into from
Mar 1, 2021

Conversation

Taiters
Copy link

@Taiters Taiters commented Feb 26, 2021

Please provide enough information so that others can review your pull request:

Fix for #1178 (Scoped packages being incorrectly handled when removing the version)

When stripping the version from a package string, we first separate the base name and directory. This is done so we can separate the scope (if present) from the package name, before using split to remove the package's version. Once removed, we return the full package with path.join

I've moved this code into a split-version utility, which is now called by link-missing-dependencies and npm-utils.

Test plan (required)

Unit tests have been added for split-version.js to cover the following cases:

  • Passing a non-scoped package, both with and without a version
  • Passing a scoped package, both with and without a version

Daniel Tait added 2 commits February 26, 2021 17:30
This is done by:
- Separating the path directory and base
- Splitting the version on the base as before (The scope is in the dir string)
- Returning the joined directory and name
@Taiters Taiters changed the title Scoped packages fix Handle scoped packages when removing version Feb 26, 2021
@matteofigus matteofigus merged commit 1975adf into opencomponents:master Mar 1, 2021
@matteofigus
Copy link
Member

Thanks!

@Taiters Taiters deleted the scoped-packages-fix branch March 1, 2021 13: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.

2 participants