安装Tailsman-密钥检查工具

Install Tailsman to protect token/secret

Installation

First run follow command to install tailsman as a pre-commit hook

1
curl --silent  https://raw.githubusercontent.com/thoughtworks/talisman/master/global_install_scripts/install.bash > /tmp/install_talisman.bash && /bin/bash /tmp/install_talisman.bash

after tailsman binary has been downloaded, you will encounter following extra question:

1
2
3
4
5
6
7
8
9
10
PLEASE CHOOSE WHERE YOU WISH TO SET TALISMAN_HOME VARIABLE AND talisman binary PATH (Enter option number): 
# choose `4) I will set it later`

Git template directory: (/Users/username/.git-template)
# just press enter to use default location

Please enter root directory to search for git repos (Default: /Users/username):
# then you will receive a error that it can't be hooked up as pre-commit
# and just ignore it!

Setup Environment Variable

add following to your shell profile, for example: ~/.zshrc

1
2
3
4
5
6
# >>> talisman >>>
# Below environment variables should not be modified unless you know what you are doing
export TALISMAN_HOME=~/.talisman/bin
alias talisman=$TALISMAN_HOME/talisman_darwin_amd64
export TALISMAN_INTERACTIVE=true
# <<< talisman <<<

then make it ready, besides you need restart your IDE or other:

1
source ~/.zshrc

Pre-commit chain with husky

make sure has such code in package.json

1
2
3
4
5
6
7
8
...
"husky": {
"hooks": {
"pre-commit": "$TALISMAN_HOME/talisman_hook_script pre-commit && lint-staged",
"pre-push": "npm run test:unit"
}
},
...

Ok, all done :)