-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 to publish packages with their current version #1056
Comments
I want lerna to use the package.json version number to publish without having to bump it since it was already bumped manually by the developer. In my case, CI doesn't know if it's a breaking change or not, so I expect the developer to do this. So I would use the --yes flag but wouldn't wan't the prompt to ask me what version I want to release. When the branch is merged to master, that's when I expect lerna to just use the version in package.json to publish without new commits. Something like this would be a nice feature: This command: |
If your CI has ways of indicating when a tag has been created, |
Ideally, CI would run a I've scoured the issues section of Lerna, but have really struggled to find a proper answer for cleanly setting up Lerna with a monorepo in CI. Because Lerna insists on bumping the package.json regardless of what args are passed, it results in a messy CI integration. If you push changes back to git (package.json, changelogs etc), it then triggers a subsequent build. Ideally Lerna would have a Anything more triggers further unnecessary builds. The developer can run the changelog part of lerna Thoughts? |
I've created can-npm-publish CLI.
|
@evocateur Is there interest in a PR for this? Conventional commits seems kind of awkward when using lerna in Independent mode. |
@unregistered I was thinking of implementing a
btw, |
@evocateur can you clarify what the tag should be for an independently versioned repo? Wouldn't it have to contain the name of the package that's being published? I think that feature you mentioned might work, just trying to wrap my head around it. To clarify we publish on every commit we squash to master, but when a commit changes only one package it's wasteful to publish the other 80 packages (and dishonest too, since the patch-level gets bumped but there are no changes). Edit: I played around with |
You would also need to pass # independent mode with valid tags
$ git show HEAD --name-only --pretty=format:%D -- packages/*/package.json
tag: @scope/package-1@2.9.1, tag: package-2@1.1.0
packages/package-1/package.json
packages/package-2/package.json In independent mode, the tags themselves are valid arguments to # fixed mode with valid tag
$ git show HEAD --name-only --pretty=format:%D -- packages/*/package.json
tag: v1.8.0
packages/package-1/package.json
packages/package-2/package.json Fixed mode is a bit more wrinkly, requiring reverse lookups by # no tags found, return no-op with appropriate logging
$ git show HEAD --name-only --pretty=format:%D -- packages/*/package.json
# empty string I figure throwing is not what we want, it should just behave the same as the "no changes found" case, which is just to exit. |
To be clear, this would also pretty much require #961, using If it's desired to be completely automated, you'll need to use |
@evocateur It's a bit of a pain to get the auto-generated commit and tags sent back to the master branch, since we have branch protection on, commits only enter master through PRs. Not sure what the recommended pattern for that is, I may just be doing something unusual. |
Sounds like you want |
This sounds like exactly what we need for our project but unfortunately there's still one major issue: If some packages have been updated but others haven't, this will fail as
|
@penx what about the package from @azu. |
Also, I've created @monorepo-utils/publish. Just replace
to
|
BREAKING CHANGE: * `--preid` now defaults to "alpha" during prereleases: The previous default for this option was undefined, which led to an awkward "1.0.1-0" result when passed to `semver.inc()`. The new default "alpha" yields a much more useful "1.0.1-alpha.0" result. Any previous prerelease ID will be preserved, just as it was before. * `--no-verify` is no longer passed to `git commit` by default, but controlled by the new `--commit-hooks` option: The previous behavior was too overzealous, and the new option operates exactly like the corresponding [npm version](https://docs.npmjs.com/cli/version#commit-hooks) option of the same name. As long as your pre-commit hooks are properly scoped to ignore changes in package.json files, this change should not affect you. If that is not the case, you may pass `--no-commit-hooks` to restore the previous behavior. Fixes #277 Fixes #936 Fixes #956 Fixes #961 Fixes #1056 Fixes #1118 Fixes #1385 Fixes #1483 Fixes #1494
BREAKING CHANGE: * `--preid` now defaults to "alpha" during prereleases: The previous default for this option was undefined, which led to an awkward "1.0.1-0" result when passed to `semver.inc()`. The new default "alpha" yields a much more useful "1.0.1-alpha.0" result. Any previous prerelease ID will be preserved, just as it was before. * `--no-verify` is no longer passed to `git commit` by default, but controlled by the new `--commit-hooks` option: The previous behavior was too overzealous, and the new option operates exactly like the corresponding [npm version](https://docs.npmjs.com/cli/version#commit-hooks) option of the same name. As long as your pre-commit hooks are properly scoped to ignore changes in package.json files, this change should not affect you. If that is not the case, you may pass `--no-commit-hooks` to restore the previous behavior. Fixes lerna#277 Fixes lerna#936 Fixes lerna#956 Fixes lerna#961 Fixes lerna#1056 Fixes lerna#1118 Fixes lerna#1385 Fixes lerna#1483 Fixes lerna#1494
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. |
How do I tell
lerna
to publish packages with their current version?Now
lerna
is always trying to increase the version of packages ...I need this because I want to divide the publication process into 2 stages:
lerna publish --skip-npm
lerna publish --skip-git
I do not need to raise the version twice.
My Environment
lerna --version
npm --version
node --version
The text was updated successfully, but these errors were encountered: