Skip to content

Commit

Permalink
Improve pre-commit hook keeping version in sync to handle beta versions
Browse files Browse the repository at this point in the history
The git pre-commit hook we've been using the last years to keeping
.version found in `package.json` in sync with the .version field
exposed by the source code, did not handle version numbers often
used for pre-relases like `beta | new` etc.

Therefore making sure it searches for versions that also contains
characters, not only numbers separated by dots. That will make sure
the following is also seen as valid versions: `3.2.0-beta.0`,
whereas before the `-beta` part would cause trouble.
  • Loading branch information
phillipj committed Dec 18, 2019
1 parent 86fa37d commit f8d7a8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Bumper
end

bumper = Bumper.new([
Source.new('mustache.mjs', /version: '([\d\.]*)'/),
Source.new('mustache.js.nuspec', /<version>([\d\.]*)<\/version>/),
Source.new('mustache.mjs', /version: '([^']+)'/),
Source.new('mustache.js.nuspec', /<version>([^<]+)<\/version>/),
])
bumper.start

0 comments on commit f8d7a8d

Please # to comment.