qtex 1.1.6 → 1.1.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/updater.js +16 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qtex",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Ultra-fast cloud LaTeX compiler. Compile .tex documents in milliseconds without installing TeXLive or MikTeX. Zero config, sub-second builds, live watch mode.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/updater.js CHANGED
@@ -26,6 +26,20 @@ async function saveState(state) {
26
26
  } catch { }
27
27
  }
28
28
 
29
+ /**
30
+ * Simple semver comparison (v1.2.3 format)
31
+ * Returns true if latest > current
32
+ */
33
+ function isNewer(latest, current) {
34
+ const l = latest.split('.').map(Number);
35
+ const c = current.split('.').map(Number);
36
+ for (let i = 0; i < 3; i++) {
37
+ if (l[i] > c[i]) return true;
38
+ if (l[i] < c[i]) return false;
39
+ }
40
+ return false;
41
+ }
42
+
29
43
  /**
30
44
  * Checks for updates in the background and launches a detached
31
45
  * background process to update the binary if a new version is found.
@@ -47,7 +61,7 @@ export async function autoUpdate(currentVersion) {
47
61
 
48
62
  await saveState({ ...state, lastCheck: now });
49
63
 
50
- if (latestVersion !== currentVersion) {
64
+ if (isNewer(latestVersion, currentVersion)) {
51
65
  console.log(`${colors.dim}\nšŸš€ New version detected (${data.tag_name}). Updating silently in background...${colors.reset}`);
52
66
 
53
67
  // Platform-aware install command
@@ -79,7 +93,7 @@ export async function selfUpdate(currentVersion) {
79
93
  const data = await res.json();
80
94
  const latestVersion = data.tag_name.replace('v', '');
81
95
 
82
- if (latestVersion === currentVersion) {
96
+ if (!isNewer(latestVersion, currentVersion)) {
83
97
  ui.success(`qtex is already up to date (${colors.bold}v${currentVersion}${colors.reset}).`);
84
98
  return;
85
99
  }