From 71301a64367b79dfd77daf5291e4c11bd586dee9 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Thu, 7 Dec 2023 01:37:39 +0200 Subject: [PATCH] feat(scripts): add cache clearing operations --- scripts/install-cargo-packages.sh | 4 +++- scripts/install-cheat-tldr.sh | 5 ++++- scripts/install-go-packages.sh | 4 ++++ scripts/install-npm-packages.sh | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/install-cargo-packages.sh b/scripts/install-cargo-packages.sh index 3e29f6c..4e7ee58 100755 --- a/scripts/install-cargo-packages.sh +++ b/scripts/install-cargo-packages.sh @@ -24,6 +24,7 @@ source "$CARGO_HOME/env" rustup default system packages=( + "cargo-clean" # starship.rs "starship" # An incremental parsing system for programming tools @@ -68,4 +69,5 @@ x-have bob && { bob use stable && x-path-append "$XDG_DATA_HOME/bob/nvim-bin" } -msg_done "All next steps done!" +msg_run "Removing cargo cache" +cargo cache --autoclean diff --git a/scripts/install-cheat-tldr.sh b/scripts/install-cheat-tldr.sh index df1e641..edbdd66 100755 --- a/scripts/install-cheat-tldr.sh +++ b/scripts/install-cheat-tldr.sh @@ -24,10 +24,13 @@ else # Update the repo msg_run "Starting to update $TLDR_GIT" git -C "$TLDR_TEMP_DIR" reset --hard origin/main - git -C "$TLDR_TEMP_DIR" pull -q \ + git -C "$TLDR_TEMP_DIR" pull -q --depth 2 \ && msg_done "Updated $TLDR_GIT" fi +msg_run "Removing non-english translation files" +rm -rf "$TLDR_TEMP_DIR/pages.*" + # Fetch the destination directory from cheat defined directories. TLDR_CHEAT_DEST="$(cheat -d | grep tldr | head -1 | awk '{print $2}')" diff --git a/scripts/install-go-packages.sh b/scripts/install-go-packages.sh index 1d5521d..d74fb06 100755 --- a/scripts/install-go-packages.sh +++ b/scripts/install-go-packages.sh @@ -50,4 +50,8 @@ x-have git-profile && { } echo "" + +msg_run "Clearing go cache" +go clean -cache -modcache + msg_ok "Done" diff --git a/scripts/install-npm-packages.sh b/scripts/install-npm-packages.sh index 7e41720..d2c2774 100755 --- a/scripts/install-npm-packages.sh +++ b/scripts/install-npm-packages.sh @@ -37,3 +37,8 @@ done msg_run "Upgrading all global packages" npm -g --no-progress --no-timing --no-fund outdated npm -g --no-timing --no-fund upgrade + +msg_run "Cleaning up npm cache" +npm cache verify +npm cache clean --force +npm cache verify