Skip to content

Getting prompted for version despite using --canary --yes with lerna 2.1.0 #989

Closed

Description

@tkissing-work

Our canary builds broke after updating from 2.0.0 to 2.1.0, they now get stuck because lerna is asking our CI server to pick a version.

Expected Behavior

lerna publish --npm-client=npm --exact --loglevel silly --canary --yes --skip-git --skip-temp-tag "--registry" "https://REDACTED/artifactory/api/npm/npm-snapshot-local/"

lerna sill input [ 'publish' ]
lerna sill flags { _: [ 'publish' ],
lerna sill flags   exact: true,
lerna sill flags   yes: true,
lerna sill flags   'skip-git': true,
lerna sill flags   skipGit: true,
lerna sill flags   'npm-client': 'npm',
lerna sill flags   npmClient: 'npm',
lerna sill flags   loglevel: 'silly',
lerna sill flags   canary: true,
lerna sill flags   c: true,
lerna sill flags   'skip-temp-tag': true,
lerna sill flags   skipTempTag: true,
lerna sill flags   registry: 'https://REDACTED/artifactory/api/npm/npm-snapshot-local/' }
lerna verb rootPath /REDACTED/master
lerna info version 2.0.0
lerna sill isInitialized 
lerna sill isInitialized true
lerna sill existsSync /REDACTED/master/VERSION
lerna sill initialize attempt
lerna info canary enabled
lerna info current version 0.11.12

Current Behavior

lerna publish --npm-client=npm --exact --loglevel silly --canary --yes --skip-git --skip-temp-tag "--registry" "https://REDACTED/artifactory/api/npm/npm-snapshot-local/"

lerna sill input [ 'publish' ]
lerna sill flags { _: [ 'publish' ],
lerna sill flags   exact: true,
lerna sill flags   yes: true,
lerna sill flags   'skip-git': true,
lerna sill flags   skipGit: true,
lerna sill flags   'npm-client': 'npm',
lerna sill flags   npmClient: 'npm',
lerna sill flags   loglevel: 'silly',
lerna sill flags   canary: '',
lerna sill flags   c: '',
lerna sill flags   'skip-temp-tag': true,
lerna sill flags   skipTempTag: true,
lerna sill flags   registry: 'https://REDACTED/artifactory/api/npm/npm-snapshot-local/' }
lerna verb rootPath /REDACTED/master
lerna info version 2.1.0
lerna sill isInitialized 
lerna sill isInitialized true
lerna sill existsSync /REDACTED/master/VERSION
lerna sill initialize attempt
lerna info current version 0.11.12

Possible Solution

When I supply --canary --yes I should not be asked for a version.

Steps to Reproduce (for bugs)

  1. Run lerna publish --canary --yes
lerna.json

{
  "lerna": "2.0.0",
  "packages": [
    "packages/*"
  ],
  "npmClient": "yarn",
  "version": "0.11.12"
}

Context

Your Environment

Executable Version
lerna --version 2.1.0
npm --version 4.2.0
yarn --version 0.27.5
node --version 7.10.1
OS Version
Debian Jessie

Activity

  1. Jmsa commented on Aug 26, 2017

    @Jmsa

    I'm seeing this as well and tracked it back to the the addition of type: string in the "builder" definition in PublishCommand.js. It's linked to some proposed changes for #915 and apart of this commit 83aad8f.

    @tkissing-work It's hacky but (for me) one work around is to use --canary=HEAD instead of --canary. Just be aware that since the canary flag is used in the version bumping that this will add HEAD to new the version of a package. Example 1.0.1 => 1.1.0-HEAD.8db8964f.

    @shawnbot & @evocateur - It seems like the issues stems from trying to use canary (in 2.1.0) as a both a string and a boolean. For some other builder options it looks like there defaults that get set. If the plan is keep using that pattern the following (might be missing steps) should work, right?

    • Add a new default for canary - default: undefined
    • Change most checks to assert ...canary !== undefined
    • Change check in UpdatedPackagesCollector.collectUpdatedPackages() to look for undefined, but also to look at string length afterwards when deciding whether or not to use GitUtilities.getCurrentSHA
    • Update relevant test
  2. self-assigned this
    on Aug 26, 2017
  3. evocateur commented on Aug 26, 2017

    @evocateur
    Member

    @tkissing-work I'm really sorry for breaking this!

    @Jmsa Thanks so much for the investigation, it's a big help.

    I think it's pretty clear we need to reduce/remove the overloading of --canary as well as improve our tests to actually parse args with yargs instead of our synthetic constructor arguments. We have --preid and --since, after all, which should be documented as the preferred method of achieving --canary=<since> and --canary=<pre-release-id>.

    I'm going to start by restoring the default lerna publish --canary --yes behaviour ASAP, and then move toward fixing the other canary-related issues.

  4. evocateur commented on Aug 27, 2017

    @evocateur
    Member

    Once I fixed the unit tests to use the yargs parser, the errors became very clear:
    https://travis-ci.org/lerna/lerna/jobs/268804889#L1190

  5. added a commit that references this issue on Aug 27, 2017
    5a0ed55
  6. tkissing-work commented on Aug 28, 2017

    @tkissing-work
    Author

    Thanks for the work-around tip @Jmsa and for the quick fix @evocateur
    Bugs happen, it's the reaction to it that matters - and seeing more/better unit tests is the kind of reaction I like :)

  7. evocateur commented on Aug 29, 2017

    @evocateur
    Member

    This has been fixed in v2.1.1 :)

  8. 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.

  9. 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

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