@jiugeqqqqq/dsh-house 0.3.2 → 0.3.3
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/lib/host/index.js +4 -2
- package/package.json +1 -1
package/lib/host/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { readFile, writeFile, appendFile, mkdir, copyFile } from 'node:fs/promis
|
|
|
17
17
|
import fs from 'node:fs';
|
|
18
18
|
import zlib from 'node:zlib';
|
|
19
19
|
import path from 'node:path';
|
|
20
|
-
import { createUpdateChecker } from '../update-check.js';
|
|
20
|
+
import { createUpdateChecker, compareVersions } from '../update-check.js';
|
|
21
21
|
|
|
22
22
|
export const name = 'house';
|
|
23
23
|
export const inject = [];
|
|
@@ -697,7 +697,9 @@ export function apply(ctx, config = {}) {
|
|
|
697
697
|
const u = updateChecker.get() || {};
|
|
698
698
|
result.data.version = pkgVersion;
|
|
699
699
|
result.data.latest = u.latest || '';
|
|
700
|
-
|
|
700
|
+
// 用**实时**的本机版本重算,别信缓存里的 updateAvailable:
|
|
701
|
+
// 本地升到和 npm 同版本后,缓存的 true 会让页面显示「0.3.2 → 0.3.2 可更新」。
|
|
702
|
+
result.data.updateAvailable = u.latest ? compareVersions(u.latest, pkgVersion) > 0 : false;
|
|
701
703
|
}
|
|
702
704
|
writeJson(response, 200, result);
|
|
703
705
|
return;
|