-
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
Separate "version" and "publish" commands #961
Comments
This is also a problem for our company. Regards |
I am certainly sympathetic to this request, though I'm not ready to do a breaking change for it... |
It would certainly be nice for the CLI to follow It seems that @shawnbot's proposed |
+1 for I've just stumbled across this issue while setting up my CI pipeline to handle publishing. |
I think #1056 is similar to this issue. Rough summary:
I think that npm user can get flexibility by running each Task in a sequential order.
By contrast, Lerna can not run each Task in a sequential order.
#956 point out it. |
I'd like to better understand this issue. @shawnbot you say...
What is the issue exactly? That their process is to publish some packages outside the CI pipeline and some in it? That they get errors in a I must have started watching this issue a while back because I THOUGHT I wanted something similar but came to be perfectly happy with the current API. |
@morgs32 We've certainly found a workaround, but I predict that many Lerna users will eventually run into a wall with Stepping back, I think the underlying problem is really just the inability to inspect the state of your packages (in git or otherwise) before you hit the metaphorical "publish" button. When I run |
Hmm. To me, |
How do you publish after that? IIRC, if you run IMO, it's confusing that there are many Lerna subcommands with presumably equivalent |
I agree on both counts. |
I guess
Instead, we a hodgepodge of scripts to simulate that workflow: a And sure, it works, but it's an awful lot of boilerplate for us to have to maintain. |
I agree that the two should be split. I got started on it a couple weeks ago, but then I stalled (pesky day job/infant son): master...evocateur:split-version-from-publish Historically, I'm fairly certain |
Thanks @shawnbot for that piece of gods bless. One of the main problems at our company is publish conflicts. I wish Lerna can handle those, but meanwhile your scripts seems like a good workaround. |
Whoa @evocateur, congrats! I've got a 7mo and a 3yo... it's a lot. Anyway, I and my GitHub peeps are more than happy to help out if we can; just give a shout! ✌️ |
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. |
Lerna needs a separate
version
command.Why
Folks who use npm a lot are probably comfortable with the separation between the
npm version
andnpm publish
commands. For me, this separation is important because it allows me to double- and triple-check things before publishing. When versioning and publishing a monorepo with dozens of packages, the "publish anxiety" factor is even higher. I've worked through some of that anxiety with various permutations of--skip-git
and--skip-npm
thengit diff
, but at some point you have togit reset
and just trust that Lerna is going to do the right thing.The other problem is that Lerna doesn't make it easy (possible?) to just publish all of the packages using the existing
package.json
versions. AFAICT, it's not possible to skip the increment step, which means that you have to run something like this instead:...which will output a lot of scary
npm publish
error messages for any of your packages that haven't been bumped since the last release.We recently introduced a CI-driven automated publishing workflow in Primer, and to get around this we resorted to running a
try-publish
script, which would only runnpm publish
if the version in each module'spackage.json
hadn't already been published. Other teams that want to automate publishing will inevitably run into the same issue, and it would stink if they all ended up having to come up with their own solutions for it.How
There are a couple of ways to go about this:
To maintain backwards compatibility with the current CLI API, the
publish
command could introduce two new options:lerna publish --skip-publish
package.json
files, e.g.lerna publish --skip-version
If you're comfortable breaking the
publish
CLI for 2.x users, you could avoid adding any additional options topublish
and just move all of the versioning logic over to a newversion
command.The text was updated successfully, but these errors were encountered: