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.remove-build-output-from-git
| @@ -1,22 +0,0 @@ | |||||
| #!/bin/bash | |||||
| HOOK_NAMES="pre-commit" | |||||
| HOOK_DIR=$(git rev-parse --show-toplevel)/.git/hooks | |||||
| INSTALL_DIR=$(git rev-parse --show-toplevel)/hooks | |||||
| COLOR_GREEN=`tput setaf 2` | |||||
| COLOR_RESET=`tput sgr0` | |||||
| for hook in $HOOK_NAMES; do | |||||
| echo -n "Installing $hook hook..." | |||||
| # If the hook already exists, is executable, and is not a symlink | |||||
| if [ ! -h $HOOK_DIR/$hook -a -x $HOOK_DIR/$hook ]; then | |||||
| echo -n " Hook already exists, saving old hook backup at $HOOK_DIR/$hook.local..." | |||||
| mv $HOOK_DIR/$hook $HOOK_DIR/$hook.local | |||||
| fi | |||||
| # create the symlink, overwriting the file if it exists | |||||
| # probably the only way this would happen is if you're using an old version of git | |||||
| # -- back when the sample hooks were not executable, instead of being named ____.sample | |||||
| echo -n " Creating symlink..." | |||||
| ln -s -f $INSTALL_DIR/$hook $HOOK_DIR | |||||
| echo "${COLOR_GREEN} Done! ✓${COLOR_RESET}" | |||||
| done | |||||
| @@ -35,7 +35,8 @@ | |||||
| "test-render": "mocha --reporter spec test/render-test", | "test-render": "mocha --reporter spec test/render-test", | ||||
| "pre-test-browser": "node test/create-browser-suite.js", | "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": "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": { | "devDependencies": { | ||||
| "chai": "^3.4.0", | "chai": "^3.4.0", | ||||
| @@ -33,19 +33,9 @@ class Bumper | |||||
| # if bumped, do extra stuff and notify the user | # if bumped, do extra stuff and notify the user | ||||
| if @bumped | if @bumped | ||||
| `git add .` | |||||
| `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 32, "successfully bumped version to #{@target_v}!" | ||||
| puts_c 33, "don't forget to `npm publish`!" | puts_c 33, "don't forget to `npm publish`!" | ||||
| end | end | ||||