As it stands, Bit does not support semver's pre-release feature. It should support it, as using pre-release developers can share pre-production changes for components and check for their compatibility in other projects.
pre-release aims to define an unstable version of a component. meaning that before I publish 1.0.0 I will publish 1.0.0-alpha.1. This way consumers will know to which version the upcoming changes will be published to.
A developer should be able to add a semver pre-release with tagging a specific version for a component.
[email protected]
$ bit tag -a 1.0.0-alpha
[email protected]
--pre-release when bumping a component versionWhen a developer modifies a component and wants to publish it as an upcoming change to the next version, they should add the --pre-release option to the bit tag command. This option works alongside the current version-bump mechanism as implemented by the --major, --minor, and --patch options.
For example, a developer has [email protected] modified:
# By default, Bit does a patch bump. when `--pre-release` is added, pre-release is for a patch change.
$ bit tag --pre-release
[email protected]
# The developer wants to set a pre-release version of a patch update.
$ bit tag --pre-release --patch
[email protected]
# The developer wants to set a pre-release version of a minor update
$ bit tag --pre-release --minor
[email protected]
The developer wants to set a pre-release version of a major update.
$ bit tag --pre-release --major
[email protected]
By default Bit names pre-release version alpha. The --pre-release option can get a string value of the pre-release name.
[email protected]
$ bit tag --pre-release next
[email protected]
In case there are components in a workspace depending on a component that is tagged with a pre-release they will be auto-tagged with a --patch --pre-release as well.
When bit tag tries to tag a component with a release, but that version will depend on a pre-released component, prompt a warning saying:
warning - <component A> version <componentA next-version> will depend on a pre-release version of <comp B> - <pre-release of comp B>
Bit should be able to allow a release to depend on a pre-release, just add a warning.
As long as the --pre-release option is set, the next version bump with be of a pre-release. If a component is already tagged with a pre-release, Bit increments that pre-release. Bit should keep the same pre-release name unless stated otherwise.
# keep the same pre-release name
[email protected]
bit tag --pre-release
[email protected]
# update pre-release name
[email protected]
bit tag --pre-release beta
[email protected]
# set the pre-release to a different actual release
[email protected]
bit tag --pre-release --major
[email protected]
When running bit tag without the --pre-release option, Bit transforms all pre-releases to actual releases.
# without specify the next version-bump use the semver in the pre-release
[email protected]
bit tag
[email protected]
# specify the version bump
[email protected]
bit tag --minor
[email protected]
In case the version is already taken prompt an error saying "unable to set a version" and ask the user to specify the version bump they require to do.
There are several commands in Bit that care about version precedence
bit importbit checkoutbit listbit showbit mergeFrom semver.org
- Precedence MUST be calculated by separating the version into major, minor, patch and pre-release identifiers in that order.
- Precedence is determined by the first difference when comparing each of these identifiers from left to right as follows: Major, minor, and patch versions are always compared numerically. Example: 1.0.0 < 2.0.0 < 2.1.0 < 2.1.1.
- When major, minor, and patch are equal, a pre-release version has lower precedence than a normal version. Example: 1.0.0-alpha < 1.0.0.
import | checkout | merge occurs on a component, Bit should NOT give precedence to pre-releases.list shows data from a remote collection, don't give precedence to pre-releases on the remote.show shows data from a remote component, don't give precedence to pre-releases on the remote.--include-pre-releases option to Bit commandsAll commands that handle version precedence should have the option to set precedence to pre-released versions. This way, when a user uses these commands with the --include-pre-releases flag, and a pre-release is in fact the "latest" version, it should "break" the semver-precedence rules and treat the latest pre-release precedence.
This is helpful for several cases:
checkout, import or merge the latest pre-release, they can, without asking for the specific pre-release version.listing all components in a scope, Bit will show pre-releases for components, if available.@itaymendel
few comments:
questions:
2.0.0-pre.1 and I tag using --minor what should be the version? 2.0.1-pre.1? error?@GiladShoham @davidfirst i refactored the specification, please review and comment.
The goal is to keep a pre-release BEFORE setting the actual release on that version. IE - [email protected] should be published prior to [email protected], as it is its BETA version for 1.0.0.
our company would like to use bit.dev, but without this feature, it is simply impossible
@ruscon We plan to start working on this very soon. We don't have an ETA yet.
Most helpful comment
@GiladShoham @davidfirst i refactored the specification, please review and comment.
The goal is to keep a pre-release BEFORE setting the actual release on that version. IE -
[email protected]should be published prior to[email protected], as it is its BETA version for1.0.0.