baro-ai 0.10.3 → 0.11.1
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/baro +2 -9
- package/bin/baro.cmd +1 -2
- package/package.json +1 -1
- package/scripts/postinstall.js +12 -12
package/bin/baro
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env sh
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
while [ -L "$SELF" ]; do
|
|
5
|
-
DIR="$(cd "$(dirname "$SELF")" && pwd)"
|
|
6
|
-
SELF="$(readlink "$SELF")"
|
|
7
|
-
case "$SELF" in /*) ;; *) SELF="$DIR/$SELF" ;; esac
|
|
8
|
-
done
|
|
9
|
-
SCRIPT_DIR="$(cd "$(dirname "$SELF")" && pwd)"
|
|
10
|
-
NATIVE="$SCRIPT_DIR/baro-native"
|
|
2
|
+
# Look for baro binary in ~/.baro/bin/
|
|
3
|
+
NATIVE="$HOME/.baro/bin/baro"
|
|
11
4
|
if [ -x "$NATIVE" ]; then
|
|
12
5
|
exec "$NATIVE" "$@"
|
|
13
6
|
else
|
package/bin/baro.cmd
CHANGED
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* Postinstall script - downloads the baro binary for the current platform.
|
|
4
|
-
* Binary is
|
|
5
|
-
*
|
|
6
|
-
* ENOTEMPTY errors on upgrade.
|
|
4
|
+
* Binary is stored in ~/.baro/bin/ (outside the npm package directory)
|
|
5
|
+
* to avoid ENOTEMPTY errors when npm upgrades the package.
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
import * as fs from "fs"
|
|
10
9
|
import * as path from "path"
|
|
11
10
|
import { fileURLToPath } from "url"
|
|
12
11
|
import * as https from "https"
|
|
12
|
+
import * as os from "os"
|
|
13
13
|
|
|
14
14
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
15
15
|
const PACKAGE_ROOT = path.resolve(__dirname, "..")
|
|
16
|
-
const
|
|
17
|
-
const
|
|
16
|
+
const BARO_HOME = path.join(os.homedir(), ".baro", "bin")
|
|
17
|
+
const BINARY_NAME = process.platform === "win32" ? "baro.exe" : "baro"
|
|
18
18
|
const REPO = "Lotus015/baro"
|
|
19
19
|
|
|
20
20
|
function getPlatformKey() {
|
|
@@ -66,7 +66,7 @@ async function download(url, dest) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
async function main() {
|
|
69
|
-
const
|
|
69
|
+
const binaryPath = path.join(BARO_HOME, BINARY_NAME)
|
|
70
70
|
const platformKey = getPlatformKey()
|
|
71
71
|
const version = getVersion()
|
|
72
72
|
|
|
@@ -77,17 +77,17 @@ async function main() {
|
|
|
77
77
|
|
|
78
78
|
console.log(`Downloading baro for ${platformKey}...`)
|
|
79
79
|
|
|
80
|
-
fs.mkdirSync(
|
|
80
|
+
fs.mkdirSync(BARO_HOME, { recursive: true })
|
|
81
81
|
|
|
82
|
-
// Clean up old binary
|
|
83
|
-
try { fs.unlinkSync(
|
|
82
|
+
// Clean up old binary
|
|
83
|
+
try { fs.unlinkSync(binaryPath) } catch {}
|
|
84
84
|
|
|
85
85
|
try {
|
|
86
|
-
await download(url,
|
|
86
|
+
await download(url, binaryPath)
|
|
87
87
|
if (process.platform !== "win32") {
|
|
88
|
-
fs.chmodSync(
|
|
88
|
+
fs.chmodSync(binaryPath, 0o755)
|
|
89
89
|
}
|
|
90
|
-
console.log(`baro installed
|
|
90
|
+
console.log(`baro installed to ${BARO_HOME}`)
|
|
91
91
|
} catch (err) {
|
|
92
92
|
console.warn(`Warning: Could not download baro: ${err.message}`)
|
|
93
93
|
console.warn(` Build manually: cargo build --release -p baro-tui`)
|