-
Notifications
You must be signed in to change notification settings - Fork 23
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
Bumping dependencies on publish #100
Comments
I made a tiny package that does just this to quickly solve my needs as I'm not sure this is something you want to support. |
Hi, I'd definitely be interested in this as well, I'm looking for a lightweight alternative to Lerna (which had this feature) and it would be a showstopper to not have it :/ |
Right now I run my package under the postpublish script in package.json (which gets auto triggered when you publish a package). The only issue I still have is that the actual bumping (with npm publish) also commits before any of the changes, so the actual bumping of packages is left unstaged. You could run |
So it's only accurate on the next release ? If I have a package a:1.0.0 that depends to b:1.0.0 If I publish version 1.1.0 then a:1.1.0 will depend on b:1.0.0, right ? |
This issue and #101 really go hand in hand -- but a PR for that issue is already up at #102. The way you want this to happen is to follow the reverse dependency tree. So that b (the package a depends on) gets published first. Then the postpublish hook kicks in, bumping the version of b in a, and then a gets published. This is obviously not a use case when a and b depend on each other, but I'm not a fan of organizing my packages that way. What I'm hinting at is that oao runs npm version first which bumps the version of each package and then commits that change. It's just a bit of manual work but if you want to commit all changes in one go you could run oao publish --no-git-commit (with the note: I mistakenly said npm publish in my previous comment, but it's npm version then npm publish per package. |
Okay I see, I'm not really sure this has to be done in a particular order, as long as the version is updated at publish time. It could also change the list of package to publish; If the version needs to be updated; the package needs to be published. I would see it working this way:
|
I agree that (sub)dependency checking should happen at a more sensible step. Ideally this should all be part of |
I guess you could say that's how it is now, by default |
I'm confused, it publishes all packages everytime ? If it's the default that's great anyway :) |
Thanks for all the interesting contributions. I've also been bitten by oao's not bumping cross-dependency versions, which generates some hard-to-find bugs later on. In fact, in order to simplify oao publish (there are already other more complex tools out there when you need a lot of bells and whistles), we could:
At least 2 and 3 would be breaking changes. But I think the API surface is reduced, the tool becomes simpler and more predictable (and more maintainable as well 😀). |
And yes a simpler and more predictable tool is exactly what I'm looking for coming from Lerna :) (no hate on Lerna, it's a great tool as well :) ) |
I think 1 is also how lerna does it by default, since you'd want to start your workflow at the leaves and build your way up. @guigrpa if you wan't I'll do this in my PR :) |
As far as the rest I'm ok with that. Especially 2) is how I do it now at the moment too ! |
@jeroenptrs Yes, please set the reverse-dependency order as default (removing the flag). Thanks! |
I can modify my PR ( #104 ) to always take all packages and change all their dependencies, this would solve 2) and 3) |
@onigoetz That's very helpful, thanks! I guess the new approach would remove most of the complexity in the PR, right? For instance determining which subpackages are dirty or not — all are considered dirty. Regarding your suggestion on how to modify dependent versions, we could have: 1) |
The flag names are still a bit confusing to me. What would we call this operation? Bumping dependent requirements maybe? Then maybe the most appropriate names could be: |
Yes it would indeed remove much of its complexity :) Could it also be a value instead of different options ?
|
I feel like it'd be smarter to do this implicitly, setting the version on publish could tell whether it's range or exact? |
@jeroenptrs that wouldn't work if the version is requested by the CLI instead of provided as an argument |
@onigoetz It would indeed not work on a) As seen here: https://github.com/guigrpa/oao/blob/master/src/publish.js#L94..L97 the next version is taken either from prompt or cli commands. But both the prompt and a - edit) as suggested in b) we can also always imply a range and override with exact. This seems the most straightforward approach in terms of UX, especially since oao is already opinionated I don't see any harm in doing it this way. What do you think? @onigoetz @guigrpa |
@onigoetz Certainly! I prefer in this case
Asking the user to introduce the carot in I would not couple how the user sets the new version to how oao bumps package requirements. It may save a few keystrokes, but makes the UX a bit more cryptic, in my opinion. Here are some examples how I would see it:
|
I think instead of |
Okay, I updated my pull request on #104 |
This has shipped in v2.0.0. Please let me know if you find any issues! Thanks for all the ideas and work put behind this issue and related PRs. |
I'm writing an application in a monorepo where a specific package is using another. Upon publishing I just realized that the version of that package in the
dependencies
field doesn't get bumped.Am I missing something? Otherwise I'd like to request that feature (and potentially running
yarn build
in between each publish, you can easily configure this with a prepare script btw)The text was updated successfully, but these errors were encountered: