cmdA || cmdB snippet means "Run
cmdA and if it fails (exits with an exit code other than 0), run
From https://stackoverflow.com/q/3224878/4482039: the colon
: in bash is a command that does nothing.
rm -r node_modules || :; ... snippet can be interpreted as:
rm -r node_modules.
- If it fails (because the
node_modules file/directory does not exist, or we don't have permissions), do nothing (ignore the error)
- Run the rest of the line.
This is a way to ignore errors, because in this case errors are expected. Specifcally for
rm, this way is safer than the
-f flag because it doesn't force the removal of files
rm would usually refuse to delete.