sequant 1.5.4 → 1.5.5
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.
|
@@ -31,11 +31,24 @@ export function getCachePath() {
|
|
|
31
31
|
*/
|
|
32
32
|
export function getCurrentVersion() {
|
|
33
33
|
try {
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
// Walk up from current directory until we find sequant's package.json
|
|
35
|
+
// Works from both source (src/lib/) and compiled (dist/src/lib/) locations
|
|
36
|
+
let dir = __dirname;
|
|
37
|
+
while (dir !== path.dirname(dir)) {
|
|
38
|
+
const candidate = path.resolve(dir, "package.json");
|
|
39
|
+
try {
|
|
40
|
+
const content = fs.readFileSync(candidate, "utf8");
|
|
41
|
+
const pkg = JSON.parse(content);
|
|
42
|
+
if (pkg.name === "sequant") {
|
|
43
|
+
return pkg.version || "0.0.0";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Not found, continue searching
|
|
48
|
+
}
|
|
49
|
+
dir = path.dirname(dir);
|
|
50
|
+
}
|
|
51
|
+
return "0.0.0";
|
|
39
52
|
}
|
|
40
53
|
catch {
|
|
41
54
|
return "0.0.0";
|