Manage Version
The blocklet version command is a convenient utility for updating your blocklet's version number in the blocklet.yml file. It follows the rules of semantic versioning (semver) to ensure consistent and predictable version increments. This is a critical step to perform before you package and distribute a new release of your blocklet.
Usage#
The command is run from the root of your blocklet project directory.
Basic Usage
blocklet version [<newversion> | patch | minor | major | prepatch | preminor | premajor | prerelease] [options]How It Works#
The command performs the following actions:
- Reads the
blocklet.ymlfile in the current directory. - Parses the
versionfield to determine the current version. - Calculates the next version based on the argument provided (defaults to
patch). - Updates the
versionfield inblocklet.ymlto the new version. - Updates the
specVersionto the latest version supported by the CLI.
Version Argument#
The command accepts one optional argument to specify the next version. If you omit this argument, it defaults to patch.
Argument | Description | Example (from 1.2.3) |
|---|---|---|
(none) / | Increments the patch version (e.g., for bug fixes). |
|
| Increments the minor version (e.g., for new features). |
|
| Increments the major version (e.g., for breaking changes). |
|
| Increments the patch version for a pre-release. |
|
| Increments the pre-release identifier. | from |
| Sets a specific, valid version number. |
|
Options#
You can modify the command's behavior with the following options:
Option | Description |
|---|---|
| Automatically adds |
| Forces the version update even if it results in downgrading the |
Examples#
Increment the Patch Version#
If your current version is 1.0.0, running the command without arguments will bump it to 1.0.1.
Basic Patch Update
blocklet version
# Output:
# ✔ Blocklet version bumped to 1.0.1Bump to a New Minor Version#
To release a new feature, you can bump the minor version.
Minor Version Bump
blocklet version minor
# Output:
# ✔ Blocklet version bumped to 1.1.0Set a Specific Version and Commit#
You can also set an explicit version number and have the CLI commit the change for you.
Set Version and Commit
blocklet version 2.0.0 --gitCommit
# Output:
# ✔ Blocklet version bumped to 2.0.0
# (Also runs 'git add blocklet.yml' and 'git commit ...')Versioning in Your Workflow#
The version command fits into the packaging and distribution workflow after you've completed your code changes and before you create a distributable bundle.
After successfully updating your blocklet's version, you are ready for the next steps in the distribution process.