mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 14:17:11 +00:00
fix: clear package manager cache during update to ensure fresh downloads (v4.3.10) (#19)
* fix: clear package manager cache during update to ensure fresh downloads (v4.3.10) Resolves issue where 'ccs update' would report success but serve cached package versions, requiring manual 'npm cache clean --force'. Changes: - Node.js (bin/ccs.js): Added cache clearing for npm, yarn, pnpm before update - Bash (lib/ccs): Added 'npm cache clean --force' before npm update - PowerShell (lib/ccs.ps1): Added 'npm cache clean --force' before npm update - Updated manual fallback commands to include cache clearing - Non-blocking: continues with update even if cache clearing fails Version bumped to 4.3.10 * docs: update CHANGELOG for v4.3.10
This commit is contained in:
1 parent
e148373c62
commit
0f82b0cb06
8 files changed
+114
-35
No files matched your search
@@ -2,7 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
# Version (updated by scripts/bump-version.sh)
|
||||
CCS_VERSION="4.3.9"
|
||||
CCS_VERSION="4.3.10"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}"
|
||||
readonly PROFILES_JSON="$HOME/.ccs/profiles.json"
|
||||
@@ -674,6 +674,13 @@ update_run() {
|
||||
echo -e "${CYAN}Updating via npm...${RESET}"
|
||||
echo ""
|
||||
|
||||
# Clear npm cache to ensure fresh download
|
||||
echo -e "${CYAN}Clearing package cache...${RESET}"
|
||||
if ! npm cache clean --force 2>/dev/null; then
|
||||
echo -e "${YELLOW}[!] Cache clearing failed, proceeding anyway...${RESET}"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
if npm install -g @kaitranntt/ccs@latest; then
|
||||
echo ""
|
||||
echo -e "${GREEN}[OK] Update successful!${RESET}"
|
||||
@@ -686,7 +693,7 @@ update_run() {
|
||||
echo -e "${RED}[X] Update failed${RESET}"
|
||||
echo ""
|
||||
echo "Try manually:"
|
||||
echo -e " ${YELLOW}npm install -g @kaitranntt/ccs@latest${RESET}"
|
||||
echo -e " ${YELLOW}npm cache clean --force && npm install -g @kaitranntt/ccs@latest${RESET}"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
+14
-2
@@ -12,7 +12,7 @@ param(
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Version (updated by scripts/bump-version.sh)
|
||||
$CcsVersion = "4.3.9"
|
||||
$CcsVersion = "4.3.10"
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" }
|
||||
$ProfilesJson = "$env:USERPROFILE\.ccs\profiles.json"
|
||||
@@ -1122,6 +1122,18 @@ function Update-Run {
|
||||
Write-Host "Updating via npm..." -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Clear npm cache to ensure fresh download
|
||||
Write-Host "Clearing package cache..." -ForegroundColor Cyan
|
||||
try {
|
||||
npm cache clean --force 2>$null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "[!] Cache clearing failed, proceeding anyway..." -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
Write-Host "[!] Cache clearing failed, proceeding anyway..." -ForegroundColor Yellow
|
||||
}
|
||||
Write-Host ""
|
||||
|
||||
try {
|
||||
npm install -g @kaitranntt/ccs@latest
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
@@ -1139,7 +1151,7 @@ function Update-Run {
|
||||
Write-Host "[X] Update failed" -ForegroundColor Red
|
||||
Write-Host ""
|
||||
Write-Host "Try manually:"
|
||||
Write-Host " npm install -g @kaitranntt/ccs@latest" -ForegroundColor Yellow
|
||||
Write-Host " npm cache clean --force; npm install -g @kaitranntt/ccs@latest" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user