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

Lerna publish flag --conventional-commits doesn't work with --npm-tag flag #1498

Closed
mocheng opened this issue Jul 12, 2018 · 15 comments
Closed

Comments

@mocheng
Copy link

mocheng commented Jul 12, 2018

Expected Behavior

I have one project that have one trunk branch to release with dist-tag latest. For next major version, there is another branch task/v3 to release with dist-tag v3.

The script is like below:

lerna publish --conventional-commits --exact --npm-tag=v3

It is expected to publish all packages with conventional-commits and on dist-tag v3.

Current Behavior

The script failed with message like below:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! publish:v3: lerna publish --conventional-commits --exact --npm-tag=v3
npm ERR! Exit status 1

Possible Solution

It looks that the two flags --conventional-commits and --npm-tag are not compatible.

Your Environment

Executable Version
lerna --version 3.0.0-beta.21
npm --version 5.6.0
node --version v6.13.0
OS Version
macOS Sierra 10.13.5
@bmuenzenmeyer
Copy link

@mocheng if you use one or the other, does it appear to work?

@mocheng
Copy link
Author

mocheng commented Jul 13, 2018

@bmuenzenmeyer It works well if I use either `--conventional-commits" or "--npm-tag=v3" only.

@evocateur
Copy link
Member

I can't reproduce without your lerna.json and more detailed repo state.

@stale
Copy link

stale bot commented Dec 27, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@alampros
Copy link

alampros commented Jan 4, 2019

I'm running into a similar issue with the --canary flag and --conventional-commits.

My lerna.json:

{
  "packages": [
    "packages/*"
  ],
  "version": "independent",
  "npmClient": "yarn",
  "useWorkspaces": true,
  "command": {
    "publish": {
      "conventionalCommits": true,
      "message": "chore(release): publish [skip-ci]"
    }
  },
  "ignoreChanges": [
    "packages/*/test/**",
    "packages/*/test-server/**"
  ]
}

Shell Output (scrubbed)

yarn ci-publish --canary --preid beta --npm-tag next --yes
yarn run v1.12.3
$ lerna publish --canary --preid beta --npm-tag next --yes
lerna notice cli v3.8.4
lerna info versioning independent
lerna info ci enabled
lerna info canary enabled
lerna WARN Yarn's registry proxy is broken, replacing with public npm registry
lerna WARN If you don't have an npm token, you should exit and run `npm login`
lerna info Looking for changed packages since 1bf4a0d^..1bf4a0d
Found 1 package to publish:
 - @[-org-]/[-packagename-] => 0.8.2-beta.2+1bf4a0d
lerna info auto-confirmed 
lerna info publish Publishing packages to npm...
lerna info Verifying npm credentials
lerna http fetch GET 200 https://registry.npmjs.org/-/npm/v1/user 313ms
lerna http fetch GET 200 https://registry.npmjs.org/-/org/[-user-]/package?format=cli 117ms
lerna success published @[-org-]/[-packagename-] 0.8.2-beta.2+1bf4a0d
lerna notice 
lerna notice 📦  @[-org-]/[-packagename-]@0.8.2-beta.2+1bf4a0d
lerna notice === Tarball Contents === 
lerna notice 2.2kB  package.json                
lerna notice 3.2kB  CHANGELOG.md                
lerna notice 2.8kB  index.js                    
lerna notice 5.7kB  lib/common.js               
...more files
lerna notice === Tarball Details === 
lerna notice name:          @[-org-]/[-packagename-]                        
lerna notice version:       0.8.2-beta.2+1bf4a0d                                  
lerna notice filename:      [-org-]-[-packagename-]-0.8.2-beta.2+1bf4a0d.tgz
lerna notice package size:  12.4 kB                                               
lerna notice unpacked size: 51.4 kB                                               
lerna notice shasum:        7e5d7feb65225b59da23b82ef1fb71ac21ed2305              
lerna notice integrity:     sha512-f1mj17DhxpREE[...]qSbfO/X0bOrlg==              
lerna notice total files:   14                                                    
lerna notice 
lerna http fetch PUT 200 https://registry.npmjs.org/[-org-]%2f[-packagename-] 4017ms
Successfully published:
 - @[-org-]/[-packagename-]@0.8.2-beta.2+1bf4a0d
lerna success published 1 package
Done in 5.85s.

This was run in a CI environment thru a yarn script:

{
  "scripts": {
    "ci-publish": "lerna publish",
    ...
  }
  ...
}

@evocateur
Copy link
Member

@alampros Did the dist-tag next get set correctly?

Uh, whoops, I think I may have found a bug where --npm-tag isn't being passed correctly...

(--canary and --conventional-commits have no relationship, as --canary skips lerna version logic)

@evocateur
Copy link
Member

Uh, whoops, I think I may have found a bug where --npm-tag isn't being passed correctly...

Sorry, false alarm. Still, itches enough that I'm going to add more tests so I can reassure myself.

@alampros
Copy link

alampros commented Jan 4, 2019

@evocateur No, the dist-tag was not set. From the looks of it, npm defaulted it to latest on their side.

I'm not sure if it matters at all, but it might be worth mentioning that this is a private module.

Thanks so much for the quick response and for your work on this project – it is truly awesome!

@evocateur
Copy link
Member

@alampros Thanks for following up. Hrm, that's disturbing that the dist-tag wasn't set correctly. I'll add a test combining --canary and --conventional-commits and see if it behaves differently than I expect. I'm not sure why it would ignore --npm-tag (all of my tests so far indicate that it is respected, at least in the sense that lerna is passing opts.tag with the appropriate value)...

@alampros
Copy link

alampros commented Jan 4, 2019

So I tried it again without --conventional-commits at all and it's still not taking it. I'll create a separate issue if I can narrow it down any further so as not to hijack this one.

@alampros
Copy link

alampros commented Jan 4, 2019

I'm an idiot. I had the tag specified (latest) in my package's package.json#publishConfig. 🤦‍♂️

@evocateur
Copy link
Member

Coincidentally, I'm working on making --npm-tag override publishConfig.tag when it is not latest, which I think makes more sense, especially in the --canary case.

@evocateur
Copy link
Member

Would you believe I had no tests around the presence or absence of publishConfig.tag?

Narrator: He didn't.

@evocateur
Copy link
Member

v3.8.5 should fix this

@lock
Copy link

lock bot commented Apr 5, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants