Automate tasks that happen on when you pull in new code.
{
"scripts": {
"postcheckout": "pull-lock"
},
"pull-lock": {
"yarn.lock": "yarn install",
"Example/Podfile.lock": ["cd Example", "bundle exec pod install"]
}
}Like lint-staged for when you've git pulled. You set up a
husky "postcheckout" hook which is passed to the CLI tool pull-lock.
pull-lock will then compare the changedfiles to the config and execute commands for you automatically.
yarn add --dev pull-lock husky- Update your
package.jsonlike this:
{
"scripts": {
+ "postcheckout": "pull-lock"
},
+ "pull-lock": {
+ "yarn.lock": "yarn install",
+ }
}Then when you run a git pull, pull-lock will check for yarn.lock inside the diffed files and run the
scripts inside your config files.
As pull-lock uses cosmic-config you can leave your app settings in either:
- a
pull-lockobject in yourpackage.json - a
.pulllockrcfile in JSON or YML format - a
pull-lock.config.jsfile in JS format