Skip to content

support --token=npmToken in lerna Publish #2404

Closed

Description

@hardfist

Expected Behavior

since npm publish cannot use NPM_TOKEN as environment, user must write token into .npmrc in order to do lerna publish in CI|CD environment, which is kind of annoying, I think pass token as parameter is more convenient just like what beachball is doing https://microsoft.github.io/beachball/ci-integration

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

lerna.json

<!-- Please paste your `lerna.json` here -->

lerna-debug.log

<!-- If you have a `lerna-debug.log` available, please paste it here -->
<!-- Otherwise, feel free to delete this <details> block -->

Context

Your Environment

Executable Version
lerna --version VERSION
npm --version VERSION
yarn --version VERSION
node --version VERSION
OS Version
NAME VERSION

Activity

  1. evocateur commented on Jan 6, 2020

    @evocateur
    Member

    lerna publish supports the exact same pattern as npm publish with respect to environment variables in npmrc files. Once NPM_TOKEN is configured in the CI variables, add this to your project root .npmrc file:

    //registry.npmjs.org/:_authToken=${NPM_TOKEN}

    Note that the only .npmrc file respected by Lerna is the project root. Per-package (leaf node) npmrc files are ignored entirely. There's also nothing special about the NPM_TOKEN variable name, it's just a convention.

  2. hardfist commented on Jan 7, 2020

    @hardfist
    Author

    unlike other variable name that we can put variable in environment variable, we must write token in .npmrc file, in a shared environment writing .npmrc will corrupt other user's .npmrc file, and it's also unsafe

  3. kylemh commented on Jul 28, 2020

    @kylemh

    If I put //registry.npmjs.org/:_authToken=${NPM_TOKEN} into a root-level .npmrc and try to commit without a valid NPM_TOKEN in my path, I get an error saying:

    error An unexpected error occurred: "Failed to replace env in config: ${NPM_TOKEN}".

    I understand why this happens, but this would be preventative for somebody working in this repo in an open source capacity - they wouldn't be able to contribute.

    edit: looks like I can do this in a GH action:

          - run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
            env:
              NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
    
  4. added a commit that references this issue on Dec 14, 2021
  5. added a commit that references this issue on Jan 16, 2022
  6. github-actions commented on Jun 3, 2022

    @github-actions
    Contributor

    Hi Folks 👋

    You may or may not know that lerna is now under the stewardship of Nrwl (announcement here #3121), a company with a long history of not just producing valuable open-source software (OSS), but also backing others (at the time of writing, Nrwl has donated over $50,000 to OSS it hasn't created, see https://opencollective.com/nx for full details).

    Quite simply, Nrwl ❤️ OSS, and is committed to making lerna the best it can be. We use it ourselves.

    In order to take this awesome project forward from its current state, it is important that we focus our finite resources on what is most important to lerna users in 2022.

    With that in mind, we have identified this issue as being potentially stale due to its age and/or lack of recent activity.


    Next steps:

    We want to give you some time to read through this comment and take action per one of the steps outlined below, so for the next 14 days we will not make any further updates to this issue.

    @hardfist as the original author of this issue, we are looking to you to update us on the latest state of this as it relates to the latest version of lerna.

    Please choose one of the steps below, depending on what type of issue this is:


    If we do not hear from @hardfist on this thread within the next 14 days, we will automatically close this issue.

    If you are another user impacted by this issue but it ends up being closed as part of this process, we still want to hear from you! Please simply head over to our new issue templates and fill out all the requested details on the template which applies to your situation:

    https://github.com/lerna/lerna/issues/new/choose

    Thank you all for being a part of this awesome community, we could not be more excited to help move things forward from here 🙏 🚀

  7. github-actions commented on Jun 17, 2022

    @github-actions
    Contributor

    Hi Folks 👋

    You will have seen in our message above that we at Nrwl are working really hard to bring the lerna repo up to date with what matters most to its community in June 2022.

    As previously stated in that message, because we have not heard from the original author of this issue within the last 14 days, we are now automatically closing it.

    If any users, including the original author, are still impacted by this issue then we still want to hear from you!

    All we ask is that you first update to the latest lerna (5.1.4 at the time of writing) to make sure it is still reproducible, and then fill out one of our new issue templates, providing all the requested details which apply to your situation:

    https://github.com/lerna/lerna/issues/new/choose

    Many thanks again! 🙏


    P.S. Over and above getting to grips with the repo, we have also been hard at work launching a new website, resolving all vulnerabilities, merging exciting new features and reigniting community PR contributions! 🚀

    You can read our recent blog post to learn more about what we've been up to:
    https://blog.nrwl.io/lerna-5-1-new-website-new-guides-new-lerna-example-repo-distributed-caching-support-and-speed-64d66410bec7

  8. locked and limited conversation to collaborators on Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions