Skip to main content

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

bash
blocklet version [<newversion> | patch | minor | major | prepatch | preminor | premajor | prerelease] [options]

How It Works

The command performs the following actions:

  1. Reads the blocklet.yml file in the current directory.
  2. Parses the version field to determine the current version.
  3. Calculates the next version based on the argument provided (defaults to patch).
  4. Updates the version field in blocklet.yml to the new version.
  5. Updates the specVersion to 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.

ArgumentDescriptionExample (from 1.2.3)
(none) / patchIncrements the patch version (e.g., for bug fixes).1.2.4
minorIncrements the minor version (e.g., for new features).1.3.0
majorIncrements the major version (e.g., for breaking changes).2.0.0
prepatchIncrements the patch version for a pre-release.1.2.4-0
prereleaseIncrements the pre-release identifier.from 1.2.4-alpha.0 to 1.2.4-alpha.1
<version>Sets a specific, valid version number.3.0.0

Options

You can modify the command's behavior with the following options:

OptionDescription
--gitCommitAutomatically adds blocklet.yml to Git staging and creates a commit with the message blocklet version <new_version>.
--forceForces the version update even if it results in downgrading the specVersion. This is generally not recommended unless you are certain about the change.

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

bash
blocklet version

# Output:
# ✔ Blocklet version bumped to 1.0.1

Bump to a New Minor Version

To release a new feature, you can bump the minor version.

Minor Version Bump

bash
blocklet version minor

# Output:
# ✔ Blocklet version bumped to 1.1.0

Set 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

bash
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.

Manage Version

After successfully updating your blocklet's version, you are ready for the next steps in the distribution process.