What is standard-version tool ?

Standard-version is an incredibly useful tool that leverages a well-maintained git history to generate easily readable change-logs. This npm package is designed to streamline the process of creating change-logs and facilitate their delivery to clients. It offers several benefits, including automated version incrementing based on the git history and adherence to the widely recognized semantic versioning standard.

If you haven’t read our tutorial on Git Workflow yet, this is the occasion to get accustomed to it.

Remember: it is always important to follow good software development practice. Review process is a powerfull way to ensure products quality.

By utilizing the conventional commits standard, standard-version ensures that each commit follows a specific format, making it easier to identify the type and purpose of each change.
This standardized format is exemplified by the following commits:

feat(token): Add authentication

This commit introduces a new feature related to authentication. Specifically, it involves storing the token in the system’s credential manager, which enhances security and convenience for users.

fix(restore): reset variable:

This commit addresses a bug in the restore feature. The issue of an undefined variable is resolved, ensuring that the restore functionality functions as intended.

These commits demonstrate how standard-version encourages clear and concise commit messages, making it easier to track changes and understand their significance. Moreover, the tool automatically increments the version number of the application or package, based on the defined conventions and the provided git history.

Adhering to the semantic versioning standard, the version number consists of three components: MAJOR.MINOR.PATCH.
The MAJOR version is incremented when incompatible changes are made, the MINOR version is increased for backward-compatible additions, and the PATCH version is updated for backward-compatible bug fixes. With standard-version, you can rest assured that the versioning process aligns with these industry best practices, enabling seamless communication with clients and users regarding the significance of each release.
Let us explain the version number better:
Major Version:
πŸŽ‰ Major versions introduce new features or make significant changes that may break backward compatibility. These updates often bring exciting enhancements to the software.

  • Minor Version:
    ✨ Minor versions include backward compatible new features. These updates enhance the software without disrupting existing functionality.

  • Patches:
    πŸ”§ Patches consist of backward compatible bug fixes. These updates address issues and improve the stability and performance of the software.

Using Standard-version

The documentation of standard-version can be found here: https://github.com/conventional-changelog/standard-version

Start with:

npx standard-version --first-release

To automate the process of managing version numbers and generating a changelog for your projects, you can use standard-version. It is not limited to JavaScript projects and can be used for any project. By using the –first-release flag, you can initiate the process of creating a CHANGELOG.md file and populate it with your change-logs.

One of the key features of standard-version is its flexibility. It allows you to specify the files in which the version number should be updated using the bumpFiles, packageFiles, and updaters parameters. For example, if your project uses Maven, you can instruct the tool to update the version number in the pom.xml file.

To simplify the configuration process, you can create a .versionrc file in your project and define the specific configuration there. This way, you won’t need to install JavaScript packages directly in your project or create a package.json file, thereby avoiding unnecessary clutter in your project.

For more detailed configuration options and customization possibilities, I recommend referring to the standard-version readme. It provides comprehensive guidance on how to deeply configure the versioning process according to your specific requirements.

Once you have set up the configuration, you can easily execute standard-version by calling npx standard-version either locally on your development machine or as part of your GitLab pipeline.

It’s important to note that standard-version will only proceed with the versioning process if your git history is clean and up to date. This ensures that the generated changelog accurately reflects the changes made in the project.

By incorporating standard-version into your workflow, you can streamline the versioning process and automate the creation of changelogs, making it easier to manage and track the evolution of your projects.

Written by

Albert Oplog

Hi, I'm Albert Oplog. I would humbly like to share my tech journey with people all around the world.