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

fix(npm-publish): Allows disabling of strict SSL checks #374

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

ghiscoding
Copy link
Member

@ghiscoding ghiscoding commented Oct 10, 2022

Description

As per Lerna PR 2952

Alias strict-ssl npm configuration setting to strictSSL publish opts.

Motivation and Context

As per Lerna PR

Since lerna 4, npm_config_strict_ssl=false is not respected by the publish process. My team publishes to an internal private registry for CI builds to avoid polluting our npm view [package] versions unnecessarily, but we don't (currently?) have SSL working on that garbage heap.

While strict-ssl is resolved out of environment and npm settings in @lerna/npm-conf, there's nothing downstream looking for that. libnpmpublish passes all extra arguments directly down to npm-registry-fetch, but npm-registry-fetch is reading for strictSSL rather than strict-ssl.

How Has This Been Tested?

As per Lerna PR

Prior to implementing the changes, adding npm_config_strict_ssl=false either A) prepended on the command line (npm_config_strict_ssl=false npx lerna publish ....) as environment; or B) applied in a root-level .npmrc file would have no impact. This can be validated by running the lerna command in VS Code's JavaScript Debug Terminal and placing a breakpoint on this line:

When in the un-aliased state, the opts / innerOpts will still show a strict-ssl value, but if you Go to Definition or step into libnpmpublish's publish method and follow down through to npm-registry-fetch's default export method, you'll find that it's passing the opts.strictSSL property through to make-fetch-happen's fetch method:

After implementing the alias change to npm-publish.js and re-running, the breakpoint will now show strict-ssl AND strictSSL in the opts. You can follow them down the function calls and see the value get passed correctly all the way to fetch.

I've included a unit test to validate this functionality performs the aliasing as expected.

Types of changes

  • Chore (change that has absolutely no effect on users)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Oct 10, 2022

Codecov Report

Merging #374 (ea7b89f) into main (ff5e99a) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #374   +/-   ##
=======================================
  Coverage   97.08%   97.08%           
=======================================
  Files         145      145           
  Lines        4278     4278           
  Branches      980      980           
=======================================
  Hits         4153     4153           
  Misses        125      125           
Impacted Files Coverage Δ
packages/publish/src/lib/npm-publish.ts 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ghiscoding ghiscoding merged commit a26d849 into main Oct 10, 2022
@ghiscoding ghiscoding deleted the bugfix/allow-strict-ssl-disabling branch October 10, 2022 04:37
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.

None yet

1 participant