offgrid-ai 0.8.3 → 0.8.4
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/package.json +1 -1
- package/src/postinstall.mjs +20 -2
package/package.json
CHANGED
package/src/postinstall.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { existsSync, readFileSync, appendFileSync } from "node:fs";
|
|
3
3
|
import { mkdirSync } from "node:fs";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
5
6
|
|
|
6
7
|
if (process.env.CI || process.env.OFFGRID_SKIP_POSTINSTALL) process.exit(0);
|
|
7
8
|
|
|
@@ -73,8 +74,16 @@ if (!content.includes(npmBin)) {
|
|
|
73
74
|
try {
|
|
74
75
|
mkdirSync(dirname(rcFile), { recursive: true });
|
|
75
76
|
appendFileSync(rcFile, `${content.endsWith("\n") || content.length === 0 ? "" : "\n"}\n${marker}\n${pathLine}\n`, "utf8");
|
|
76
|
-
|
|
77
|
-
console.log(
|
|
77
|
+
const version = currentPackageVersion();
|
|
78
|
+
console.log("");
|
|
79
|
+
console.log(`offgrid-ai v${version} installed and added to PATH`);
|
|
80
|
+
console.log(` Config file: ${rcFile}`);
|
|
81
|
+
console.log(` Bin path: ${npmBin}`);
|
|
82
|
+
console.log("");
|
|
83
|
+
console.log("To use it right now in this terminal, run:");
|
|
84
|
+
console.log(` source ${rcFile}`);
|
|
85
|
+
console.log("");
|
|
86
|
+
console.log("Or open a new terminal window/tab.");
|
|
78
87
|
} catch (err) {
|
|
79
88
|
console.log(`offgrid-ai postinstall: could not write to ${rcFile}: ${err.message}`);
|
|
80
89
|
}
|
|
@@ -88,6 +97,15 @@ if (process.getuid?.() === 0) {
|
|
|
88
97
|
console.log("If you installed with sudo, run the installer as your normal user instead, or manually add the line above to your user's shell config.");
|
|
89
98
|
}
|
|
90
99
|
|
|
100
|
+
function currentPackageVersion() {
|
|
101
|
+
try {
|
|
102
|
+
const pkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "package.json"), "utf8"));
|
|
103
|
+
return pkg.version;
|
|
104
|
+
} catch {
|
|
105
|
+
return "";
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
91
109
|
function isHermesPrefix(prefix, home) {
|
|
92
110
|
const normalized = prefix.replace(/\\/gu, "/");
|
|
93
111
|
if (normalized.includes("/.hermes/")) return true;
|