Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bump mustache.js version via npm script instead of git pre-commit hook
Primarily because installing `git` hooks are easy to forget for
maintainers, whilst telling `npm` to do something as a consequence of
`$ npm version <patch | minor | major>` is seamless.

Also worth mentioning we what we used to do in the pre-commit hook
script is now greatly simplified as we don't want to have the build
output and/or the `.min.js` in git anymore.

Therefore, as long as we've bumped the version number in the source
code, we're basically done, after having amended that change into the
git commit the `npm` CLI creates.
  • Loading branch information
phillipj committed Mar 5, 2021
1 parent 2061046 commit a93c39e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 35 deletions.
22 changes: 0 additions & 22 deletions hooks/install-hooks.sh

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -35,7 +35,8 @@
"test-render": "mocha --reporter spec test/render-test",
"pre-test-browser": "node test/create-browser-suite.js",
"test-browser": "npm run pre-test-browser && zuul -- test/context-test.js test/parse-test.js test/scanner-test.js test/render-test-browser.js",
"test-browser-local": "npm run pre-test-browser && zuul --local 8080 -- test/context-test.js test/scanner-test.js test/parse-test.js test/render-test-browser.js"
"test-browser-local": "npm run pre-test-browser && zuul --local 8080 -- test/context-test.js test/scanner-test.js test/parse-test.js test/render-test-browser.js",
"postversion": "scripts/bump-version-in-source"
},
"devDependencies": {
"chai": "^3.4.0",
Expand Down
14 changes: 2 additions & 12 deletions hooks/pre-commit → scripts/bump-version-in-source
Expand Up @@ -33,19 +33,9 @@ class Bumper

# if bumped, do extra stuff and notify the user
if @bumped
`git add mustache.js`
`git commit --amend --no-edit`

# keep .mjs & .js|.min.js in sync
puts "> building and minifying `mustache.mjs`..."
`npm run build`

# stage files for commit
`git add package.json`
@sources.each {|source| `git add #{source.path}`}
`git add mustache.min.js`
`git commit -m ":ship: bump to version #{@target_v}"`

# notify codemonkey
puts "staged bumped files and created commit"
puts_c 32, "successfully bumped version to #{@target_v}!"
puts_c 33, "don't forget to `npm publish`!"
end
Expand Down

0 comments on commit a93c39e

Please sign in to comment.