Skip to content

force publish for prereleased packages #567

Closed

Description

@spudly

My packages have to go through a QA process before published versions are deployed to production, so I create prerelease versions which are used during the QA process (for example, 1.1.0-rc.0, 1.1.0-rc.1. 1.1.0-rc.2, etc.). When I am satisfied that version is bug-free, I want to publish it with a non-prerelease version before deployment to production. When lerna publishes the packages, I want each prereleased package to be updated to the same non-prerelease version. Unfortunately, lerna only looks at the changes between tags, so lerna thinks there is nothing to update and doesn't update the package versions.

It'd be nice if there was a --force-publish-prereleased flag so that I could force all prerelease versions to be bumped to non-prereleased versions.

For example, assuming I had this setup and there were no changes since the last release:

lerna.json: 1.0.0-rc.1
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]

I would expect it to bump the versions as follows:

lerna.json: 1.0.1 <-- updated
├── [email protected] <-- not updated
├── [email protected] <-- updated
├── [email protected] <-- updated
├── [email protected] <-- not updated

Right now I can workaround by using --force-publish but that republishes lots of packages unnecessarily, so it's not ideal.

I should also note that I'm publishing from a CI server (jenkins) so my TTY is not interactive; I can't selectively choose versions for each package. I'm publishing using lerna publish --repo-version $VERSION --yes

I'm willing to work on a pull request if you can give me some assurance that a feature like this would be accepted. Also, I'm not married to --force-publish-prereleased so feel free to bikeshed all you want.

Activity

  1. evocateur commented on Feb 28, 2017

    @evocateur
    Member

    I too will soon enter the brave new world of auto-publishing from Jenkins, so I am sympathetic to this request. #607 is close to ready, but it doesn't completely cover your case here (since you don't want to increment all versions by a given semver keyword).

    It sounds like we need a flag similar to --scope (although ugh the name) that is also complementary to --cd-version....

  2. cif commented on Mar 1, 2017

    @cif
    Contributor

    I'd suggest simply supporting more --cd-version semver values a la https://github.com/sindresorhus/np#usage

    e.g. lerna publish --yes --cd-version=prerelease
    https://github.com/npm/node-semver#prerelease-identifiers

    Ahh, I see what you mean with --scope (rc | beta | alpha) now looking at semver.inc signature

  3. spudly commented on Mar 1, 2017

    @spudly
    ContributorAuthor

    Perhaps named scope groups?

    For example,

    lerna publish --scope-groups=updated,prereleased,my-custom-group

    Some of these scope groups would have to be pre-defined (like updated and prereleased). The default value would be 'updated' (current behavior). Maybe users could also define custom groups using globs in their lerna.json file:

    {
      "scope-groups": {
        "react-components": "@my-scope/react-component-*"
      }
    }

    We'd probably also have to add a corresponding --force-publish-groups option or, better yet, change --force-publish to respect --scope and --scope-groups).

    Either of the following would solve my use case:

    // if we add --force-publish-groups
    lerna publish --repo-version $VERSION --yes --force-publish-groups=prereleased
    
    // if we update --force-publish to respect --scope and --scope-groups
    lerna publish --repo-version $VERSION --yes --force-publish --scope-groups=prereleased
  4. cif commented on Mar 2, 2017

    @cif
    Contributor

    If I understand what you are trying for, then makes more sense to open a separate PR for "forcing package (unchanged, but QA/ready) to publish based on versions of scope type". That functionality would belong in UpdatedPackagesCollector.js.
    IMO beyond scope of my intentions with #607. Curious as to opinion of other contributors though, I have a bit of bandwidth this sprint but not as much as last two weeks.

  5. spudly commented on Mar 2, 2017

    @spudly
    ContributorAuthor

    @cif, I agree. Your PR is more about what the resulting version numbers are, whereas mine would be more about which packages are updated.

  6. lock commented on Dec 28, 2018

    @lock

    This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked as resolved and limited conversation to collaborators on Dec 28, 2018
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions