fix(npm-publish): Allows disabling of strict SSL checks #2952
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
Alias
strict-ssl
npm configuration setting tostrictSSL
publishopts
.Motivation and Context
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 ournpm 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 tonpm-registry-fetch
, butnpm-registry-fetch
is reading forstrictSSL
rather thanstrict-ssl
.closes #2942
How Has This Been Tested?
I monkey patched* the changes into a monorepo I was previously unable to publish to our private registry.
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'sJavaScript Debug Terminal
and placing a breakpoint on this line:lerna/utils/npm-publish/npm-publish.js
Line 91 in a47fc29
When in the un-aliased state, the
opts
/innerOpts
will still show astrict-ssl
value, but if youGo to Definition
orstep into
libnpmpublish
'spublish
method and follow down through tonpm-registry-fetch
's default export method, you'll find that it's passing theopts.strictSSL
property through tomake-fetch-happen
'sfetch
method:https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3d93c9b40488f8b1b62ac/index.js#L126
After implementing the alias change to
npm-publish.js
and re-running, the breakpoint will now showstrict-ssl
ANDstrictSSL
in theopts
. You can follow them down the function calls and see the value get passed correctly all the way tofetch
.I've included a unit test to validate this functionality performs the aliasing as expected.
* You could probably do the same with
npm link
. I just forgot to.Types of changes
Checklist:
Marty Henderson
, notGit McGitterson