feat: add automatic yarn cache cleanup with a config option

This commit is contained in:
Roni Väyrynen
2023-05-16 13:10:01 +03:00
parent ce1cd412ad
commit 588d4f3689
2 changed files with 14 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ USESUDO="${USESUDO:-"false"}"
GENSUDO="${GENSUDO:-"false"}"
INSTALL_REPOS="${INSTALL_REPOS:-"true"}"
SYSLOG_TARGET="${SYSLOG_TARGET:-""}"
YARN_CACHE_CLEANUP="${YARN_CACHE_CLEANUP:-"false"}"
# set variables not changeable in configfile
TIME=$(date +%Y%m%d%H%M)
@@ -949,6 +950,14 @@ function UpdateXO {
done
printok "Removing old inactive installations after update. Leaving $PRESERVE latest"
echo
# clear yarn cache if defined in configuration
if [[ "$YARN_CACHE_CLEANUP" == "true" ]]; then
printprog "Cleaning yarn cache"
runcmd "yarn cache clean"
printok "Cleaning yarn cache"
echo
fi
}
function InstallXOProxy {