Last active
October 17, 2019 12:37
-
-
Save pysysops/61bcd3692d8c2a9996eb9695c2b069ce to your computer and use it in GitHub Desktop.
Tag / Version control any git repo with yarn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "MyCoolApp", | |
"description": "Does a really cool thing", | |
"version": "0.0.0", | |
"private": true, | |
"scripts": { | |
"test": "true", | |
"gitbranch": "BRANCH=$(git rev-parse --abbrev-ref HEAD); if [[ \"$BRANCH\" != \"master\" ]]; then echo \"you must be on master branch to release\"; exit 1 ; fi", | |
"gitstatus": "STATUS=$(git status --porcelain 2>&1); echo $STATUS; if [[ ! -z \"$STATUS\" ]]; then exit 1; fi;", | |
"gittest": "yarn gitbranch && yarn gitstatus", | |
"preversion": "yarn gittest && yarn test", | |
"postversion": "git push --follow-tags" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this package.json to any repo, update the test line and then version your thing by running
yarn version ...
:See: https://yarnpkg.com/lang/en/docs/cli/version/ for details.