@vizamodo/viza-cli 1.2.24 → 1.2.27

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.
@@ -98,7 +98,7 @@ function semverCompare(a, b) {
98
98
  export async function checkForCliUpdateSoft() {
99
99
  const cachePath = resolveUpdateCachePath();
100
100
  const now = Date.now();
101
- const ttl = 3 * 60 * 60 * 1000;
101
+ const ttl = 10 * 60 * 1000;
102
102
  const current = getCliVersion();
103
103
  try {
104
104
  if (existsSync(cachePath)) {
@@ -107,7 +107,13 @@ 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
- return cached;
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
113
+ }
114
+ else {
115
+ return cached;
116
+ }
111
117
  }
112
118
  }
113
119
  }
@@ -129,7 +135,7 @@ export async function checkForCliUpdateSoft() {
129
135
  if (!latest || typeof latest !== "string")
130
136
  return null;
131
137
  const cmp = semverCompare(latest, current);
132
- const hasUpdate = cmp > 1 || (cmp > 0 && current !== "dev"); // "dev" không báo update
138
+ const hasUpdate = cmp > 0 && current !== "dev";
133
139
  const info = {
134
140
  current,
135
141
  latest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizamodo/viza-cli",
3
- "version": "1.2.24",
3
+ "version": "1.2.27",
4
4
  "type": "module",
5
5
  "description": "Viza unified command line interface",
6
6
  "bin": {