Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

fix: generate correct registry URL #413

Merged
merged 2 commits into from
Jan 9, 2020
Merged

fix: generate correct registry URL #413

merged 2 commits into from
Jan 9, 2020

Conversation

DanielRuf
Copy link
Contributor

Type:
bug

The following has been addressed in the PR:

  • There is a related issue? Yes
  • Unit or Functional tests are included in the PR? Yes

Description:
This PR correctly transforms /in the devmode to a full URL like in production and generates the correct registry URL.

Important: update combineBaseUrl in node_modules/verdaccio/build/lib/utils.js to the result of verdaccio/verdaccio#1647

function combineBaseUrl(protocol, host, prefix) {
  const result = `${protocol}://${host}`;

  const prefixOnlySlash = prefix === '/';
  if (prefix && !prefixOnlySlash) {
    if (prefix.endsWith('/')) {
      prefix = prefix.slice(0, -1);
    }

    if (prefix.startsWith('/')) {
      return `${result}${prefix}`;
    }

    return prefix;
  }

  return result;
}

Resolves verdaccio/verdaccio#1648

@DanielRuf DanielRuf requested review from a team January 8, 2020 21:24
@DanielRuf DanielRuf changed the title fix: generate correct registry url fix: generate correct registry URL Jan 8, 2020
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Jan 8, 2020

Codecov Report

Merging #413 into master will not change coverage.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master     #413   +/-   ##
=======================================
  Coverage   88.38%   88.38%           
=======================================
  Files         137      137           
  Lines         956      956           
  Branches      211      197   -14     
=======================================
  Hits          845      845           
- Misses         98       99    +1     
+ Partials       13       12    -1
Impacted Files Coverage Δ
src/utils/url.ts 20% <100%> (ø) ⬆️
src/components/Icon/styles.ts 88.88% <0%> (ø) ⬆️

@DanielRuf
Copy link
Contributor Author

Please run yarn build && yarn test:e2e when reviewing / testing.

history.pushState({}, 'page title', '/-/web/detail');
expect(getRegistryURL()).toBe('http://localhost/-/web/detail');
Copy link
Member

Choose a reason for hiding this comment

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

Good one

Copy link
Member

@juanpicado juanpicado left a comment

Choose a reason for hiding this comment

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

Thanks @DanielRuf now looks much better.

@DanielRuf
Copy link
Contributor Author

@juanpicado keep in mind that we might need the fix from verdaccio itself too (regarding verdaccio/verdaccio#1647)

@DanielRuf DanielRuf deleted the fix/registry-url branch January 9, 2020 05:24
@juanpicado
Copy link
Member

@DanielRuf do you mean update here the verdaccio dep right?

@DanielRuf
Copy link
Contributor Author

Exactly. But I see now that this is not released. It's just covering specific use cases.

https://github.com/verdaccio/verdaccio/commits/master

So I guess it is safe to ship the current changes without updating the deps.

@juanpicado
Copy link
Member

It will be on Friday. I just need to close one PR and we are done :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect npm/pnpm/yarn register info when viewed from a package
2 participants