version-bump-prompt
version-bump-prompt copied to clipboard
Update version in text file via regex or other means
If you have a changelog file or similar, it would be helpful to specify a next or other named field that will be replaced by the new bumped version.
Possibly configurable via a local config file maybe, or a predefined value like next.
If I understand your needs correctly, I believe you can already do that. There are a couple ways...
Option 1 - Replace old version with new version
You can specify any type of file for version-bump-prompt to bump, including text files, config files, ReadMe files, etc. It will find and replace all occurrences of the old version number with the new version number in those files.
For example, to bump the version number in your package.json and package-lock.json as well your ReadMe file and all text files, you'd run this command:
bump package.json package-lock.json ReadMe.md *.txt
See the ReadMe for more details.
Option 2 - Use a postversion script
version-bump-prompt supports npm version scripts, such as preversion, version, and postversion. In your case, you could write a postversion script that replaces whatever placeholder you want with the new version number.
See the ReadMe for more details.
The postversion script seems most suitable for what I'd like to do. The first option only works to replace the old version, which wouldn't be ideal for a changelog file.
Thanks. I'll give the second option a go