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

feat(publish): Add --legacy-auth flag #2347

Merged
merged 7 commits into from Dec 15, 2019

Conversation

agirton
Copy link
Contributor

@agirton agirton commented Nov 15, 2019

Description

This PR adds a new(ish) _auth/legacy-auth flag to the publish command that allows users of lerna work with NPM registries that still use the "legacy" authorization type for publishing their packages. This _auth flag is already supported by npm, so the change is small.

Motivation and Context

There are some registries that still use the legacy NPM _auth flag for authorization. In the NPM docs they refer this auth type as "legacy". Lerna today does not support this flag, but it is supported by the npm publish command. Which means that if we need to pass in this authorization we have to opt out of all the goodness lerna publish command provides and use lerna exec to run the npm publish --_auth=Base64Str command.

How Has This Been Tested?

  • Added Unit tests (publish-command.test.js)
  • Added Integration tests (lerna-publish-auth.test.js)

Types of changes

  • 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 read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

commands/publish/README.md Outdated Show resolved Hide resolved
Copy link
Member

@evocateur evocateur left a comment

Choose a reason for hiding this comment

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

I'm half-inclined to only allow this config via lerna.json, avoiding the CLI bloat. Thoughts?

commands/publish/README.md Outdated Show resolved Hide resolved
@@ -35,6 +35,11 @@ exports.builder = yargs => {
type: "string",
requiresArg: true,
},
"legacy-auth": {
describe: "Legacy Base64 Encoded username and password.",
alias: "_auth",
Copy link
Member

Choose a reason for hiding this comment

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

--_auth is an extremely odd option name. Please don't add this alias.

Copy link
Contributor Author

@agirton agirton Nov 22, 2019

Choose a reason for hiding this comment

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

This is actually the same as the npm _auth flag. So using that as a signal that it's a pass through. But I can remove it and then put this in the description/docs.

We will still use _auth internally because that is what NPM expects.
@agirton
Copy link
Contributor Author

agirton commented Nov 22, 2019

@evocateur thank you so much for the review! Conflicts still need to be fixed, but let me know if everything else looks ok to you. This will be huge for us if merged in 😄

@evocateur evocateur changed the title Add NPM legacy auth flag to publish feat(publish): Add --legacy-auth flag Dec 15, 2019
@evocateur evocateur merged commit 0e9bda7 into lerna:master Dec 15, 2019
@evocateur
Copy link
Member

Thanks for your patience!

@agirton
Copy link
Contributor Author

agirton commented Dec 16, 2019

Hey @evocateur thank you for merging this in! Any idea when you would like to publish the next release? Did you want to wait till after the holidays?

@evocateur
Copy link
Member

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

2 participants