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:
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.
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!



Top comments (0)