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 version: createRelease is false when --no-push is passed in #2312

Closed
loganmccaul opened this issue Oct 21, 2019 · 3 comments
Closed

lerna version: createRelease is false when --no-push is passed in #2312

loganmccaul opened this issue Oct 21, 2019 · 3 comments

Comments

@loganmccaul
Copy link

Expected Behavior

A release should be able to be created even if lerna version doesn't handle the push.

Current Behavior

lerna version will not create a release if push is set to false:
https://github.com/lerna/lerna/blob/master/commands/version/index.js#L78

Possible Solution

Remove the dependency on pushToRemote from createRelease or add an additional flag, something like --create-release-only that will create a release without pushing.

Alternatively, we can create the Github release on our own, but since the logic is already built into Lerna it would be helpful to be able to use it.

Context

I am working with a monorepo that has a few packages with one that requires a package-lock. The setup looks a bit like this:

package.json
lerna.json
packages/
    packageOne/
        package.json
    packageTwo/
        package.json
        package-lock.json

PackageTwo has a dependency on packageOne, but also requires a package-lock for other dependencies. Currently we are manually updating the package-lock in package-two in between lerna version and lerna publish as inspired by #1415 (comment). This is what our CI script looks like:

# Update package versions
lerna version --conventional-commits --create-release github -m '[skip ci] chore(release): publish' --yes --no-push

# Publish new package versions
lerna publish from-package --yes

# Update docs package lock with new package versions
cd packages/packageTwo && npm install packageOne@latest --package-lock-only --ignore-scripts --no-audit && git add ./package-lock.json

# Add package lock to existing versions commit
git commit --amend --no-edit

# Push version and the github releases. Remove --follow-tags to stop github releases
git push origin master --follow-tags

However, since a Github release is never actually created, --follow-tags doesn't push up any tags. Additionally, since we are publishing using from-package we also don't need to push the release to the remote until after the package-lock has been updated. Ideally, the Github release is created and the tags can be pushed manually.

This later results in a problem with lerna changed. Lerna uses the git tags as a diff for which packages needs to be updated. Since the tags/releases are never created or pushed to the remote, lerna changed can't properly determine which packages need to be updated.

Alternatively, if there's a better approach to handling a package-lock, we'd also be happy to try that.

@evocateur
Copy link
Member

A Github Release literally requires the tags to be present, though?

Seems like we could just fix the "update package-lock during versioning" bug and you wouldn't need all this ornate scripting.

@loganmccaul
Copy link
Author

Thanks @evocateur! I definitely agree that #2160 is the proper solution to all of this. However, since it seems like #2160 has stalled I was hoping to get a workaround, maybe the best answer is to manually handle tagging and creating a release until the update package-lock during versioning bug is resolved?

@evocateur
Copy link
Member

v3.18.2 fixes this

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

No branches or pull requests

2 participants