@vizamodo/viza-cli 1.2.29 → 1.2.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -107,13 +107,18 @@ export async function checkForCliUpdateSoft() {
107
107
  // FIX 1: Nếu version local hiện tại khác với version ghi trong cache,
108
108
  // nghĩa là user vừa nâng cấp hoặc hạ cấp -> Bỏ qua cache để check mới.
109
109
  if (cached.current === current && cached.checkedAt && (now - cached.checkedAt) < ttl) {
110
- // If last check found no update (latest == current), allow a quick re-check after 60s
111
- if (cached.latest === cached.current && (now - cached.checkedAt) > 60 * 1000) {
112
- // fall through to fetch
110
+ // Sliding TTL: refresh checkedAt when serving cache
111
+ cached.checkedAt = now;
112
+ try {
113
+ const configDir = dirname(cachePath);
114
+ if (!existsSync(configDir))
115
+ mkdirSync(configDir, { recursive: true });
116
+ writeFileSync(cachePath, JSON.stringify(cached), "utf8");
113
117
  }
114
- else {
115
- return cached;
118
+ catch {
119
+ // ignore
116
120
  }
121
+ return cached;
117
122
  }
118
123
  }
119
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizamodo/viza-cli",
3
- "version": "1.2.29",
3
+ "version": "1.2.32",
4
4
  "type": "module",
5
5
  "description": "Viza unified command line interface",
6
6
  "bin": {