DEV Community

Cover image for What's your software version number?
Simone Gentili
Simone Gentili

Posted on

What's your software version number?

The Issue

I want to share a quick solution to a small problem: keeping your software version updated. It’s not a huge issue, but it’s something that can easily be automated, so I wanted to share my approach.

Programmatically updating the version

First of all, you can automagically increment the version number using a simple bash command. By adding it to your build process, the version will bump automatically with every single build. You can see how I set this up here:

update version on build time

Getting the version from package.json

Secondly, since we know exactly where the version number lives, I created a configuration that reads it straight from package.json. This ensures that your active build is always synced with the latest version. You can see the configuration in the next snippet and how it’s implemented in the React component.

build configuration

Reusable component...

I use this exact same approach in all of my side projects. This post might not be a magical unicorn, but I hope it helps someone discover a useful little trick!

reusable component to print version number

Top comments (0)