Who doesn’t you know this situation: you checked out a feature branch, installed a custom app or changed some code, but the system doesn’t behave as expected? This can have a variety of causes:
- You’re missing some dependencies
- JavaScript has not been compiled, so you’re running old code
- Data and code is still in the cache, so you’re running old code and seeing old data
- Bench has not been restarted, so you’re running old code
- …
The usual solution is to run a variety of bench commands: bench setup requirements
, bench migrate
, bench build
, bench restart
, bench clear-cache
.
That’s a lot to remember. So why not make life easier and combine them all into one command. Introducing: bench-fix
.
Just add the following line to your ~/.bashrc
or ~/.zshrc
:
alias bench-fix='bench setup requirements && bench migrate && bench build --force && bench clear-cache && bench restart'
Caveats:
bench migrate
can work on a specific site or an all sites, so you have to think about this when you’re working on a multi-tenant setup.
There you have it. Now you can just run bench-fix
and the problems described above will magically disappear. You’ll have to restart your terminal for the command to work.
Extra-tip: this is just server-side. Be sure to hard refresh your browser as well.