I have an Ember NPM based project & use Git for versioning.
I want to update/bump the package.json version before/while doing Git commit.
How do I achieve this? Do I need to use some kind of Git hooks?
I have an Ember NPM based project & use Git for versioning.
I want to update/bump the package.json version before/while doing Git commit.
How do I achieve this? Do I need to use some kind of Git hooks?
Try a pre-commit hook. Found an article on medium which can help you build a pre-commit hook.
https://medium.com/the-andela-way/git-hooks-beautifully-automate-tasks-stages-bfb29f42fea1
Made a git-hook. let me know if this is what you were looking for. There are some in-line comments too which you can use for adding more changed files.
pre-commit
#!/bin/sh
echo "START pre-commit hook"
npm update --save
echo "removing older changed files"
#rm changed.js
#echo "adding package.json and package-lock for changes happened inside npm update"
git add package.json package-lock.json
#echo "adding the changed files only"
#git diff --cached --name-only --diff-filter=ACM > changed.js
#echo "running git add aganist changed.js files"
#git add ./changed.js
echo "END"