-
Notifications
You must be signed in to change notification settings - Fork 26
Bumping version in non-json files? #40
Comments
+1 - looking forward to supporting non-json file |
We started out with using a regex just parsing the version string. It was changed to support only pure semver and json. Parsing with regex is messy, especially with Windows/Mac style quotes found in non-json files. I am open to adding a regex option to gulp-bump while parsing json by default. |
You could look to var VERSION_REGEXP = opts.regExp || new RegExp(
'([\'|\"]?version[\'|\"]?[ ]*:[ ]*[\'|\"]?)(\\d+\\.\\d+\\.\\d+(-' +
opts.prereleaseName +
'\\.\\d+)?(-\\d+)?)[\\d||A-a|.|-]*([\'|\"]?)', 'i'
);
if (opts.globalReplace) {
VERSION_REGEXP = new RegExp(VERSION_REGEXP.source, 'gi');
}
|
Yes, as I have already mentioned we did originally do that. I will not remove the current support for JSON only files. |
I guess I was confused as you stated "Grunt-bump also only supports json versions unless you provide your own regex" which isn't true. That or I have no clue what you mean by JSON versions, since I have no problem swapping versions on any files with |
The regex they provide will only operate on: This is going off topic though... |
This is not correct. I have no problem's bumping a comment block like so:
This is why I brought up their RegEx in the first place. Hardly off-topic, considering it's directly related to the topic of bumping non-JSON files, as @ospatil reported. The reality is that many users of Grunt will come from |
the option to bump non-json by providing our own regex patterns would be a good thing |
Anyone want to take this on and merge it with #39? Both are options for regex Cheers |
👍 for bumping non-JSON files. |
@ospatil |
Now returns new and old version bumped via |
@stevelacy |
Wouldn't it be a good idea to support bumping version in non-json files too? For example - markdown files like readme. I have been primarily a grunt user so far and the grunt-bump plugin allows it. Looking at code, I see grunt-bump uses regex search and replace while gulp-bump uses JSON.parse.
Adding such support shouldn't be too difficult and I would be happy to submit a pull request. Let me know.
The text was updated successfully, but these errors were encountered: