From 86fa37d39df79daa8a86a87cf0912cf9cc1f2aab Mon Sep 17 00:00:00 2001 From: Phillip Johnsen Date: Wed, 4 Dec 2019 20:56:39 +0100 Subject: [PATCH] Bump .version in mustache.js in git hook when version has changed This changes the pre-commit hook that we've used for years to keep the version value found in `package.json` in sync with the one in `mustache.js`, to change `mustache.mjs` instead since that's where the source code lives now. --- Rakefile | 5 ----- hooks/pre-commit | 8 ++++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Rakefile b/Rakefile index 261a05f..2540c28 100644 --- a/Rakefile +++ b/Rakefile @@ -12,11 +12,6 @@ task :test do sh "./node_modules/.bin/mocha test" end -desc "Make a compressed build in #{minified_file}" -task :minify do - sh "./node_modules/.bin/uglifyjs mustache.js > #{minified_file}" -end - desc "Run JSHint" task :hint do sh "./node_modules/.bin/jshint mustache.js" diff --git a/hooks/pre-commit b/hooks/pre-commit index 07fedb7..368c135 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -34,9 +34,9 @@ class Bumper # if bumped, do extra stuff and notify the user if @bumped - # minify `mustache.js` using the Rakefile task - puts "> minifying `mustache.js`..." - `rake minify` + # keep .mjs & .js|.min.js in sync + puts "> building and minifying `mustache.mjs`..." + `npm run build` # stage files for commit `git add package.json` @@ -78,7 +78,7 @@ class Bumper end bumper = Bumper.new([ - Source.new('mustache.js', /mustache.version = '([\d\.]*)'/), + Source.new('mustache.mjs', /version: '([\d\.]*)'/), Source.new('mustache.js.nuspec', /([\d\.]*)<\/version>/), ]) bumper.start