You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Releasing prerelease versions without modifying package.json files #327
Let's say we have a UI library that is actively developed and releases are happening multiple times from different branches. The releases from branches are happening for testing or experimentation. These releases should happen with prerelease version numbers.
There's active development on master and on the different branches, so the versions are being modified all the time. As a result, merges and/or rebases are extremely hard due to the conflicts in the version numbers.
Proposed solution
There should be a way to publish prerelease versions without modifications to package.json files. This way, only the regular publishes on master will modify the versions in manifests and conflicts will never happen.
Reacted by Ajay Narain Mathur, Feiyang, await-ovo and rcrd
Maybe, but changeset should keep track of the prerelease version numbers. Or use some random prerelease versions. Because I might want to do several prerelease publishes from a branch.
Right - I’ve assumed that you would only reuse the versioning part and handle publish on your own and that those prereleases are intended as random or based on commit/date (so actually changesets would need to accept “prerelease-tag” for versioning command). When you have such setup with concurrent branches releasing prereleases at the same time then you dont want to share incremental versioning between them, right? They would just be created out of order at many occasions and would create a kinda weird mess
The branch name could be used as part of the prerelease tag + a counter. But I am fine with a "random" tag as well. Or a custom tag provided to changesets.
So I think your suggestion with a prerelease-tag for the version command would work. I'd do something like
The only downside that I see is that changeset version --prerelease <some hash> will always republish all the packages that have changesets. So even if you make a second prerelease publish, the versions from the previous publish will not be reused. Everything will be published again. Even if some packages were not changed since last publish.
but that is probably fine. Developers should be motivated to merge to master frequently
Republishing might actually make it easier to use those prereleases because without that it could be quite hard to know what versions of different packages you are actually supposed to install - which is somewhat a problem even with stable releases, see #249 .
We definitely want to do something like this. We documented what we wanted this to look like when we first implemented prereleases in our dictionary but we haven't got around to actually implementing it.
snapshot prerelease - A snapshot prerelease is intended to make it easy to test all changes at a particular git commit. It is published at 0.0.0 and uses the git hash as the tag. This should be used as a less formal method than a release candidate to make it easy to install and test changes. An example, if we have a package at 1.0.0, and have a changeset for it to be major bumpred, a snapshot release will be at 0.0.0-ABCDEFGH (the last github hash). If we add more commits, the next snapshot would be 0.0.0-HIJKLMNOP.
IIRC, the command we wanted was changeset pre snapshot <tag>. It would set all the versions to 0.0.0-tag-hash and update that in all the dependents, publish all the packages to the dist tag that was specified and then undo the changes.
Reacted by Zoltan Kochan, Noviny and Ajay Narain Mathur
Can the snapshot command be used for something like publishing canary releases for every PR/commit merged into master? Or is it for a different use case?
I think snapshot implemented as is is great for canary releases, but it doesn't address the issue with pre mode, which requires you to commit package.json in order to calculate the next pre release number. It makes the process of making a regular release really cumbersome because I need to hard reset all pre release commits first in order to get rid of them in the commit history. ( I don't want prerelease commits to show up in the master branch)
Can we extend the snapshot to support pre mode? that is 1. bump package version normally according to changesets instead of using 0.0.0 2. append the version with tag and timestamp instead of a linearly increasing integer
For example, suppose I have pkg-a at version 1.0.0 and there is a patch changeset for it. I should get 1.0.1-next.[timestamp1] instead of 1.0.1-next.0 after the following commands:
yarn changeset pre next
yarn changeset version
I should not need to commit the package.json after the first rerelease and when I do another prerelease, I should get 1.0.1-next.[a-different-timestamp].
Making snapshot work with pre-mode is definitely something that we'd like to support. I don't quite understand though why the versioning scheme should be different than for non-premode snapshots. Could you elaborate on this one? From what I understand the problem is that premode is just somewhat ignoring snapshot now and thus regular prerelease versions are generated, but that is probably just an oversight and should be quite an easy fix to make snapshots take precedence.
Either way - could you open a new issue in which we could discuss this further? I'm closing this as the original feature request has been implemented, a new issue will allow us to better focus at the issue you are experiencing right now.
Done. #381
It might be helpful to replace prerelease with canary release in the issue title because people may confuse it with the prerelease mode, which this issue is not about, IIUC.
Activity
Andarist commentedon Apr 16, 2020
Wouldnt it be somewhat equivalent to this:
git reset --hard HEAD~1zkochan commentedon Apr 16, 2020
Maybe, but changeset should keep track of the prerelease version numbers. Or use some random prerelease versions. Because I might want to do several prerelease publishes from a branch.
Andarist commentedon Apr 16, 2020
Right - I’ve assumed that you would only reuse the versioning part and handle publish on your own and that those prereleases are intended as random or based on commit/date (so actually changesets would need to accept “prerelease-tag” for versioning command). When you have such setup with concurrent branches releasing prereleases at the same time then you dont want to share incremental versioning between them, right? They would just be created out of order at many occasions and would create a kinda weird mess
zkochan commentedon Apr 16, 2020
The branch name could be used as part of the prerelease tag + a counter. But I am fine with a "random" tag as well. Or a custom tag provided to changesets.
So I think your suggestion with a prerelease-tag for the version command would work. I'd do something like
Maybe even better, if version could accept a
--no-commitflag. Then instead ofHEAD~1, we could doHEAD.Andarist commentedon Apr 16, 2020
I personally like the idea 👍
zkochan commentedon Apr 16, 2020
The only downside that I see is that
changeset version --prerelease <some hash>will always republish all the packages that have changesets. So even if you make a second prerelease publish, the versions from the previous publish will not be reused. Everything will be published again. Even if some packages were not changed since last publish.but that is probably fine. Developers should be motivated to merge to master frequently
Andarist commentedon Apr 16, 2020
Republishing might actually make it easier to use those prereleases because without that it could be quite hard to know what versions of different packages you are actually supposed to install - which is somewhat a problem even with stable releases, see #249 .
emmatown commentedon Apr 16, 2020
We definitely want to do something like this. We documented what we wanted this to look like when we first implemented prereleases in our dictionary but we haven't got around to actually implementing it.
IIRC, the command we wanted was
changeset pre snapshot <tag>. It would set all the versions to0.0.0-tag-hashand update that in all the dependents, publish all the packages to the dist tag that was specified and then undo the changes.ajaymathur commentedon May 3, 2020
Hey, If no one has taken this issue yet. Can I pick it up?
I did some initial implementation https://github.com/atlassian/changesets/tree/issue/137-snapshot-release. It is not ready for review yet, I am yet to wire up the publish step.
Thanks,
zkochan commentedon May 3, 2020
I did not work on it yet, so I don't have objections.
emmatown commentedon May 4, 2020
That would be great @ajaymathur!!
Noviny commentedon May 4, 2020
<3 Thanks @ajaymathur
emmenko commentedon May 11, 2020
Can the snapshot command be used for something like publishing
canaryreleases for every PR/commit merged intomaster? Or is it for a different use case?zkochan commentedon May 11, 2020
Yes, I think this is one of the use cases. This is what I want to use it for.
emmenko commentedon May 11, 2020
Great, looking forward to test it out 🙌
At the moment, we're still using
lernato publish canary releases but we hope to not need that anymore :)ajaymathur commentedon May 24, 2020
[UPDATE]
The change corresponding to this issue is done in #359.
Release in pending in PR: #375
We can close the issue once the PR #375 is merged and a new version is released.
Feiyang1 commentedon May 29, 2020
I think
snapshotimplemented as is is great for canary releases, but it doesn't address the issue with pre mode, which requires you to commit package.json in order to calculate the next pre release number. It makes the process of making a regular release really cumbersome because I need to hard reset all pre release commits first in order to get rid of them in the commit history. ( I don't want prerelease commits to show up in the master branch)Can we extend the snapshot to support pre mode? that is 1. bump package version normally according to changesets instead of using
0.0.02. append the version with tag and timestamp instead of a linearly increasing integerFor example, suppose I have
pkg-aat version1.0.0and there is a patch changeset for it. I should get1.0.1-next.[timestamp1]instead of1.0.1-next.0after the following commands:yarn changeset pre nextyarn changeset versionI should not need to commit the
package.jsonafter the first rerelease and when I do another prerelease, I should get1.0.1-next.[a-different-timestamp].Andarist commentedon May 31, 2020
Making
snapshotwork with pre-mode is definitely something that we'd like to support. I don't quite understand though why the versioning scheme should be different than for non-premode snapshots. Could you elaborate on this one? From what I understand the problem is that premode is just somewhat ignoring snapshot now and thus regular prerelease versions are generated, but that is probably just an oversight and should be quite an easy fix to make snapshots take precedence.Either way - could you open a new issue in which we could discuss this further? I'm closing this as the original feature request has been implemented, a new issue will allow us to better focus at the issue you are experiencing right now.
Feiyang1 commentedon May 31, 2020
Done. #381
It might be helpful to replace
prereleasewithcanary releasein the issue title because people may confuse it with theprerelease mode, which this issue is not about, IIUC.