5-phase-workflow 1.5.1 → 1.5.2
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.
- package/bin/install.js +2 -5
- package/package.json +1 -1
- package/src/hooks/check-updates.js +14 -22
package/bin/install.js
CHANGED
|
@@ -402,9 +402,7 @@ function initializeVersionJson(isGlobal) {
|
|
|
402
402
|
installedVersion: version,
|
|
403
403
|
installedAt: now,
|
|
404
404
|
lastUpdated: now,
|
|
405
|
-
installationType: isGlobal ? 'global' : 'local'
|
|
406
|
-
updateCheckLastRun: null,
|
|
407
|
-
updateCheckFrequency: 86400 // 24 hours in seconds
|
|
405
|
+
installationType: isGlobal ? 'global' : 'local'
|
|
408
406
|
};
|
|
409
407
|
|
|
410
408
|
fs.writeFileSync(versionFile, JSON.stringify(versionData, null, 2));
|
|
@@ -561,8 +559,7 @@ function performUpdate(targetPath, sourcePath, isGlobal, versionInfo) {
|
|
|
561
559
|
// Legacy install, create version.json
|
|
562
560
|
versionData = {
|
|
563
561
|
installedAt: new Date().toISOString(),
|
|
564
|
-
installationType: isGlobal ? 'global' : 'local'
|
|
565
|
-
updateCheckFrequency: 86400
|
|
562
|
+
installationType: isGlobal ? 'global' : 'local'
|
|
566
563
|
};
|
|
567
564
|
}
|
|
568
565
|
|
package/package.json
CHANGED
|
@@ -39,35 +39,27 @@ async function checkForUpdates(workspaceDir) {
|
|
|
39
39
|
process.exit(0);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// Check if we should run (daily frequency)
|
|
43
|
-
const now = Date.now();
|
|
44
|
-
const lastCheck = versionData.updateCheckLastRun
|
|
45
|
-
? new Date(versionData.updateCheckLastRun).getTime()
|
|
46
|
-
: 0;
|
|
47
|
-
const frequency = (versionData.updateCheckFrequency || 86400) * 1000; // Convert to ms
|
|
48
|
-
|
|
49
|
-
if (now - lastCheck < frequency) {
|
|
50
|
-
// Checked recently, skip
|
|
51
|
-
process.exit(0);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Update last check time
|
|
55
|
-
versionData.updateCheckLastRun = new Date().toISOString();
|
|
56
|
-
|
|
57
42
|
// Compare versions
|
|
58
43
|
const installed = versionData.installedVersion;
|
|
59
44
|
const latestVersion = await getLatestVersion();
|
|
60
45
|
|
|
46
|
+
let newLatest = null;
|
|
61
47
|
if (latestVersion && compareVersions(installed, latestVersion) < 0) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
newLatest = latestVersion;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Only write if latestAvailableVersion actually changed
|
|
52
|
+
const oldLatest = versionData.latestAvailableVersion || null;
|
|
53
|
+
if (newLatest !== oldLatest) {
|
|
54
|
+
versionData.latestAvailableVersion = newLatest;
|
|
55
|
+
|
|
56
|
+
// Clean up legacy throttling fields
|
|
57
|
+
delete versionData.updateCheckLastRun;
|
|
58
|
+
delete versionData.updateCheckFrequency;
|
|
59
|
+
|
|
60
|
+
fs.writeFileSync(versionFile, JSON.stringify(versionData, null, 2));
|
|
67
61
|
}
|
|
68
62
|
|
|
69
|
-
// Single consolidated write
|
|
70
|
-
fs.writeFileSync(versionFile, JSON.stringify(versionData, null, 2));
|
|
71
63
|
process.exit(0);
|
|
72
64
|
}
|
|
73
65
|
|